index.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373
  1. /*! Element Plus v2.3.3 */
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
  4. typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
  5. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElementPlus = {}, global.Vue));
  6. })(this, (function (exports, vue) { 'use strict';
  7. const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`;
  8. const isVisible = (element) => {
  9. const computed = getComputedStyle(element);
  10. return computed.position === "fixed" ? false : element.offsetParent !== null;
  11. };
  12. const obtainAllFocusableElements$1 = (element) => {
  13. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  14. };
  15. const isFocusable = (element) => {
  16. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  17. return true;
  18. }
  19. if (element.disabled) {
  20. return false;
  21. }
  22. switch (element.nodeName) {
  23. case "A": {
  24. return !!element.href && element.rel !== "ignore";
  25. }
  26. case "INPUT": {
  27. return !(element.type === "hidden" || element.type === "file");
  28. }
  29. case "BUTTON":
  30. case "SELECT":
  31. case "TEXTAREA": {
  32. return true;
  33. }
  34. default: {
  35. return false;
  36. }
  37. }
  38. };
  39. const triggerEvent = function(elm, name, ...opts) {
  40. let eventName;
  41. if (name.includes("mouse") || name.includes("click")) {
  42. eventName = "MouseEvents";
  43. } else if (name.includes("key")) {
  44. eventName = "KeyboardEvent";
  45. } else {
  46. eventName = "HTMLEvents";
  47. }
  48. const evt = document.createEvent(eventName);
  49. evt.initEvent(name, ...opts);
  50. elm.dispatchEvent(evt);
  51. return elm;
  52. };
  53. const isLeaf = (el) => !el.getAttribute("aria-owns");
  54. const getSibling = (el, distance, elClass) => {
  55. const { parentNode } = el;
  56. if (!parentNode)
  57. return null;
  58. const siblings = parentNode.querySelectorAll(elClass);
  59. const index = Array.prototype.indexOf.call(siblings, el);
  60. return siblings[index + distance] || null;
  61. };
  62. const focusNode = (el) => {
  63. if (!el)
  64. return;
  65. el.focus();
  66. !isLeaf(el) && el.click();
  67. };
  68. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  69. const handleEvent = (event) => {
  70. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  71. if (checkForDefaultPrevented === false || !shouldPrevent) {
  72. return oursHandler == null ? void 0 : oursHandler(event);
  73. }
  74. };
  75. return handleEvent;
  76. };
  77. const whenMouse = (handler) => {
  78. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  79. };
  80. var __defProp$9 = Object.defineProperty;
  81. var __defProps$6 = Object.defineProperties;
  82. var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
  83. var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
  84. var __hasOwnProp$b = Object.prototype.hasOwnProperty;
  85. var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
  86. var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  87. var __spreadValues$9 = (a, b) => {
  88. for (var prop in b || (b = {}))
  89. if (__hasOwnProp$b.call(b, prop))
  90. __defNormalProp$9(a, prop, b[prop]);
  91. if (__getOwnPropSymbols$b)
  92. for (var prop of __getOwnPropSymbols$b(b)) {
  93. if (__propIsEnum$b.call(b, prop))
  94. __defNormalProp$9(a, prop, b[prop]);
  95. }
  96. return a;
  97. };
  98. var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
  99. function computedEager(fn, options) {
  100. var _a;
  101. const result = vue.shallowRef();
  102. vue.watchEffect(() => {
  103. result.value = fn();
  104. }, __spreadProps$6(__spreadValues$9({}, options), {
  105. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  106. }));
  107. return vue.readonly(result);
  108. }
  109. var _a;
  110. const isClient = typeof window !== "undefined";
  111. const isDef = (val) => typeof val !== "undefined";
  112. const isBoolean$1 = (val) => typeof val === "boolean";
  113. const isNumber$1 = (val) => typeof val === "number";
  114. const isString$2 = (val) => typeof val === "string";
  115. const noop$1 = () => {
  116. };
  117. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  118. function resolveUnref(r) {
  119. return typeof r === "function" ? r() : vue.unref(r);
  120. }
  121. function createFilterWrapper(filter, fn) {
  122. function wrapper(...args) {
  123. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  124. }
  125. return wrapper;
  126. }
  127. function debounceFilter(ms, options = {}) {
  128. let timer;
  129. let maxTimer;
  130. const filter = (invoke) => {
  131. const duration = resolveUnref(ms);
  132. const maxDuration = resolveUnref(options.maxWait);
  133. if (timer)
  134. clearTimeout(timer);
  135. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  136. if (maxTimer) {
  137. clearTimeout(maxTimer);
  138. maxTimer = null;
  139. }
  140. return invoke();
  141. }
  142. if (maxDuration && !maxTimer) {
  143. maxTimer = setTimeout(() => {
  144. if (timer)
  145. clearTimeout(timer);
  146. maxTimer = null;
  147. invoke();
  148. }, maxDuration);
  149. }
  150. timer = setTimeout(() => {
  151. if (maxTimer)
  152. clearTimeout(maxTimer);
  153. maxTimer = null;
  154. invoke();
  155. }, duration);
  156. };
  157. return filter;
  158. }
  159. function throttleFilter(ms, trailing = true, leading = true) {
  160. let lastExec = 0;
  161. let timer;
  162. let isLeading = true;
  163. const clear = () => {
  164. if (timer) {
  165. clearTimeout(timer);
  166. timer = void 0;
  167. }
  168. };
  169. const filter = (invoke) => {
  170. const duration = resolveUnref(ms);
  171. const elapsed = Date.now() - lastExec;
  172. clear();
  173. if (duration <= 0) {
  174. lastExec = Date.now();
  175. return invoke();
  176. }
  177. if (elapsed > duration && (leading || !isLeading)) {
  178. lastExec = Date.now();
  179. invoke();
  180. } else if (trailing) {
  181. timer = setTimeout(() => {
  182. lastExec = Date.now();
  183. isLeading = true;
  184. clear();
  185. invoke();
  186. }, duration);
  187. }
  188. if (!leading && !timer)
  189. timer = setTimeout(() => isLeading = true, duration);
  190. isLeading = false;
  191. };
  192. return filter;
  193. }
  194. function identity$1(arg) {
  195. return arg;
  196. }
  197. function tryOnScopeDispose(fn) {
  198. if (vue.getCurrentScope()) {
  199. vue.onScopeDispose(fn);
  200. return true;
  201. }
  202. return false;
  203. }
  204. function useDebounceFn(fn, ms = 200, options = {}) {
  205. return createFilterWrapper(debounceFilter(ms, options), fn);
  206. }
  207. function refDebounced(value, ms = 200, options = {}) {
  208. if (ms <= 0)
  209. return value;
  210. const debounced = vue.ref(value.value);
  211. const updater = useDebounceFn(() => {
  212. debounced.value = value.value;
  213. }, ms, options);
  214. vue.watch(value, () => updater());
  215. return debounced;
  216. }
  217. function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
  218. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  219. }
  220. function tryOnMounted(fn, sync = true) {
  221. if (vue.getCurrentInstance())
  222. vue.onMounted(fn);
  223. else if (sync)
  224. fn();
  225. else
  226. vue.nextTick(fn);
  227. }
  228. function useTimeoutFn(cb, interval, options = {}) {
  229. const {
  230. immediate = true
  231. } = options;
  232. const isPending = vue.ref(false);
  233. let timer = null;
  234. function clear() {
  235. if (timer) {
  236. clearTimeout(timer);
  237. timer = null;
  238. }
  239. }
  240. function stop() {
  241. isPending.value = false;
  242. clear();
  243. }
  244. function start(...args) {
  245. clear();
  246. isPending.value = true;
  247. timer = setTimeout(() => {
  248. isPending.value = false;
  249. timer = null;
  250. cb(...args);
  251. }, resolveUnref(interval));
  252. }
  253. if (immediate) {
  254. isPending.value = true;
  255. if (isClient)
  256. start();
  257. }
  258. tryOnScopeDispose(stop);
  259. return {
  260. isPending,
  261. start,
  262. stop
  263. };
  264. }
  265. function unrefElement(elRef) {
  266. var _a;
  267. const plain = resolveUnref(elRef);
  268. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  269. }
  270. const defaultWindow = isClient ? window : void 0;
  271. const defaultDocument = isClient ? window.document : void 0;
  272. function useEventListener(...args) {
  273. let target;
  274. let event;
  275. let listener;
  276. let options;
  277. if (isString$2(args[0])) {
  278. [event, listener, options] = args;
  279. target = defaultWindow;
  280. } else {
  281. [target, event, listener, options] = args;
  282. }
  283. if (!target)
  284. return noop$1;
  285. let cleanup = noop$1;
  286. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  287. cleanup();
  288. if (!el)
  289. return;
  290. el.addEventListener(event, listener, options);
  291. cleanup = () => {
  292. el.removeEventListener(event, listener, options);
  293. cleanup = noop$1;
  294. };
  295. }, { immediate: true, flush: "post" });
  296. const stop = () => {
  297. stopWatch();
  298. cleanup();
  299. };
  300. tryOnScopeDispose(stop);
  301. return stop;
  302. }
  303. function onClickOutside(target, handler, options = {}) {
  304. const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options;
  305. if (!window)
  306. return;
  307. const shouldListen = vue.ref(true);
  308. let fallback;
  309. const listener = (event) => {
  310. window.clearTimeout(fallback);
  311. const el = unrefElement(target);
  312. const composedPath = event.composedPath();
  313. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  314. return;
  315. if (ignore && ignore.length > 0) {
  316. if (ignore.some((target2) => {
  317. const el2 = unrefElement(target2);
  318. return el2 && (event.target === el2 || composedPath.includes(el2));
  319. }))
  320. return;
  321. }
  322. handler(event);
  323. };
  324. const cleanup = [
  325. useEventListener(window, "click", listener, { passive: true, capture }),
  326. useEventListener(window, "pointerdown", (e) => {
  327. const el = unrefElement(target);
  328. shouldListen.value = !!el && !e.composedPath().includes(el);
  329. }, { passive: true }),
  330. useEventListener(window, "pointerup", (e) => {
  331. if (e.button === 0) {
  332. const path = e.composedPath();
  333. e.composedPath = () => path;
  334. fallback = window.setTimeout(() => listener(e), 50);
  335. }
  336. }, { passive: true }),
  337. detectIframe && useEventListener(window, "blur", (event) => {
  338. var _a;
  339. const el = unrefElement(target);
  340. if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
  341. handler(event);
  342. })
  343. ].filter(Boolean);
  344. const stop = () => cleanup.forEach((fn) => fn());
  345. return stop;
  346. }
  347. function useSupported(callback, sync = false) {
  348. const isSupported = vue.ref();
  349. const update = () => isSupported.value = Boolean(callback());
  350. update();
  351. tryOnMounted(update, sync);
  352. return isSupported;
  353. }
  354. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  355. const globalKey = "__vueuse_ssr_handlers__";
  356. _global[globalKey] = _global[globalKey] || {};
  357. _global[globalKey];
  358. function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
  359. const variable = vue.ref(initialValue);
  360. const elRef = vue.computed(() => {
  361. var _a;
  362. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  363. });
  364. vue.watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  365. var _a;
  366. if (el && window) {
  367. const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim();
  368. variable.value = value || initialValue;
  369. }
  370. }, { immediate: true });
  371. vue.watch(variable, (val) => {
  372. var _a;
  373. if ((_a = elRef.value) == null ? void 0 : _a.style)
  374. elRef.value.style.setProperty(resolveUnref(prop), val);
  375. });
  376. return variable;
  377. }
  378. function useDocumentVisibility({ document = defaultDocument } = {}) {
  379. if (!document)
  380. return vue.ref("visible");
  381. const visibility = vue.ref(document.visibilityState);
  382. useEventListener(document, "visibilitychange", () => {
  383. visibility.value = document.visibilityState;
  384. });
  385. return visibility;
  386. }
  387. var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
  388. var __hasOwnProp$f = Object.prototype.hasOwnProperty;
  389. var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
  390. var __objRest$2 = (source, exclude) => {
  391. var target = {};
  392. for (var prop in source)
  393. if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
  394. target[prop] = source[prop];
  395. if (source != null && __getOwnPropSymbols$f)
  396. for (var prop of __getOwnPropSymbols$f(source)) {
  397. if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
  398. target[prop] = source[prop];
  399. }
  400. return target;
  401. };
  402. function useResizeObserver(target, callback, options = {}) {
  403. const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
  404. let observer;
  405. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  406. const cleanup = () => {
  407. if (observer) {
  408. observer.disconnect();
  409. observer = void 0;
  410. }
  411. };
  412. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  413. cleanup();
  414. if (isSupported.value && window && el) {
  415. observer = new ResizeObserver(callback);
  416. observer.observe(el, observerOptions);
  417. }
  418. }, { immediate: true, flush: "post" });
  419. const stop = () => {
  420. cleanup();
  421. stopWatch();
  422. };
  423. tryOnScopeDispose(stop);
  424. return {
  425. isSupported,
  426. stop
  427. };
  428. }
  429. function useElementBounding(target, options = {}) {
  430. const {
  431. reset = true,
  432. windowResize = true,
  433. windowScroll = true,
  434. immediate = true
  435. } = options;
  436. const height = vue.ref(0);
  437. const bottom = vue.ref(0);
  438. const left = vue.ref(0);
  439. const right = vue.ref(0);
  440. const top = vue.ref(0);
  441. const width = vue.ref(0);
  442. const x = vue.ref(0);
  443. const y = vue.ref(0);
  444. function update() {
  445. const el = unrefElement(target);
  446. if (!el) {
  447. if (reset) {
  448. height.value = 0;
  449. bottom.value = 0;
  450. left.value = 0;
  451. right.value = 0;
  452. top.value = 0;
  453. width.value = 0;
  454. x.value = 0;
  455. y.value = 0;
  456. }
  457. return;
  458. }
  459. const rect = el.getBoundingClientRect();
  460. height.value = rect.height;
  461. bottom.value = rect.bottom;
  462. left.value = rect.left;
  463. right.value = rect.right;
  464. top.value = rect.top;
  465. width.value = rect.width;
  466. x.value = rect.x;
  467. y.value = rect.y;
  468. }
  469. useResizeObserver(target, update);
  470. vue.watch(() => unrefElement(target), (ele) => !ele && update());
  471. if (windowScroll)
  472. useEventListener("scroll", update, { passive: true });
  473. if (windowResize)
  474. useEventListener("resize", update, { passive: true });
  475. tryOnMounted(() => {
  476. if (immediate)
  477. update();
  478. });
  479. return {
  480. height,
  481. bottom,
  482. left,
  483. right,
  484. top,
  485. width,
  486. x,
  487. y,
  488. update
  489. };
  490. }
  491. var SwipeDirection;
  492. (function(SwipeDirection2) {
  493. SwipeDirection2["UP"] = "UP";
  494. SwipeDirection2["RIGHT"] = "RIGHT";
  495. SwipeDirection2["DOWN"] = "DOWN";
  496. SwipeDirection2["LEFT"] = "LEFT";
  497. SwipeDirection2["NONE"] = "NONE";
  498. })(SwipeDirection || (SwipeDirection = {}));
  499. var __defProp = Object.defineProperty;
  500. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  501. var __hasOwnProp = Object.prototype.hasOwnProperty;
  502. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  503. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  504. var __spreadValues = (a, b) => {
  505. for (var prop in b || (b = {}))
  506. if (__hasOwnProp.call(b, prop))
  507. __defNormalProp(a, prop, b[prop]);
  508. if (__getOwnPropSymbols)
  509. for (var prop of __getOwnPropSymbols(b)) {
  510. if (__propIsEnum.call(b, prop))
  511. __defNormalProp(a, prop, b[prop]);
  512. }
  513. return a;
  514. };
  515. const _TransitionPresets = {
  516. easeInSine: [0.12, 0, 0.39, 0],
  517. easeOutSine: [0.61, 1, 0.88, 1],
  518. easeInOutSine: [0.37, 0, 0.63, 1],
  519. easeInQuad: [0.11, 0, 0.5, 0],
  520. easeOutQuad: [0.5, 1, 0.89, 1],
  521. easeInOutQuad: [0.45, 0, 0.55, 1],
  522. easeInCubic: [0.32, 0, 0.67, 0],
  523. easeOutCubic: [0.33, 1, 0.68, 1],
  524. easeInOutCubic: [0.65, 0, 0.35, 1],
  525. easeInQuart: [0.5, 0, 0.75, 0],
  526. easeOutQuart: [0.25, 1, 0.5, 1],
  527. easeInOutQuart: [0.76, 0, 0.24, 1],
  528. easeInQuint: [0.64, 0, 0.78, 0],
  529. easeOutQuint: [0.22, 1, 0.36, 1],
  530. easeInOutQuint: [0.83, 0, 0.17, 1],
  531. easeInExpo: [0.7, 0, 0.84, 0],
  532. easeOutExpo: [0.16, 1, 0.3, 1],
  533. easeInOutExpo: [0.87, 0, 0.13, 1],
  534. easeInCirc: [0.55, 0, 1, 0.45],
  535. easeOutCirc: [0, 0.55, 0.45, 1],
  536. easeInOutCirc: [0.85, 0, 0.15, 1],
  537. easeInBack: [0.36, 0, 0.66, -0.56],
  538. easeOutBack: [0.34, 1.56, 0.64, 1],
  539. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  540. };
  541. __spreadValues({
  542. linear: identity$1
  543. }, _TransitionPresets);
  544. function useVModel(props, key, emit, options = {}) {
  545. var _a, _b, _c;
  546. const {
  547. passive = false,
  548. eventName,
  549. deep = false,
  550. defaultValue
  551. } = options;
  552. const vm = vue.getCurrentInstance();
  553. 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));
  554. let event = eventName;
  555. if (!key) {
  556. {
  557. key = "modelValue";
  558. }
  559. }
  560. event = eventName || event || `update:${key.toString()}`;
  561. const getValue = () => isDef(props[key]) ? props[key] : defaultValue;
  562. if (passive) {
  563. const proxy = vue.ref(getValue());
  564. vue.watch(() => props[key], (v) => proxy.value = v);
  565. vue.watch(proxy, (v) => {
  566. if (v !== props[key] || deep)
  567. _emit(event, v);
  568. }, {
  569. deep
  570. });
  571. return proxy;
  572. } else {
  573. return vue.computed({
  574. get() {
  575. return getValue();
  576. },
  577. set(value) {
  578. _emit(event, value);
  579. }
  580. });
  581. }
  582. }
  583. function useWindowFocus({ window = defaultWindow } = {}) {
  584. if (!window)
  585. return vue.ref(false);
  586. const focused = vue.ref(window.document.hasFocus());
  587. useEventListener(window, "blur", () => {
  588. focused.value = false;
  589. });
  590. useEventListener(window, "focus", () => {
  591. focused.value = true;
  592. });
  593. return focused;
  594. }
  595. function useWindowSize(options = {}) {
  596. const {
  597. window = defaultWindow,
  598. initialWidth = Infinity,
  599. initialHeight = Infinity,
  600. listenOrientation = true
  601. } = options;
  602. const width = vue.ref(initialWidth);
  603. const height = vue.ref(initialHeight);
  604. const update = () => {
  605. if (window) {
  606. width.value = window.innerWidth;
  607. height.value = window.innerHeight;
  608. }
  609. };
  610. update();
  611. tryOnMounted(update);
  612. useEventListener("resize", update, { passive: true });
  613. if (listenOrientation)
  614. useEventListener("orientationchange", update, { passive: true });
  615. return { width, height };
  616. }
  617. const isInContainer = (el, container) => {
  618. if (!isClient || !el || !container)
  619. return false;
  620. const elRect = el.getBoundingClientRect();
  621. let containerRect;
  622. if (container instanceof Element) {
  623. containerRect = container.getBoundingClientRect();
  624. } else {
  625. containerRect = {
  626. top: 0,
  627. right: window.innerWidth,
  628. bottom: window.innerHeight,
  629. left: 0
  630. };
  631. }
  632. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  633. };
  634. const getOffsetTop = (el) => {
  635. let offset = 0;
  636. let parent = el;
  637. while (parent) {
  638. offset += parent.offsetTop;
  639. parent = parent.offsetParent;
  640. }
  641. return offset;
  642. };
  643. const getOffsetTopDistance = (el, containerEl) => {
  644. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  645. };
  646. const getClientXY = (event) => {
  647. let clientX;
  648. let clientY;
  649. if (event.type === "touchend") {
  650. clientY = event.changedTouches[0].clientY;
  651. clientX = event.changedTouches[0].clientX;
  652. } else if (event.type.startsWith("touch")) {
  653. clientY = event.touches[0].clientY;
  654. clientX = event.touches[0].clientX;
  655. } else {
  656. clientY = event.clientY;
  657. clientX = event.clientX;
  658. }
  659. return {
  660. clientX,
  661. clientY
  662. };
  663. };
  664. const NOOP = () => {
  665. };
  666. const hasOwnProperty$p = Object.prototype.hasOwnProperty;
  667. const hasOwn = (val, key) => hasOwnProperty$p.call(val, key);
  668. const isArray$1 = Array.isArray;
  669. const isDate$1 = (val) => toTypeString(val) === "[object Date]";
  670. const isFunction$1 = (val) => typeof val === "function";
  671. const isString$1 = (val) => typeof val === "string";
  672. const isObject$1 = (val) => val !== null && typeof val === "object";
  673. const isPromise = (val) => {
  674. return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch);
  675. };
  676. const objectToString$1 = Object.prototype.toString;
  677. const toTypeString = (value) => objectToString$1.call(value);
  678. const toRawType = (value) => {
  679. return toTypeString(value).slice(8, -1);
  680. };
  681. const cacheStringFunction = (fn) => {
  682. const cache = /* @__PURE__ */ Object.create(null);
  683. return (str) => {
  684. const hit = cache[str];
  685. return hit || (cache[str] = fn(str));
  686. };
  687. };
  688. const camelizeRE = /-(\w)/g;
  689. const camelize = cacheStringFunction((str) => {
  690. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  691. });
  692. const hyphenateRE = /\B([A-Z])/g;
  693. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  694. const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  695. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  696. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  697. var root = freeGlobal || freeSelf || Function("return this")();
  698. var Symbol$1 = root.Symbol;
  699. var objectProto$s = Object.prototype;
  700. var hasOwnProperty$o = objectProto$s.hasOwnProperty;
  701. var nativeObjectToString$3 = objectProto$s.toString;
  702. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  703. function getRawTag(value) {
  704. var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  705. try {
  706. value[symToStringTag$1] = void 0;
  707. var unmasked = true;
  708. } catch (e) {
  709. }
  710. var result = nativeObjectToString$3.call(value);
  711. if (unmasked) {
  712. if (isOwn) {
  713. value[symToStringTag$1] = tag;
  714. } else {
  715. delete value[symToStringTag$1];
  716. }
  717. }
  718. return result;
  719. }
  720. var objectProto$r = Object.prototype;
  721. var nativeObjectToString$2 = objectProto$r.toString;
  722. function objectToString(value) {
  723. return nativeObjectToString$2.call(value);
  724. }
  725. var nullTag = "[object Null]";
  726. var undefinedTag = "[object Undefined]";
  727. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  728. function baseGetTag(value) {
  729. if (value == null) {
  730. return value === void 0 ? undefinedTag : nullTag;
  731. }
  732. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  733. }
  734. function isObjectLike(value) {
  735. return value != null && typeof value == "object";
  736. }
  737. var symbolTag$3 = "[object Symbol]";
  738. function isSymbol(value) {
  739. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  740. }
  741. var NAN$2 = 0 / 0;
  742. function baseToNumber(value) {
  743. if (typeof value == "number") {
  744. return value;
  745. }
  746. if (isSymbol(value)) {
  747. return NAN$2;
  748. }
  749. return +value;
  750. }
  751. function arrayMap(array, iteratee) {
  752. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  753. while (++index < length) {
  754. result[index] = iteratee(array[index], index, array);
  755. }
  756. return result;
  757. }
  758. var isArray = Array.isArray;
  759. var INFINITY$5 = 1 / 0;
  760. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  761. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  762. function baseToString(value) {
  763. if (typeof value == "string") {
  764. return value;
  765. }
  766. if (isArray(value)) {
  767. return arrayMap(value, baseToString) + "";
  768. }
  769. if (isSymbol(value)) {
  770. return symbolToString ? symbolToString.call(value) : "";
  771. }
  772. var result = value + "";
  773. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  774. }
  775. function createMathOperation(operator, defaultValue) {
  776. return function(value, other) {
  777. var result;
  778. if (value === void 0 && other === void 0) {
  779. return defaultValue;
  780. }
  781. if (value !== void 0) {
  782. result = value;
  783. }
  784. if (other !== void 0) {
  785. if (result === void 0) {
  786. return other;
  787. }
  788. if (typeof value == "string" || typeof other == "string") {
  789. value = baseToString(value);
  790. other = baseToString(other);
  791. } else {
  792. value = baseToNumber(value);
  793. other = baseToNumber(other);
  794. }
  795. result = operator(value, other);
  796. }
  797. return result;
  798. };
  799. }
  800. var add = createMathOperation(function(augend, addend) {
  801. return augend + addend;
  802. }, 0);
  803. var reWhitespace = /\s/;
  804. function trimmedEndIndex(string) {
  805. var index = string.length;
  806. while (index-- && reWhitespace.test(string.charAt(index))) {
  807. }
  808. return index;
  809. }
  810. var reTrimStart$2 = /^\s+/;
  811. function baseTrim(string) {
  812. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  813. }
  814. function isObject(value) {
  815. var type = typeof value;
  816. return value != null && (type == "object" || type == "function");
  817. }
  818. var NAN$1 = 0 / 0;
  819. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  820. var reIsBinary = /^0b[01]+$/i;
  821. var reIsOctal = /^0o[0-7]+$/i;
  822. var freeParseInt = parseInt;
  823. function toNumber(value) {
  824. if (typeof value == "number") {
  825. return value;
  826. }
  827. if (isSymbol(value)) {
  828. return NAN$1;
  829. }
  830. if (isObject(value)) {
  831. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  832. value = isObject(other) ? other + "" : other;
  833. }
  834. if (typeof value != "string") {
  835. return value === 0 ? value : +value;
  836. }
  837. value = baseTrim(value);
  838. var isBinary = reIsBinary.test(value);
  839. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  840. }
  841. var INFINITY$4 = 1 / 0;
  842. var MAX_INTEGER = 17976931348623157e292;
  843. function toFinite(value) {
  844. if (!value) {
  845. return value === 0 ? value : 0;
  846. }
  847. value = toNumber(value);
  848. if (value === INFINITY$4 || value === -INFINITY$4) {
  849. var sign = value < 0 ? -1 : 1;
  850. return sign * MAX_INTEGER;
  851. }
  852. return value === value ? value : 0;
  853. }
  854. function toInteger(value) {
  855. var result = toFinite(value), remainder = result % 1;
  856. return result === result ? remainder ? result - remainder : result : 0;
  857. }
  858. var FUNC_ERROR_TEXT$b = "Expected a function";
  859. function after(n, func) {
  860. if (typeof func != "function") {
  861. throw new TypeError(FUNC_ERROR_TEXT$b);
  862. }
  863. n = toInteger(n);
  864. return function() {
  865. if (--n < 1) {
  866. return func.apply(this, arguments);
  867. }
  868. };
  869. }
  870. function identity(value) {
  871. return value;
  872. }
  873. var asyncTag = "[object AsyncFunction]";
  874. var funcTag$2 = "[object Function]";
  875. var genTag$1 = "[object GeneratorFunction]";
  876. var proxyTag = "[object Proxy]";
  877. function isFunction(value) {
  878. if (!isObject(value)) {
  879. return false;
  880. }
  881. var tag = baseGetTag(value);
  882. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  883. }
  884. var coreJsData = root["__core-js_shared__"];
  885. var maskSrcKey = function() {
  886. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  887. return uid ? "Symbol(src)_1." + uid : "";
  888. }();
  889. function isMasked(func) {
  890. return !!maskSrcKey && maskSrcKey in func;
  891. }
  892. var funcProto$2 = Function.prototype;
  893. var funcToString$2 = funcProto$2.toString;
  894. function toSource(func) {
  895. if (func != null) {
  896. try {
  897. return funcToString$2.call(func);
  898. } catch (e) {
  899. }
  900. try {
  901. return func + "";
  902. } catch (e) {
  903. }
  904. }
  905. return "";
  906. }
  907. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  908. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  909. var funcProto$1 = Function.prototype;
  910. var objectProto$q = Object.prototype;
  911. var funcToString$1 = funcProto$1.toString;
  912. var hasOwnProperty$n = objectProto$q.hasOwnProperty;
  913. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  914. function baseIsNative(value) {
  915. if (!isObject(value) || isMasked(value)) {
  916. return false;
  917. }
  918. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  919. return pattern.test(toSource(value));
  920. }
  921. function getValue$1(object, key) {
  922. return object == null ? void 0 : object[key];
  923. }
  924. function getNative(object, key) {
  925. var value = getValue$1(object, key);
  926. return baseIsNative(value) ? value : void 0;
  927. }
  928. var WeakMap = getNative(root, "WeakMap");
  929. var metaMap = WeakMap && new WeakMap();
  930. var baseSetData = !metaMap ? identity : function(func, data) {
  931. metaMap.set(func, data);
  932. return func;
  933. };
  934. var objectCreate = Object.create;
  935. var baseCreate = function() {
  936. function object() {
  937. }
  938. return function(proto) {
  939. if (!isObject(proto)) {
  940. return {};
  941. }
  942. if (objectCreate) {
  943. return objectCreate(proto);
  944. }
  945. object.prototype = proto;
  946. var result = new object();
  947. object.prototype = void 0;
  948. return result;
  949. };
  950. }();
  951. function createCtor(Ctor) {
  952. return function() {
  953. var args = arguments;
  954. switch (args.length) {
  955. case 0:
  956. return new Ctor();
  957. case 1:
  958. return new Ctor(args[0]);
  959. case 2:
  960. return new Ctor(args[0], args[1]);
  961. case 3:
  962. return new Ctor(args[0], args[1], args[2]);
  963. case 4:
  964. return new Ctor(args[0], args[1], args[2], args[3]);
  965. case 5:
  966. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  967. case 6:
  968. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  969. case 7:
  970. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  971. }
  972. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  973. return isObject(result) ? result : thisBinding;
  974. };
  975. }
  976. var WRAP_BIND_FLAG$8 = 1;
  977. function createBind(func, bitmask, thisArg) {
  978. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  979. function wrapper() {
  980. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  981. return fn.apply(isBind ? thisArg : this, arguments);
  982. }
  983. return wrapper;
  984. }
  985. function apply(func, thisArg, args) {
  986. switch (args.length) {
  987. case 0:
  988. return func.call(thisArg);
  989. case 1:
  990. return func.call(thisArg, args[0]);
  991. case 2:
  992. return func.call(thisArg, args[0], args[1]);
  993. case 3:
  994. return func.call(thisArg, args[0], args[1], args[2]);
  995. }
  996. return func.apply(thisArg, args);
  997. }
  998. var nativeMax$g = Math.max;
  999. function composeArgs(args, partials, holders, isCurried) {
  1000. 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;
  1001. while (++leftIndex < leftLength) {
  1002. result[leftIndex] = partials[leftIndex];
  1003. }
  1004. while (++argsIndex < holdersLength) {
  1005. if (isUncurried || argsIndex < argsLength) {
  1006. result[holders[argsIndex]] = args[argsIndex];
  1007. }
  1008. }
  1009. while (rangeLength--) {
  1010. result[leftIndex++] = args[argsIndex++];
  1011. }
  1012. return result;
  1013. }
  1014. var nativeMax$f = Math.max;
  1015. function composeArgsRight(args, partials, holders, isCurried) {
  1016. 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;
  1017. while (++argsIndex < rangeLength) {
  1018. result[argsIndex] = args[argsIndex];
  1019. }
  1020. var offset = argsIndex;
  1021. while (++rightIndex < rightLength) {
  1022. result[offset + rightIndex] = partials[rightIndex];
  1023. }
  1024. while (++holdersIndex < holdersLength) {
  1025. if (isUncurried || argsIndex < argsLength) {
  1026. result[offset + holders[holdersIndex]] = args[argsIndex++];
  1027. }
  1028. }
  1029. return result;
  1030. }
  1031. function countHolders(array, placeholder) {
  1032. var length = array.length, result = 0;
  1033. while (length--) {
  1034. if (array[length] === placeholder) {
  1035. ++result;
  1036. }
  1037. }
  1038. return result;
  1039. }
  1040. function baseLodash() {
  1041. }
  1042. var MAX_ARRAY_LENGTH$6 = 4294967295;
  1043. function LazyWrapper(value) {
  1044. this.__wrapped__ = value;
  1045. this.__actions__ = [];
  1046. this.__dir__ = 1;
  1047. this.__filtered__ = false;
  1048. this.__iteratees__ = [];
  1049. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  1050. this.__views__ = [];
  1051. }
  1052. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  1053. LazyWrapper.prototype.constructor = LazyWrapper;
  1054. function noop() {
  1055. }
  1056. var getData = !metaMap ? noop : function(func) {
  1057. return metaMap.get(func);
  1058. };
  1059. var realNames = {};
  1060. var objectProto$p = Object.prototype;
  1061. var hasOwnProperty$m = objectProto$p.hasOwnProperty;
  1062. function getFuncName(func) {
  1063. var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0;
  1064. while (length--) {
  1065. var data = array[length], otherFunc = data.func;
  1066. if (otherFunc == null || otherFunc == func) {
  1067. return data.name;
  1068. }
  1069. }
  1070. return result;
  1071. }
  1072. function LodashWrapper(value, chainAll) {
  1073. this.__wrapped__ = value;
  1074. this.__actions__ = [];
  1075. this.__chain__ = !!chainAll;
  1076. this.__index__ = 0;
  1077. this.__values__ = void 0;
  1078. }
  1079. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  1080. LodashWrapper.prototype.constructor = LodashWrapper;
  1081. function copyArray(source, array) {
  1082. var index = -1, length = source.length;
  1083. array || (array = Array(length));
  1084. while (++index < length) {
  1085. array[index] = source[index];
  1086. }
  1087. return array;
  1088. }
  1089. function wrapperClone(wrapper) {
  1090. if (wrapper instanceof LazyWrapper) {
  1091. return wrapper.clone();
  1092. }
  1093. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  1094. result.__actions__ = copyArray(wrapper.__actions__);
  1095. result.__index__ = wrapper.__index__;
  1096. result.__values__ = wrapper.__values__;
  1097. return result;
  1098. }
  1099. var objectProto$o = Object.prototype;
  1100. var hasOwnProperty$l = objectProto$o.hasOwnProperty;
  1101. function lodash(value) {
  1102. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  1103. if (value instanceof LodashWrapper) {
  1104. return value;
  1105. }
  1106. if (hasOwnProperty$l.call(value, "__wrapped__")) {
  1107. return wrapperClone(value);
  1108. }
  1109. }
  1110. return new LodashWrapper(value);
  1111. }
  1112. lodash.prototype = baseLodash.prototype;
  1113. lodash.prototype.constructor = lodash;
  1114. function isLaziable(func) {
  1115. var funcName = getFuncName(func), other = lodash[funcName];
  1116. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  1117. return false;
  1118. }
  1119. if (func === other) {
  1120. return true;
  1121. }
  1122. var data = getData(other);
  1123. return !!data && func === data[0];
  1124. }
  1125. var HOT_COUNT = 800;
  1126. var HOT_SPAN = 16;
  1127. var nativeNow = Date.now;
  1128. function shortOut(func) {
  1129. var count = 0, lastCalled = 0;
  1130. return function() {
  1131. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1132. lastCalled = stamp;
  1133. if (remaining > 0) {
  1134. if (++count >= HOT_COUNT) {
  1135. return arguments[0];
  1136. }
  1137. } else {
  1138. count = 0;
  1139. }
  1140. return func.apply(void 0, arguments);
  1141. };
  1142. }
  1143. var setData = shortOut(baseSetData);
  1144. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  1145. var reSplitDetails = /,? & /;
  1146. function getWrapDetails(source) {
  1147. var match = source.match(reWrapDetails);
  1148. return match ? match[1].split(reSplitDetails) : [];
  1149. }
  1150. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  1151. function insertWrapDetails(source, details) {
  1152. var length = details.length;
  1153. if (!length) {
  1154. return source;
  1155. }
  1156. var lastIndex = length - 1;
  1157. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  1158. details = details.join(length > 2 ? ", " : " ");
  1159. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  1160. }
  1161. function constant(value) {
  1162. return function() {
  1163. return value;
  1164. };
  1165. }
  1166. var defineProperty = function() {
  1167. try {
  1168. var func = getNative(Object, "defineProperty");
  1169. func({}, "", {});
  1170. return func;
  1171. } catch (e) {
  1172. }
  1173. }();
  1174. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1175. return defineProperty(func, "toString", {
  1176. "configurable": true,
  1177. "enumerable": false,
  1178. "value": constant(string),
  1179. "writable": true
  1180. });
  1181. };
  1182. var setToString = shortOut(baseSetToString);
  1183. function arrayEach(array, iteratee) {
  1184. var index = -1, length = array == null ? 0 : array.length;
  1185. while (++index < length) {
  1186. if (iteratee(array[index], index, array) === false) {
  1187. break;
  1188. }
  1189. }
  1190. return array;
  1191. }
  1192. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1193. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1194. while (fromRight ? index-- : ++index < length) {
  1195. if (predicate(array[index], index, array)) {
  1196. return index;
  1197. }
  1198. }
  1199. return -1;
  1200. }
  1201. function baseIsNaN(value) {
  1202. return value !== value;
  1203. }
  1204. function strictIndexOf(array, value, fromIndex) {
  1205. var index = fromIndex - 1, length = array.length;
  1206. while (++index < length) {
  1207. if (array[index] === value) {
  1208. return index;
  1209. }
  1210. }
  1211. return -1;
  1212. }
  1213. function baseIndexOf(array, value, fromIndex) {
  1214. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1215. }
  1216. function arrayIncludes(array, value) {
  1217. var length = array == null ? 0 : array.length;
  1218. return !!length && baseIndexOf(array, value, 0) > -1;
  1219. }
  1220. var WRAP_BIND_FLAG$7 = 1;
  1221. var WRAP_BIND_KEY_FLAG$6 = 2;
  1222. var WRAP_CURRY_FLAG$6 = 8;
  1223. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  1224. var WRAP_PARTIAL_FLAG$6 = 32;
  1225. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  1226. var WRAP_ARY_FLAG$4 = 128;
  1227. var WRAP_REARG_FLAG$3 = 256;
  1228. var WRAP_FLIP_FLAG$2 = 512;
  1229. var wrapFlags = [
  1230. ["ary", WRAP_ARY_FLAG$4],
  1231. ["bind", WRAP_BIND_FLAG$7],
  1232. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  1233. ["curry", WRAP_CURRY_FLAG$6],
  1234. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  1235. ["flip", WRAP_FLIP_FLAG$2],
  1236. ["partial", WRAP_PARTIAL_FLAG$6],
  1237. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  1238. ["rearg", WRAP_REARG_FLAG$3]
  1239. ];
  1240. function updateWrapDetails(details, bitmask) {
  1241. arrayEach(wrapFlags, function(pair) {
  1242. var value = "_." + pair[0];
  1243. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  1244. details.push(value);
  1245. }
  1246. });
  1247. return details.sort();
  1248. }
  1249. function setWrapToString(wrapper, reference, bitmask) {
  1250. var source = reference + "";
  1251. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  1252. }
  1253. var WRAP_BIND_FLAG$6 = 1;
  1254. var WRAP_BIND_KEY_FLAG$5 = 2;
  1255. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  1256. var WRAP_CURRY_FLAG$5 = 8;
  1257. var WRAP_PARTIAL_FLAG$5 = 32;
  1258. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  1259. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  1260. 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;
  1261. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  1262. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  1263. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  1264. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  1265. }
  1266. var newData = [
  1267. func,
  1268. bitmask,
  1269. thisArg,
  1270. newPartials,
  1271. newHolders,
  1272. newPartialsRight,
  1273. newHoldersRight,
  1274. argPos,
  1275. ary,
  1276. arity
  1277. ];
  1278. var result = wrapFunc.apply(void 0, newData);
  1279. if (isLaziable(func)) {
  1280. setData(result, newData);
  1281. }
  1282. result.placeholder = placeholder;
  1283. return setWrapToString(result, func, bitmask);
  1284. }
  1285. function getHolder(func) {
  1286. var object = func;
  1287. return object.placeholder;
  1288. }
  1289. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  1290. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1291. function isIndex(value, length) {
  1292. var type = typeof value;
  1293. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  1294. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  1295. }
  1296. var nativeMin$e = Math.min;
  1297. function reorder(array, indexes) {
  1298. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  1299. while (length--) {
  1300. var index = indexes[length];
  1301. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  1302. }
  1303. return array;
  1304. }
  1305. var PLACEHOLDER$1 = "__lodash_placeholder__";
  1306. function replaceHolders(array, placeholder) {
  1307. var index = -1, length = array.length, resIndex = 0, result = [];
  1308. while (++index < length) {
  1309. var value = array[index];
  1310. if (value === placeholder || value === PLACEHOLDER$1) {
  1311. array[index] = PLACEHOLDER$1;
  1312. result[resIndex++] = index;
  1313. }
  1314. }
  1315. return result;
  1316. }
  1317. var WRAP_BIND_FLAG$5 = 1;
  1318. var WRAP_BIND_KEY_FLAG$4 = 2;
  1319. var WRAP_CURRY_FLAG$4 = 8;
  1320. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  1321. var WRAP_ARY_FLAG$3 = 128;
  1322. var WRAP_FLIP_FLAG$1 = 512;
  1323. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  1324. 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);
  1325. function wrapper() {
  1326. var length = arguments.length, args = Array(length), index = length;
  1327. while (index--) {
  1328. args[index] = arguments[index];
  1329. }
  1330. if (isCurried) {
  1331. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  1332. }
  1333. if (partials) {
  1334. args = composeArgs(args, partials, holders, isCurried);
  1335. }
  1336. if (partialsRight) {
  1337. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  1338. }
  1339. length -= holdersCount;
  1340. if (isCurried && length < arity) {
  1341. var newHolders = replaceHolders(args, placeholder);
  1342. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  1343. }
  1344. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  1345. length = args.length;
  1346. if (argPos) {
  1347. args = reorder(args, argPos);
  1348. } else if (isFlip && length > 1) {
  1349. args.reverse();
  1350. }
  1351. if (isAry && ary < length) {
  1352. args.length = ary;
  1353. }
  1354. if (this && this !== root && this instanceof wrapper) {
  1355. fn = Ctor || createCtor(fn);
  1356. }
  1357. return fn.apply(thisBinding, args);
  1358. }
  1359. return wrapper;
  1360. }
  1361. function createCurry(func, bitmask, arity) {
  1362. var Ctor = createCtor(func);
  1363. function wrapper() {
  1364. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  1365. while (index--) {
  1366. args[index] = arguments[index];
  1367. }
  1368. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  1369. length -= holders.length;
  1370. if (length < arity) {
  1371. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  1372. }
  1373. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1374. return apply(fn, this, args);
  1375. }
  1376. return wrapper;
  1377. }
  1378. var WRAP_BIND_FLAG$4 = 1;
  1379. function createPartial(func, bitmask, thisArg, partials) {
  1380. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  1381. function wrapper() {
  1382. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1383. while (++leftIndex < leftLength) {
  1384. args[leftIndex] = partials[leftIndex];
  1385. }
  1386. while (argsLength--) {
  1387. args[leftIndex++] = arguments[++argsIndex];
  1388. }
  1389. return apply(fn, isBind ? thisArg : this, args);
  1390. }
  1391. return wrapper;
  1392. }
  1393. var PLACEHOLDER = "__lodash_placeholder__";
  1394. var WRAP_BIND_FLAG$3 = 1;
  1395. var WRAP_BIND_KEY_FLAG$3 = 2;
  1396. var WRAP_CURRY_BOUND_FLAG = 4;
  1397. var WRAP_CURRY_FLAG$3 = 8;
  1398. var WRAP_ARY_FLAG$2 = 128;
  1399. var WRAP_REARG_FLAG$2 = 256;
  1400. var nativeMin$d = Math.min;
  1401. function mergeData(data, source) {
  1402. 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);
  1403. 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;
  1404. if (!(isCommon || isCombo)) {
  1405. return data;
  1406. }
  1407. if (srcBitmask & WRAP_BIND_FLAG$3) {
  1408. data[2] = source[2];
  1409. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  1410. }
  1411. var value = source[3];
  1412. if (value) {
  1413. var partials = data[3];
  1414. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  1415. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  1416. }
  1417. value = source[5];
  1418. if (value) {
  1419. partials = data[5];
  1420. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  1421. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  1422. }
  1423. value = source[7];
  1424. if (value) {
  1425. data[7] = value;
  1426. }
  1427. if (srcBitmask & WRAP_ARY_FLAG$2) {
  1428. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  1429. }
  1430. if (data[9] == null) {
  1431. data[9] = source[9];
  1432. }
  1433. data[0] = source[0];
  1434. data[1] = newBitmask;
  1435. return data;
  1436. }
  1437. var FUNC_ERROR_TEXT$a = "Expected a function";
  1438. var WRAP_BIND_FLAG$2 = 1;
  1439. var WRAP_BIND_KEY_FLAG$2 = 2;
  1440. var WRAP_CURRY_FLAG$2 = 8;
  1441. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  1442. var WRAP_PARTIAL_FLAG$4 = 32;
  1443. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  1444. var nativeMax$e = Math.max;
  1445. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  1446. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  1447. if (!isBindKey && typeof func != "function") {
  1448. throw new TypeError(FUNC_ERROR_TEXT$a);
  1449. }
  1450. var length = partials ? partials.length : 0;
  1451. if (!length) {
  1452. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  1453. partials = holders = void 0;
  1454. }
  1455. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  1456. arity = arity === void 0 ? arity : toInteger(arity);
  1457. length -= holders ? holders.length : 0;
  1458. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  1459. var partialsRight = partials, holdersRight = holders;
  1460. partials = holders = void 0;
  1461. }
  1462. var data = isBindKey ? void 0 : getData(func);
  1463. var newData = [
  1464. func,
  1465. bitmask,
  1466. thisArg,
  1467. partials,
  1468. holders,
  1469. partialsRight,
  1470. holdersRight,
  1471. argPos,
  1472. ary,
  1473. arity
  1474. ];
  1475. if (data) {
  1476. mergeData(newData, data);
  1477. }
  1478. func = newData[0];
  1479. bitmask = newData[1];
  1480. thisArg = newData[2];
  1481. partials = newData[3];
  1482. holders = newData[4];
  1483. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  1484. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  1485. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  1486. }
  1487. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  1488. var result = createBind(func, bitmask, thisArg);
  1489. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  1490. result = createCurry(func, bitmask, arity);
  1491. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  1492. result = createPartial(func, bitmask, thisArg, partials);
  1493. } else {
  1494. result = createHybrid.apply(void 0, newData);
  1495. }
  1496. var setter = data ? baseSetData : setData;
  1497. return setWrapToString(setter(result, newData), func, bitmask);
  1498. }
  1499. var WRAP_ARY_FLAG$1 = 128;
  1500. function ary(func, n, guard) {
  1501. n = guard ? void 0 : n;
  1502. n = func && n == null ? func.length : n;
  1503. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  1504. }
  1505. function baseAssignValue(object, key, value) {
  1506. if (key == "__proto__" && defineProperty) {
  1507. defineProperty(object, key, {
  1508. "configurable": true,
  1509. "enumerable": true,
  1510. "value": value,
  1511. "writable": true
  1512. });
  1513. } else {
  1514. object[key] = value;
  1515. }
  1516. }
  1517. function eq(value, other) {
  1518. return value === other || value !== value && other !== other;
  1519. }
  1520. var objectProto$n = Object.prototype;
  1521. var hasOwnProperty$k = objectProto$n.hasOwnProperty;
  1522. function assignValue(object, key, value) {
  1523. var objValue = object[key];
  1524. if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  1525. baseAssignValue(object, key, value);
  1526. }
  1527. }
  1528. function copyObject(source, props, object, customizer) {
  1529. var isNew = !object;
  1530. object || (object = {});
  1531. var index = -1, length = props.length;
  1532. while (++index < length) {
  1533. var key = props[index];
  1534. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1535. if (newValue === void 0) {
  1536. newValue = source[key];
  1537. }
  1538. if (isNew) {
  1539. baseAssignValue(object, key, newValue);
  1540. } else {
  1541. assignValue(object, key, newValue);
  1542. }
  1543. }
  1544. return object;
  1545. }
  1546. var nativeMax$d = Math.max;
  1547. function overRest(func, start, transform) {
  1548. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  1549. return function() {
  1550. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  1551. while (++index < length) {
  1552. array[index] = args[start + index];
  1553. }
  1554. index = -1;
  1555. var otherArgs = Array(start + 1);
  1556. while (++index < start) {
  1557. otherArgs[index] = args[index];
  1558. }
  1559. otherArgs[start] = transform(array);
  1560. return apply(func, this, otherArgs);
  1561. };
  1562. }
  1563. function baseRest(func, start) {
  1564. return setToString(overRest(func, start, identity), func + "");
  1565. }
  1566. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  1567. function isLength(value) {
  1568. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  1569. }
  1570. function isArrayLike(value) {
  1571. return value != null && isLength(value.length) && !isFunction(value);
  1572. }
  1573. function isIterateeCall(value, index, object) {
  1574. if (!isObject(object)) {
  1575. return false;
  1576. }
  1577. var type = typeof index;
  1578. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  1579. return eq(object[index], value);
  1580. }
  1581. return false;
  1582. }
  1583. function createAssigner(assigner) {
  1584. return baseRest(function(object, sources) {
  1585. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1586. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1587. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1588. customizer = length < 3 ? void 0 : customizer;
  1589. length = 1;
  1590. }
  1591. object = Object(object);
  1592. while (++index < length) {
  1593. var source = sources[index];
  1594. if (source) {
  1595. assigner(object, source, index, customizer);
  1596. }
  1597. }
  1598. return object;
  1599. });
  1600. }
  1601. var objectProto$m = Object.prototype;
  1602. function isPrototype(value) {
  1603. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  1604. return value === proto;
  1605. }
  1606. function baseTimes(n, iteratee) {
  1607. var index = -1, result = Array(n);
  1608. while (++index < n) {
  1609. result[index] = iteratee(index);
  1610. }
  1611. return result;
  1612. }
  1613. var argsTag$3 = "[object Arguments]";
  1614. function baseIsArguments(value) {
  1615. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  1616. }
  1617. var objectProto$l = Object.prototype;
  1618. var hasOwnProperty$j = objectProto$l.hasOwnProperty;
  1619. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  1620. var isArguments = baseIsArguments(function() {
  1621. return arguments;
  1622. }()) ? baseIsArguments : function(value) {
  1623. return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  1624. };
  1625. function stubFalse() {
  1626. return false;
  1627. }
  1628. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1629. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  1630. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  1631. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  1632. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  1633. var isBuffer = nativeIsBuffer || stubFalse;
  1634. var argsTag$2 = "[object Arguments]";
  1635. var arrayTag$2 = "[object Array]";
  1636. var boolTag$4 = "[object Boolean]";
  1637. var dateTag$4 = "[object Date]";
  1638. var errorTag$3 = "[object Error]";
  1639. var funcTag$1 = "[object Function]";
  1640. var mapTag$9 = "[object Map]";
  1641. var numberTag$4 = "[object Number]";
  1642. var objectTag$4 = "[object Object]";
  1643. var regexpTag$4 = "[object RegExp]";
  1644. var setTag$9 = "[object Set]";
  1645. var stringTag$4 = "[object String]";
  1646. var weakMapTag$3 = "[object WeakMap]";
  1647. var arrayBufferTag$4 = "[object ArrayBuffer]";
  1648. var dataViewTag$4 = "[object DataView]";
  1649. var float32Tag$2 = "[object Float32Array]";
  1650. var float64Tag$2 = "[object Float64Array]";
  1651. var int8Tag$2 = "[object Int8Array]";
  1652. var int16Tag$2 = "[object Int16Array]";
  1653. var int32Tag$2 = "[object Int32Array]";
  1654. var uint8Tag$2 = "[object Uint8Array]";
  1655. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  1656. var uint16Tag$2 = "[object Uint16Array]";
  1657. var uint32Tag$2 = "[object Uint32Array]";
  1658. var typedArrayTags = {};
  1659. 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;
  1660. 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;
  1661. function baseIsTypedArray(value) {
  1662. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  1663. }
  1664. function baseUnary(func) {
  1665. return function(value) {
  1666. return func(value);
  1667. };
  1668. }
  1669. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1670. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  1671. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  1672. var freeProcess = moduleExports$1 && freeGlobal.process;
  1673. var nodeUtil = function() {
  1674. try {
  1675. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  1676. if (types) {
  1677. return types;
  1678. }
  1679. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  1680. } catch (e) {
  1681. }
  1682. }();
  1683. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1684. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  1685. var objectProto$k = Object.prototype;
  1686. var hasOwnProperty$i = objectProto$k.hasOwnProperty;
  1687. function arrayLikeKeys(value, inherited) {
  1688. 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;
  1689. for (var key in value) {
  1690. 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)))) {
  1691. result.push(key);
  1692. }
  1693. }
  1694. return result;
  1695. }
  1696. function overArg(func, transform) {
  1697. return function(arg) {
  1698. return func(transform(arg));
  1699. };
  1700. }
  1701. var nativeKeys = overArg(Object.keys, Object);
  1702. var objectProto$j = Object.prototype;
  1703. var hasOwnProperty$h = objectProto$j.hasOwnProperty;
  1704. function baseKeys(object) {
  1705. if (!isPrototype(object)) {
  1706. return nativeKeys(object);
  1707. }
  1708. var result = [];
  1709. for (var key in Object(object)) {
  1710. if (hasOwnProperty$h.call(object, key) && key != "constructor") {
  1711. result.push(key);
  1712. }
  1713. }
  1714. return result;
  1715. }
  1716. function keys(object) {
  1717. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1718. }
  1719. var objectProto$i = Object.prototype;
  1720. var hasOwnProperty$g = objectProto$i.hasOwnProperty;
  1721. var assign = createAssigner(function(object, source) {
  1722. if (isPrototype(source) || isArrayLike(source)) {
  1723. copyObject(source, keys(source), object);
  1724. return;
  1725. }
  1726. for (var key in source) {
  1727. if (hasOwnProperty$g.call(source, key)) {
  1728. assignValue(object, key, source[key]);
  1729. }
  1730. }
  1731. });
  1732. function nativeKeysIn(object) {
  1733. var result = [];
  1734. if (object != null) {
  1735. for (var key in Object(object)) {
  1736. result.push(key);
  1737. }
  1738. }
  1739. return result;
  1740. }
  1741. var objectProto$h = Object.prototype;
  1742. var hasOwnProperty$f = objectProto$h.hasOwnProperty;
  1743. function baseKeysIn(object) {
  1744. if (!isObject(object)) {
  1745. return nativeKeysIn(object);
  1746. }
  1747. var isProto = isPrototype(object), result = [];
  1748. for (var key in object) {
  1749. if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
  1750. result.push(key);
  1751. }
  1752. }
  1753. return result;
  1754. }
  1755. function keysIn(object) {
  1756. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1757. }
  1758. var assignIn = createAssigner(function(object, source) {
  1759. copyObject(source, keysIn(source), object);
  1760. });
  1761. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  1762. copyObject(source, keysIn(source), object, customizer);
  1763. });
  1764. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  1765. copyObject(source, keys(source), object, customizer);
  1766. });
  1767. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  1768. var reIsPlainProp = /^\w*$/;
  1769. function isKey(value, object) {
  1770. if (isArray(value)) {
  1771. return false;
  1772. }
  1773. var type = typeof value;
  1774. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  1775. return true;
  1776. }
  1777. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1778. }
  1779. var nativeCreate = getNative(Object, "create");
  1780. function hashClear() {
  1781. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1782. this.size = 0;
  1783. }
  1784. function hashDelete(key) {
  1785. var result = this.has(key) && delete this.__data__[key];
  1786. this.size -= result ? 1 : 0;
  1787. return result;
  1788. }
  1789. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1790. var objectProto$g = Object.prototype;
  1791. var hasOwnProperty$e = objectProto$g.hasOwnProperty;
  1792. function hashGet(key) {
  1793. var data = this.__data__;
  1794. if (nativeCreate) {
  1795. var result = data[key];
  1796. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1797. }
  1798. return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
  1799. }
  1800. var objectProto$f = Object.prototype;
  1801. var hasOwnProperty$d = objectProto$f.hasOwnProperty;
  1802. function hashHas(key) {
  1803. var data = this.__data__;
  1804. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
  1805. }
  1806. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1807. function hashSet(key, value) {
  1808. var data = this.__data__;
  1809. this.size += this.has(key) ? 0 : 1;
  1810. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1811. return this;
  1812. }
  1813. function Hash(entries) {
  1814. var index = -1, length = entries == null ? 0 : entries.length;
  1815. this.clear();
  1816. while (++index < length) {
  1817. var entry = entries[index];
  1818. this.set(entry[0], entry[1]);
  1819. }
  1820. }
  1821. Hash.prototype.clear = hashClear;
  1822. Hash.prototype["delete"] = hashDelete;
  1823. Hash.prototype.get = hashGet;
  1824. Hash.prototype.has = hashHas;
  1825. Hash.prototype.set = hashSet;
  1826. function listCacheClear() {
  1827. this.__data__ = [];
  1828. this.size = 0;
  1829. }
  1830. function assocIndexOf(array, key) {
  1831. var length = array.length;
  1832. while (length--) {
  1833. if (eq(array[length][0], key)) {
  1834. return length;
  1835. }
  1836. }
  1837. return -1;
  1838. }
  1839. var arrayProto$5 = Array.prototype;
  1840. var splice$2 = arrayProto$5.splice;
  1841. function listCacheDelete(key) {
  1842. var data = this.__data__, index = assocIndexOf(data, key);
  1843. if (index < 0) {
  1844. return false;
  1845. }
  1846. var lastIndex = data.length - 1;
  1847. if (index == lastIndex) {
  1848. data.pop();
  1849. } else {
  1850. splice$2.call(data, index, 1);
  1851. }
  1852. --this.size;
  1853. return true;
  1854. }
  1855. function listCacheGet(key) {
  1856. var data = this.__data__, index = assocIndexOf(data, key);
  1857. return index < 0 ? void 0 : data[index][1];
  1858. }
  1859. function listCacheHas(key) {
  1860. return assocIndexOf(this.__data__, key) > -1;
  1861. }
  1862. function listCacheSet(key, value) {
  1863. var data = this.__data__, index = assocIndexOf(data, key);
  1864. if (index < 0) {
  1865. ++this.size;
  1866. data.push([key, value]);
  1867. } else {
  1868. data[index][1] = value;
  1869. }
  1870. return this;
  1871. }
  1872. function ListCache(entries) {
  1873. var index = -1, length = entries == null ? 0 : entries.length;
  1874. this.clear();
  1875. while (++index < length) {
  1876. var entry = entries[index];
  1877. this.set(entry[0], entry[1]);
  1878. }
  1879. }
  1880. ListCache.prototype.clear = listCacheClear;
  1881. ListCache.prototype["delete"] = listCacheDelete;
  1882. ListCache.prototype.get = listCacheGet;
  1883. ListCache.prototype.has = listCacheHas;
  1884. ListCache.prototype.set = listCacheSet;
  1885. var Map$1 = getNative(root, "Map");
  1886. function mapCacheClear() {
  1887. this.size = 0;
  1888. this.__data__ = {
  1889. "hash": new Hash(),
  1890. "map": new (Map$1 || ListCache)(),
  1891. "string": new Hash()
  1892. };
  1893. }
  1894. function isKeyable(value) {
  1895. var type = typeof value;
  1896. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1897. }
  1898. function getMapData(map, key) {
  1899. var data = map.__data__;
  1900. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1901. }
  1902. function mapCacheDelete(key) {
  1903. var result = getMapData(this, key)["delete"](key);
  1904. this.size -= result ? 1 : 0;
  1905. return result;
  1906. }
  1907. function mapCacheGet(key) {
  1908. return getMapData(this, key).get(key);
  1909. }
  1910. function mapCacheHas(key) {
  1911. return getMapData(this, key).has(key);
  1912. }
  1913. function mapCacheSet(key, value) {
  1914. var data = getMapData(this, key), size = data.size;
  1915. data.set(key, value);
  1916. this.size += data.size == size ? 0 : 1;
  1917. return this;
  1918. }
  1919. function MapCache(entries) {
  1920. var index = -1, length = entries == null ? 0 : entries.length;
  1921. this.clear();
  1922. while (++index < length) {
  1923. var entry = entries[index];
  1924. this.set(entry[0], entry[1]);
  1925. }
  1926. }
  1927. MapCache.prototype.clear = mapCacheClear;
  1928. MapCache.prototype["delete"] = mapCacheDelete;
  1929. MapCache.prototype.get = mapCacheGet;
  1930. MapCache.prototype.has = mapCacheHas;
  1931. MapCache.prototype.set = mapCacheSet;
  1932. var FUNC_ERROR_TEXT$9 = "Expected a function";
  1933. function memoize(func, resolver) {
  1934. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1935. throw new TypeError(FUNC_ERROR_TEXT$9);
  1936. }
  1937. var memoized = function() {
  1938. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1939. if (cache.has(key)) {
  1940. return cache.get(key);
  1941. }
  1942. var result = func.apply(this, args);
  1943. memoized.cache = cache.set(key, result) || cache;
  1944. return result;
  1945. };
  1946. memoized.cache = new (memoize.Cache || MapCache)();
  1947. return memoized;
  1948. }
  1949. memoize.Cache = MapCache;
  1950. var MAX_MEMOIZE_SIZE = 500;
  1951. function memoizeCapped(func) {
  1952. var result = memoize(func, function(key) {
  1953. if (cache.size === MAX_MEMOIZE_SIZE) {
  1954. cache.clear();
  1955. }
  1956. return key;
  1957. });
  1958. var cache = result.cache;
  1959. return result;
  1960. }
  1961. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1962. var reEscapeChar = /\\(\\)?/g;
  1963. var stringToPath = memoizeCapped(function(string) {
  1964. var result = [];
  1965. if (string.charCodeAt(0) === 46) {
  1966. result.push("");
  1967. }
  1968. string.replace(rePropName, function(match, number, quote, subString) {
  1969. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  1970. });
  1971. return result;
  1972. });
  1973. function toString(value) {
  1974. return value == null ? "" : baseToString(value);
  1975. }
  1976. function castPath(value, object) {
  1977. if (isArray(value)) {
  1978. return value;
  1979. }
  1980. return isKey(value, object) ? [value] : stringToPath(toString(value));
  1981. }
  1982. var INFINITY$3 = 1 / 0;
  1983. function toKey(value) {
  1984. if (typeof value == "string" || isSymbol(value)) {
  1985. return value;
  1986. }
  1987. var result = value + "";
  1988. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  1989. }
  1990. function baseGet(object, path) {
  1991. path = castPath(path, object);
  1992. var index = 0, length = path.length;
  1993. while (object != null && index < length) {
  1994. object = object[toKey(path[index++])];
  1995. }
  1996. return index && index == length ? object : void 0;
  1997. }
  1998. function get(object, path, defaultValue) {
  1999. var result = object == null ? void 0 : baseGet(object, path);
  2000. return result === void 0 ? defaultValue : result;
  2001. }
  2002. function baseAt(object, paths) {
  2003. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  2004. while (++index < length) {
  2005. result[index] = skip ? void 0 : get(object, paths[index]);
  2006. }
  2007. return result;
  2008. }
  2009. function arrayPush(array, values) {
  2010. var index = -1, length = values.length, offset = array.length;
  2011. while (++index < length) {
  2012. array[offset + index] = values[index];
  2013. }
  2014. return array;
  2015. }
  2016. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  2017. function isFlattenable(value) {
  2018. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  2019. }
  2020. function baseFlatten(array, depth, predicate, isStrict, result) {
  2021. var index = -1, length = array.length;
  2022. predicate || (predicate = isFlattenable);
  2023. result || (result = []);
  2024. while (++index < length) {
  2025. var value = array[index];
  2026. if (depth > 0 && predicate(value)) {
  2027. if (depth > 1) {
  2028. baseFlatten(value, depth - 1, predicate, isStrict, result);
  2029. } else {
  2030. arrayPush(result, value);
  2031. }
  2032. } else if (!isStrict) {
  2033. result[result.length] = value;
  2034. }
  2035. }
  2036. return result;
  2037. }
  2038. function flatten(array) {
  2039. var length = array == null ? 0 : array.length;
  2040. return length ? baseFlatten(array, 1) : [];
  2041. }
  2042. function flatRest(func) {
  2043. return setToString(overRest(func, void 0, flatten), func + "");
  2044. }
  2045. var at$1 = flatRest(baseAt);
  2046. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2047. var objectTag$3 = "[object Object]";
  2048. var funcProto = Function.prototype;
  2049. var objectProto$e = Object.prototype;
  2050. var funcToString = funcProto.toString;
  2051. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  2052. var objectCtorString = funcToString.call(Object);
  2053. function isPlainObject(value) {
  2054. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  2055. return false;
  2056. }
  2057. var proto = getPrototype(value);
  2058. if (proto === null) {
  2059. return true;
  2060. }
  2061. var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
  2062. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2063. }
  2064. var domExcTag = "[object DOMException]";
  2065. var errorTag$2 = "[object Error]";
  2066. function isError(value) {
  2067. if (!isObjectLike(value)) {
  2068. return false;
  2069. }
  2070. var tag = baseGetTag(value);
  2071. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  2072. }
  2073. var attempt = baseRest(function(func, args) {
  2074. try {
  2075. return apply(func, void 0, args);
  2076. } catch (e) {
  2077. return isError(e) ? e : new Error(e);
  2078. }
  2079. });
  2080. var FUNC_ERROR_TEXT$8 = "Expected a function";
  2081. function before(n, func) {
  2082. var result;
  2083. if (typeof func != "function") {
  2084. throw new TypeError(FUNC_ERROR_TEXT$8);
  2085. }
  2086. n = toInteger(n);
  2087. return function() {
  2088. if (--n > 0) {
  2089. result = func.apply(this, arguments);
  2090. }
  2091. if (n <= 1) {
  2092. func = void 0;
  2093. }
  2094. return result;
  2095. };
  2096. }
  2097. var WRAP_BIND_FLAG$1 = 1;
  2098. var WRAP_PARTIAL_FLAG$3 = 32;
  2099. var bind = baseRest(function(func, thisArg, partials) {
  2100. var bitmask = WRAP_BIND_FLAG$1;
  2101. if (partials.length) {
  2102. var holders = replaceHolders(partials, getHolder(bind));
  2103. bitmask |= WRAP_PARTIAL_FLAG$3;
  2104. }
  2105. return createWrap(func, bitmask, thisArg, partials, holders);
  2106. });
  2107. bind.placeholder = {};
  2108. var bindAll = flatRest(function(object, methodNames) {
  2109. arrayEach(methodNames, function(key) {
  2110. key = toKey(key);
  2111. baseAssignValue(object, key, bind(object[key], object));
  2112. });
  2113. return object;
  2114. });
  2115. var WRAP_BIND_FLAG = 1;
  2116. var WRAP_BIND_KEY_FLAG$1 = 2;
  2117. var WRAP_PARTIAL_FLAG$2 = 32;
  2118. var bindKey = baseRest(function(object, key, partials) {
  2119. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  2120. if (partials.length) {
  2121. var holders = replaceHolders(partials, getHolder(bindKey));
  2122. bitmask |= WRAP_PARTIAL_FLAG$2;
  2123. }
  2124. return createWrap(key, bitmask, object, partials, holders);
  2125. });
  2126. bindKey.placeholder = {};
  2127. function baseSlice(array, start, end) {
  2128. var index = -1, length = array.length;
  2129. if (start < 0) {
  2130. start = -start > length ? 0 : length + start;
  2131. }
  2132. end = end > length ? length : end;
  2133. if (end < 0) {
  2134. end += length;
  2135. }
  2136. length = start > end ? 0 : end - start >>> 0;
  2137. start >>>= 0;
  2138. var result = Array(length);
  2139. while (++index < length) {
  2140. result[index] = array[index + start];
  2141. }
  2142. return result;
  2143. }
  2144. function castSlice(array, start, end) {
  2145. var length = array.length;
  2146. end = end === void 0 ? length : end;
  2147. return !start && end >= length ? array : baseSlice(array, start, end);
  2148. }
  2149. var rsAstralRange$3 = "\\ud800-\\udfff";
  2150. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  2151. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  2152. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  2153. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  2154. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  2155. var rsZWJ$3 = "\\u200d";
  2156. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  2157. function hasUnicode(string) {
  2158. return reHasUnicode.test(string);
  2159. }
  2160. function asciiToArray(string) {
  2161. return string.split("");
  2162. }
  2163. var rsAstralRange$2 = "\\ud800-\\udfff";
  2164. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  2165. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  2166. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  2167. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  2168. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  2169. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  2170. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  2171. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  2172. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  2173. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  2174. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2175. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2176. var rsZWJ$2 = "\\u200d";
  2177. var reOptMod$2 = rsModifier$2 + "?";
  2178. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  2179. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  2180. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  2181. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  2182. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  2183. function unicodeToArray(string) {
  2184. return string.match(reUnicode$1) || [];
  2185. }
  2186. function stringToArray(string) {
  2187. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  2188. }
  2189. function createCaseFirst(methodName) {
  2190. return function(string) {
  2191. string = toString(string);
  2192. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  2193. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  2194. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  2195. return chr[methodName]() + trailing;
  2196. };
  2197. }
  2198. var upperFirst = createCaseFirst("toUpperCase");
  2199. function capitalize$1(string) {
  2200. return upperFirst(toString(string).toLowerCase());
  2201. }
  2202. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2203. var index = -1, length = array == null ? 0 : array.length;
  2204. if (initAccum && length) {
  2205. accumulator = array[++index];
  2206. }
  2207. while (++index < length) {
  2208. accumulator = iteratee(accumulator, array[index], index, array);
  2209. }
  2210. return accumulator;
  2211. }
  2212. function basePropertyOf(object) {
  2213. return function(key) {
  2214. return object == null ? void 0 : object[key];
  2215. };
  2216. }
  2217. var deburredLetters = {
  2218. "\xC0": "A",
  2219. "\xC1": "A",
  2220. "\xC2": "A",
  2221. "\xC3": "A",
  2222. "\xC4": "A",
  2223. "\xC5": "A",
  2224. "\xE0": "a",
  2225. "\xE1": "a",
  2226. "\xE2": "a",
  2227. "\xE3": "a",
  2228. "\xE4": "a",
  2229. "\xE5": "a",
  2230. "\xC7": "C",
  2231. "\xE7": "c",
  2232. "\xD0": "D",
  2233. "\xF0": "d",
  2234. "\xC8": "E",
  2235. "\xC9": "E",
  2236. "\xCA": "E",
  2237. "\xCB": "E",
  2238. "\xE8": "e",
  2239. "\xE9": "e",
  2240. "\xEA": "e",
  2241. "\xEB": "e",
  2242. "\xCC": "I",
  2243. "\xCD": "I",
  2244. "\xCE": "I",
  2245. "\xCF": "I",
  2246. "\xEC": "i",
  2247. "\xED": "i",
  2248. "\xEE": "i",
  2249. "\xEF": "i",
  2250. "\xD1": "N",
  2251. "\xF1": "n",
  2252. "\xD2": "O",
  2253. "\xD3": "O",
  2254. "\xD4": "O",
  2255. "\xD5": "O",
  2256. "\xD6": "O",
  2257. "\xD8": "O",
  2258. "\xF2": "o",
  2259. "\xF3": "o",
  2260. "\xF4": "o",
  2261. "\xF5": "o",
  2262. "\xF6": "o",
  2263. "\xF8": "o",
  2264. "\xD9": "U",
  2265. "\xDA": "U",
  2266. "\xDB": "U",
  2267. "\xDC": "U",
  2268. "\xF9": "u",
  2269. "\xFA": "u",
  2270. "\xFB": "u",
  2271. "\xFC": "u",
  2272. "\xDD": "Y",
  2273. "\xFD": "y",
  2274. "\xFF": "y",
  2275. "\xC6": "Ae",
  2276. "\xE6": "ae",
  2277. "\xDE": "Th",
  2278. "\xFE": "th",
  2279. "\xDF": "ss",
  2280. "\u0100": "A",
  2281. "\u0102": "A",
  2282. "\u0104": "A",
  2283. "\u0101": "a",
  2284. "\u0103": "a",
  2285. "\u0105": "a",
  2286. "\u0106": "C",
  2287. "\u0108": "C",
  2288. "\u010A": "C",
  2289. "\u010C": "C",
  2290. "\u0107": "c",
  2291. "\u0109": "c",
  2292. "\u010B": "c",
  2293. "\u010D": "c",
  2294. "\u010E": "D",
  2295. "\u0110": "D",
  2296. "\u010F": "d",
  2297. "\u0111": "d",
  2298. "\u0112": "E",
  2299. "\u0114": "E",
  2300. "\u0116": "E",
  2301. "\u0118": "E",
  2302. "\u011A": "E",
  2303. "\u0113": "e",
  2304. "\u0115": "e",
  2305. "\u0117": "e",
  2306. "\u0119": "e",
  2307. "\u011B": "e",
  2308. "\u011C": "G",
  2309. "\u011E": "G",
  2310. "\u0120": "G",
  2311. "\u0122": "G",
  2312. "\u011D": "g",
  2313. "\u011F": "g",
  2314. "\u0121": "g",
  2315. "\u0123": "g",
  2316. "\u0124": "H",
  2317. "\u0126": "H",
  2318. "\u0125": "h",
  2319. "\u0127": "h",
  2320. "\u0128": "I",
  2321. "\u012A": "I",
  2322. "\u012C": "I",
  2323. "\u012E": "I",
  2324. "\u0130": "I",
  2325. "\u0129": "i",
  2326. "\u012B": "i",
  2327. "\u012D": "i",
  2328. "\u012F": "i",
  2329. "\u0131": "i",
  2330. "\u0134": "J",
  2331. "\u0135": "j",
  2332. "\u0136": "K",
  2333. "\u0137": "k",
  2334. "\u0138": "k",
  2335. "\u0139": "L",
  2336. "\u013B": "L",
  2337. "\u013D": "L",
  2338. "\u013F": "L",
  2339. "\u0141": "L",
  2340. "\u013A": "l",
  2341. "\u013C": "l",
  2342. "\u013E": "l",
  2343. "\u0140": "l",
  2344. "\u0142": "l",
  2345. "\u0143": "N",
  2346. "\u0145": "N",
  2347. "\u0147": "N",
  2348. "\u014A": "N",
  2349. "\u0144": "n",
  2350. "\u0146": "n",
  2351. "\u0148": "n",
  2352. "\u014B": "n",
  2353. "\u014C": "O",
  2354. "\u014E": "O",
  2355. "\u0150": "O",
  2356. "\u014D": "o",
  2357. "\u014F": "o",
  2358. "\u0151": "o",
  2359. "\u0154": "R",
  2360. "\u0156": "R",
  2361. "\u0158": "R",
  2362. "\u0155": "r",
  2363. "\u0157": "r",
  2364. "\u0159": "r",
  2365. "\u015A": "S",
  2366. "\u015C": "S",
  2367. "\u015E": "S",
  2368. "\u0160": "S",
  2369. "\u015B": "s",
  2370. "\u015D": "s",
  2371. "\u015F": "s",
  2372. "\u0161": "s",
  2373. "\u0162": "T",
  2374. "\u0164": "T",
  2375. "\u0166": "T",
  2376. "\u0163": "t",
  2377. "\u0165": "t",
  2378. "\u0167": "t",
  2379. "\u0168": "U",
  2380. "\u016A": "U",
  2381. "\u016C": "U",
  2382. "\u016E": "U",
  2383. "\u0170": "U",
  2384. "\u0172": "U",
  2385. "\u0169": "u",
  2386. "\u016B": "u",
  2387. "\u016D": "u",
  2388. "\u016F": "u",
  2389. "\u0171": "u",
  2390. "\u0173": "u",
  2391. "\u0174": "W",
  2392. "\u0175": "w",
  2393. "\u0176": "Y",
  2394. "\u0177": "y",
  2395. "\u0178": "Y",
  2396. "\u0179": "Z",
  2397. "\u017B": "Z",
  2398. "\u017D": "Z",
  2399. "\u017A": "z",
  2400. "\u017C": "z",
  2401. "\u017E": "z",
  2402. "\u0132": "IJ",
  2403. "\u0133": "ij",
  2404. "\u0152": "Oe",
  2405. "\u0153": "oe",
  2406. "\u0149": "'n",
  2407. "\u017F": "s"
  2408. };
  2409. var deburrLetter = basePropertyOf(deburredLetters);
  2410. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  2411. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  2412. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  2413. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  2414. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  2415. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  2416. var reComboMark = RegExp(rsCombo$2, "g");
  2417. function deburr(string) {
  2418. string = toString(string);
  2419. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  2420. }
  2421. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  2422. function asciiWords(string) {
  2423. return string.match(reAsciiWord) || [];
  2424. }
  2425. 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 ]/;
  2426. function hasUnicodeWord(string) {
  2427. return reHasUnicodeWord.test(string);
  2428. }
  2429. var rsAstralRange$1 = "\\ud800-\\udfff";
  2430. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  2431. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  2432. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  2433. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  2434. var rsDingbatRange = "\\u2700-\\u27bf";
  2435. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  2436. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  2437. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  2438. var rsPunctuationRange = "\\u2000-\\u206f";
  2439. 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";
  2440. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  2441. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  2442. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  2443. var rsApos$1 = "['\u2019]";
  2444. var rsBreak = "[" + rsBreakRange + "]";
  2445. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  2446. var rsDigits = "\\d+";
  2447. var rsDingbat = "[" + rsDingbatRange + "]";
  2448. var rsLower = "[" + rsLowerRange + "]";
  2449. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  2450. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  2451. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  2452. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  2453. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2454. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2455. var rsUpper = "[" + rsUpperRange + "]";
  2456. var rsZWJ$1 = "\\u200d";
  2457. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  2458. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  2459. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  2460. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  2461. var reOptMod$1 = rsModifier$1 + "?";
  2462. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  2463. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  2464. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  2465. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  2466. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  2467. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  2468. var reUnicodeWord = RegExp([
  2469. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  2470. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  2471. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  2472. rsUpper + "+" + rsOptContrUpper,
  2473. rsOrdUpper,
  2474. rsOrdLower,
  2475. rsDigits,
  2476. rsEmoji
  2477. ].join("|"), "g");
  2478. function unicodeWords(string) {
  2479. return string.match(reUnicodeWord) || [];
  2480. }
  2481. function words(string, pattern, guard) {
  2482. string = toString(string);
  2483. pattern = guard ? void 0 : pattern;
  2484. if (pattern === void 0) {
  2485. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  2486. }
  2487. return string.match(pattern) || [];
  2488. }
  2489. var rsApos = "['\u2019]";
  2490. var reApos = RegExp(rsApos, "g");
  2491. function createCompounder(callback) {
  2492. return function(string) {
  2493. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  2494. };
  2495. }
  2496. var camelCase = createCompounder(function(result, word, index) {
  2497. word = word.toLowerCase();
  2498. return result + (index ? capitalize$1(word) : word);
  2499. });
  2500. function castArray$1() {
  2501. if (!arguments.length) {
  2502. return [];
  2503. }
  2504. var value = arguments[0];
  2505. return isArray(value) ? value : [value];
  2506. }
  2507. var nativeIsFinite$1 = root.isFinite;
  2508. var nativeMin$c = Math.min;
  2509. function createRound(methodName) {
  2510. var func = Math[methodName];
  2511. return function(number, precision) {
  2512. number = toNumber(number);
  2513. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  2514. if (precision && nativeIsFinite$1(number)) {
  2515. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  2516. pair = (toString(value) + "e").split("e");
  2517. return +(pair[0] + "e" + (+pair[1] - precision));
  2518. }
  2519. return func(number);
  2520. };
  2521. }
  2522. var ceil = createRound("ceil");
  2523. function chain(value) {
  2524. var result = lodash(value);
  2525. result.__chain__ = true;
  2526. return result;
  2527. }
  2528. var nativeCeil$3 = Math.ceil;
  2529. var nativeMax$c = Math.max;
  2530. function chunk(array, size, guard) {
  2531. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  2532. size = 1;
  2533. } else {
  2534. size = nativeMax$c(toInteger(size), 0);
  2535. }
  2536. var length = array == null ? 0 : array.length;
  2537. if (!length || size < 1) {
  2538. return [];
  2539. }
  2540. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  2541. while (index < length) {
  2542. result[resIndex++] = baseSlice(array, index, index += size);
  2543. }
  2544. return result;
  2545. }
  2546. function baseClamp(number, lower, upper) {
  2547. if (number === number) {
  2548. if (upper !== void 0) {
  2549. number = number <= upper ? number : upper;
  2550. }
  2551. if (lower !== void 0) {
  2552. number = number >= lower ? number : lower;
  2553. }
  2554. }
  2555. return number;
  2556. }
  2557. function clamp(number, lower, upper) {
  2558. if (upper === void 0) {
  2559. upper = lower;
  2560. lower = void 0;
  2561. }
  2562. if (upper !== void 0) {
  2563. upper = toNumber(upper);
  2564. upper = upper === upper ? upper : 0;
  2565. }
  2566. if (lower !== void 0) {
  2567. lower = toNumber(lower);
  2568. lower = lower === lower ? lower : 0;
  2569. }
  2570. return baseClamp(toNumber(number), lower, upper);
  2571. }
  2572. function stackClear() {
  2573. this.__data__ = new ListCache();
  2574. this.size = 0;
  2575. }
  2576. function stackDelete(key) {
  2577. var data = this.__data__, result = data["delete"](key);
  2578. this.size = data.size;
  2579. return result;
  2580. }
  2581. function stackGet(key) {
  2582. return this.__data__.get(key);
  2583. }
  2584. function stackHas(key) {
  2585. return this.__data__.has(key);
  2586. }
  2587. var LARGE_ARRAY_SIZE$2 = 200;
  2588. function stackSet(key, value) {
  2589. var data = this.__data__;
  2590. if (data instanceof ListCache) {
  2591. var pairs = data.__data__;
  2592. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  2593. pairs.push([key, value]);
  2594. this.size = ++data.size;
  2595. return this;
  2596. }
  2597. data = this.__data__ = new MapCache(pairs);
  2598. }
  2599. data.set(key, value);
  2600. this.size = data.size;
  2601. return this;
  2602. }
  2603. function Stack(entries) {
  2604. var data = this.__data__ = new ListCache(entries);
  2605. this.size = data.size;
  2606. }
  2607. Stack.prototype.clear = stackClear;
  2608. Stack.prototype["delete"] = stackDelete;
  2609. Stack.prototype.get = stackGet;
  2610. Stack.prototype.has = stackHas;
  2611. Stack.prototype.set = stackSet;
  2612. function baseAssign(object, source) {
  2613. return object && copyObject(source, keys(source), object);
  2614. }
  2615. function baseAssignIn(object, source) {
  2616. return object && copyObject(source, keysIn(source), object);
  2617. }
  2618. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  2619. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  2620. var moduleExports = freeModule && freeModule.exports === freeExports;
  2621. var Buffer = moduleExports ? root.Buffer : void 0;
  2622. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  2623. function cloneBuffer(buffer, isDeep) {
  2624. if (isDeep) {
  2625. return buffer.slice();
  2626. }
  2627. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  2628. buffer.copy(result);
  2629. return result;
  2630. }
  2631. function arrayFilter(array, predicate) {
  2632. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2633. while (++index < length) {
  2634. var value = array[index];
  2635. if (predicate(value, index, array)) {
  2636. result[resIndex++] = value;
  2637. }
  2638. }
  2639. return result;
  2640. }
  2641. function stubArray() {
  2642. return [];
  2643. }
  2644. var objectProto$d = Object.prototype;
  2645. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  2646. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  2647. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  2648. if (object == null) {
  2649. return [];
  2650. }
  2651. object = Object(object);
  2652. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  2653. return propertyIsEnumerable.call(object, symbol);
  2654. });
  2655. };
  2656. function copySymbols(source, object) {
  2657. return copyObject(source, getSymbols(source), object);
  2658. }
  2659. var nativeGetSymbols = Object.getOwnPropertySymbols;
  2660. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  2661. var result = [];
  2662. while (object) {
  2663. arrayPush(result, getSymbols(object));
  2664. object = getPrototype(object);
  2665. }
  2666. return result;
  2667. };
  2668. function copySymbolsIn(source, object) {
  2669. return copyObject(source, getSymbolsIn(source), object);
  2670. }
  2671. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2672. var result = keysFunc(object);
  2673. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2674. }
  2675. function getAllKeys(object) {
  2676. return baseGetAllKeys(object, keys, getSymbols);
  2677. }
  2678. function getAllKeysIn(object) {
  2679. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  2680. }
  2681. var DataView = getNative(root, "DataView");
  2682. var Promise$1 = getNative(root, "Promise");
  2683. var Set$1 = getNative(root, "Set");
  2684. var mapTag$8 = "[object Map]";
  2685. var objectTag$2 = "[object Object]";
  2686. var promiseTag = "[object Promise]";
  2687. var setTag$8 = "[object Set]";
  2688. var weakMapTag$2 = "[object WeakMap]";
  2689. var dataViewTag$3 = "[object DataView]";
  2690. var dataViewCtorString = toSource(DataView);
  2691. var mapCtorString = toSource(Map$1);
  2692. var promiseCtorString = toSource(Promise$1);
  2693. var setCtorString = toSource(Set$1);
  2694. var weakMapCtorString = toSource(WeakMap);
  2695. var getTag = baseGetTag;
  2696. if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$8 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$8 || WeakMap && getTag(new WeakMap()) != weakMapTag$2) {
  2697. getTag = function(value) {
  2698. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2699. if (ctorString) {
  2700. switch (ctorString) {
  2701. case dataViewCtorString:
  2702. return dataViewTag$3;
  2703. case mapCtorString:
  2704. return mapTag$8;
  2705. case promiseCtorString:
  2706. return promiseTag;
  2707. case setCtorString:
  2708. return setTag$8;
  2709. case weakMapCtorString:
  2710. return weakMapTag$2;
  2711. }
  2712. }
  2713. return result;
  2714. };
  2715. }
  2716. var getTag$1 = getTag;
  2717. var objectProto$c = Object.prototype;
  2718. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  2719. function initCloneArray(array) {
  2720. var length = array.length, result = new array.constructor(length);
  2721. if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) {
  2722. result.index = array.index;
  2723. result.input = array.input;
  2724. }
  2725. return result;
  2726. }
  2727. var Uint8Array = root.Uint8Array;
  2728. function cloneArrayBuffer(arrayBuffer) {
  2729. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2730. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2731. return result;
  2732. }
  2733. function cloneDataView(dataView, isDeep) {
  2734. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2735. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2736. }
  2737. var reFlags$1 = /\w*$/;
  2738. function cloneRegExp(regexp) {
  2739. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  2740. result.lastIndex = regexp.lastIndex;
  2741. return result;
  2742. }
  2743. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  2744. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2745. function cloneSymbol(symbol) {
  2746. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2747. }
  2748. function cloneTypedArray(typedArray, isDeep) {
  2749. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2750. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2751. }
  2752. var boolTag$3 = "[object Boolean]";
  2753. var dateTag$3 = "[object Date]";
  2754. var mapTag$7 = "[object Map]";
  2755. var numberTag$3 = "[object Number]";
  2756. var regexpTag$3 = "[object RegExp]";
  2757. var setTag$7 = "[object Set]";
  2758. var stringTag$3 = "[object String]";
  2759. var symbolTag$2 = "[object Symbol]";
  2760. var arrayBufferTag$3 = "[object ArrayBuffer]";
  2761. var dataViewTag$2 = "[object DataView]";
  2762. var float32Tag$1 = "[object Float32Array]";
  2763. var float64Tag$1 = "[object Float64Array]";
  2764. var int8Tag$1 = "[object Int8Array]";
  2765. var int16Tag$1 = "[object Int16Array]";
  2766. var int32Tag$1 = "[object Int32Array]";
  2767. var uint8Tag$1 = "[object Uint8Array]";
  2768. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  2769. var uint16Tag$1 = "[object Uint16Array]";
  2770. var uint32Tag$1 = "[object Uint32Array]";
  2771. function initCloneByTag(object, tag, isDeep) {
  2772. var Ctor = object.constructor;
  2773. switch (tag) {
  2774. case arrayBufferTag$3:
  2775. return cloneArrayBuffer(object);
  2776. case boolTag$3:
  2777. case dateTag$3:
  2778. return new Ctor(+object);
  2779. case dataViewTag$2:
  2780. return cloneDataView(object, isDeep);
  2781. case float32Tag$1:
  2782. case float64Tag$1:
  2783. case int8Tag$1:
  2784. case int16Tag$1:
  2785. case int32Tag$1:
  2786. case uint8Tag$1:
  2787. case uint8ClampedTag$1:
  2788. case uint16Tag$1:
  2789. case uint32Tag$1:
  2790. return cloneTypedArray(object, isDeep);
  2791. case mapTag$7:
  2792. return new Ctor();
  2793. case numberTag$3:
  2794. case stringTag$3:
  2795. return new Ctor(object);
  2796. case regexpTag$3:
  2797. return cloneRegExp(object);
  2798. case setTag$7:
  2799. return new Ctor();
  2800. case symbolTag$2:
  2801. return cloneSymbol(object);
  2802. }
  2803. }
  2804. function initCloneObject(object) {
  2805. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2806. }
  2807. var mapTag$6 = "[object Map]";
  2808. function baseIsMap(value) {
  2809. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  2810. }
  2811. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2812. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2813. var setTag$6 = "[object Set]";
  2814. function baseIsSet(value) {
  2815. return isObjectLike(value) && getTag$1(value) == setTag$6;
  2816. }
  2817. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2818. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2819. var CLONE_DEEP_FLAG$7 = 1;
  2820. var CLONE_FLAT_FLAG$1 = 2;
  2821. var CLONE_SYMBOLS_FLAG$5 = 4;
  2822. var argsTag$1 = "[object Arguments]";
  2823. var arrayTag$1 = "[object Array]";
  2824. var boolTag$2 = "[object Boolean]";
  2825. var dateTag$2 = "[object Date]";
  2826. var errorTag$1 = "[object Error]";
  2827. var funcTag = "[object Function]";
  2828. var genTag = "[object GeneratorFunction]";
  2829. var mapTag$5 = "[object Map]";
  2830. var numberTag$2 = "[object Number]";
  2831. var objectTag$1 = "[object Object]";
  2832. var regexpTag$2 = "[object RegExp]";
  2833. var setTag$5 = "[object Set]";
  2834. var stringTag$2 = "[object String]";
  2835. var symbolTag$1 = "[object Symbol]";
  2836. var weakMapTag$1 = "[object WeakMap]";
  2837. var arrayBufferTag$2 = "[object ArrayBuffer]";
  2838. var dataViewTag$1 = "[object DataView]";
  2839. var float32Tag = "[object Float32Array]";
  2840. var float64Tag = "[object Float64Array]";
  2841. var int8Tag = "[object Int8Array]";
  2842. var int16Tag = "[object Int16Array]";
  2843. var int32Tag = "[object Int32Array]";
  2844. var uint8Tag = "[object Uint8Array]";
  2845. var uint8ClampedTag = "[object Uint8ClampedArray]";
  2846. var uint16Tag = "[object Uint16Array]";
  2847. var uint32Tag = "[object Uint32Array]";
  2848. var cloneableTags = {};
  2849. 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;
  2850. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  2851. function baseClone(value, bitmask, customizer, key, object, stack) {
  2852. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  2853. if (customizer) {
  2854. result = object ? customizer(value, key, object, stack) : customizer(value);
  2855. }
  2856. if (result !== void 0) {
  2857. return result;
  2858. }
  2859. if (!isObject(value)) {
  2860. return value;
  2861. }
  2862. var isArr = isArray(value);
  2863. if (isArr) {
  2864. result = initCloneArray(value);
  2865. if (!isDeep) {
  2866. return copyArray(value, result);
  2867. }
  2868. } else {
  2869. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  2870. if (isBuffer(value)) {
  2871. return cloneBuffer(value, isDeep);
  2872. }
  2873. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2874. result = isFlat || isFunc ? {} : initCloneObject(value);
  2875. if (!isDeep) {
  2876. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2877. }
  2878. } else {
  2879. if (!cloneableTags[tag]) {
  2880. return object ? value : {};
  2881. }
  2882. result = initCloneByTag(value, tag, isDeep);
  2883. }
  2884. }
  2885. stack || (stack = new Stack());
  2886. var stacked = stack.get(value);
  2887. if (stacked) {
  2888. return stacked;
  2889. }
  2890. stack.set(value, result);
  2891. if (isSet(value)) {
  2892. value.forEach(function(subValue) {
  2893. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2894. });
  2895. } else if (isMap(value)) {
  2896. value.forEach(function(subValue, key2) {
  2897. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2898. });
  2899. }
  2900. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  2901. var props = isArr ? void 0 : keysFunc(value);
  2902. arrayEach(props || value, function(subValue, key2) {
  2903. if (props) {
  2904. key2 = subValue;
  2905. subValue = value[key2];
  2906. }
  2907. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2908. });
  2909. return result;
  2910. }
  2911. var CLONE_SYMBOLS_FLAG$4 = 4;
  2912. function clone(value) {
  2913. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  2914. }
  2915. var CLONE_DEEP_FLAG$6 = 1;
  2916. var CLONE_SYMBOLS_FLAG$3 = 4;
  2917. function cloneDeep(value) {
  2918. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  2919. }
  2920. var CLONE_DEEP_FLAG$5 = 1;
  2921. var CLONE_SYMBOLS_FLAG$2 = 4;
  2922. function cloneDeepWith(value, customizer) {
  2923. customizer = typeof customizer == "function" ? customizer : void 0;
  2924. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  2925. }
  2926. var CLONE_SYMBOLS_FLAG$1 = 4;
  2927. function cloneWith(value, customizer) {
  2928. customizer = typeof customizer == "function" ? customizer : void 0;
  2929. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  2930. }
  2931. function wrapperCommit() {
  2932. return new LodashWrapper(this.value(), this.__chain__);
  2933. }
  2934. function compact(array) {
  2935. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2936. while (++index < length) {
  2937. var value = array[index];
  2938. if (value) {
  2939. result[resIndex++] = value;
  2940. }
  2941. }
  2942. return result;
  2943. }
  2944. function concat() {
  2945. var length = arguments.length;
  2946. if (!length) {
  2947. return [];
  2948. }
  2949. var args = Array(length - 1), array = arguments[0], index = length;
  2950. while (index--) {
  2951. args[index - 1] = arguments[index];
  2952. }
  2953. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  2954. }
  2955. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  2956. function setCacheAdd(value) {
  2957. this.__data__.set(value, HASH_UNDEFINED);
  2958. return this;
  2959. }
  2960. function setCacheHas(value) {
  2961. return this.__data__.has(value);
  2962. }
  2963. function SetCache(values) {
  2964. var index = -1, length = values == null ? 0 : values.length;
  2965. this.__data__ = new MapCache();
  2966. while (++index < length) {
  2967. this.add(values[index]);
  2968. }
  2969. }
  2970. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2971. SetCache.prototype.has = setCacheHas;
  2972. function arraySome(array, predicate) {
  2973. var index = -1, length = array == null ? 0 : array.length;
  2974. while (++index < length) {
  2975. if (predicate(array[index], index, array)) {
  2976. return true;
  2977. }
  2978. }
  2979. return false;
  2980. }
  2981. function cacheHas(cache, key) {
  2982. return cache.has(key);
  2983. }
  2984. var COMPARE_PARTIAL_FLAG$5 = 1;
  2985. var COMPARE_UNORDERED_FLAG$3 = 2;
  2986. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  2987. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  2988. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  2989. return false;
  2990. }
  2991. var arrStacked = stack.get(array);
  2992. var othStacked = stack.get(other);
  2993. if (arrStacked && othStacked) {
  2994. return arrStacked == other && othStacked == array;
  2995. }
  2996. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  2997. stack.set(array, other);
  2998. stack.set(other, array);
  2999. while (++index < arrLength) {
  3000. var arrValue = array[index], othValue = other[index];
  3001. if (customizer) {
  3002. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  3003. }
  3004. if (compared !== void 0) {
  3005. if (compared) {
  3006. continue;
  3007. }
  3008. result = false;
  3009. break;
  3010. }
  3011. if (seen) {
  3012. if (!arraySome(other, function(othValue2, othIndex) {
  3013. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  3014. return seen.push(othIndex);
  3015. }
  3016. })) {
  3017. result = false;
  3018. break;
  3019. }
  3020. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  3021. result = false;
  3022. break;
  3023. }
  3024. }
  3025. stack["delete"](array);
  3026. stack["delete"](other);
  3027. return result;
  3028. }
  3029. function mapToArray(map) {
  3030. var index = -1, result = Array(map.size);
  3031. map.forEach(function(value, key) {
  3032. result[++index] = [key, value];
  3033. });
  3034. return result;
  3035. }
  3036. function setToArray(set) {
  3037. var index = -1, result = Array(set.size);
  3038. set.forEach(function(value) {
  3039. result[++index] = value;
  3040. });
  3041. return result;
  3042. }
  3043. var COMPARE_PARTIAL_FLAG$4 = 1;
  3044. var COMPARE_UNORDERED_FLAG$2 = 2;
  3045. var boolTag$1 = "[object Boolean]";
  3046. var dateTag$1 = "[object Date]";
  3047. var errorTag = "[object Error]";
  3048. var mapTag$4 = "[object Map]";
  3049. var numberTag$1 = "[object Number]";
  3050. var regexpTag$1 = "[object RegExp]";
  3051. var setTag$4 = "[object Set]";
  3052. var stringTag$1 = "[object String]";
  3053. var symbolTag = "[object Symbol]";
  3054. var arrayBufferTag$1 = "[object ArrayBuffer]";
  3055. var dataViewTag = "[object DataView]";
  3056. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  3057. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  3058. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  3059. switch (tag) {
  3060. case dataViewTag:
  3061. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  3062. return false;
  3063. }
  3064. object = object.buffer;
  3065. other = other.buffer;
  3066. case arrayBufferTag$1:
  3067. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  3068. return false;
  3069. }
  3070. return true;
  3071. case boolTag$1:
  3072. case dateTag$1:
  3073. case numberTag$1:
  3074. return eq(+object, +other);
  3075. case errorTag:
  3076. return object.name == other.name && object.message == other.message;
  3077. case regexpTag$1:
  3078. case stringTag$1:
  3079. return object == other + "";
  3080. case mapTag$4:
  3081. var convert = mapToArray;
  3082. case setTag$4:
  3083. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  3084. convert || (convert = setToArray);
  3085. if (object.size != other.size && !isPartial) {
  3086. return false;
  3087. }
  3088. var stacked = stack.get(object);
  3089. if (stacked) {
  3090. return stacked == other;
  3091. }
  3092. bitmask |= COMPARE_UNORDERED_FLAG$2;
  3093. stack.set(object, other);
  3094. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  3095. stack["delete"](object);
  3096. return result;
  3097. case symbolTag:
  3098. if (symbolValueOf) {
  3099. return symbolValueOf.call(object) == symbolValueOf.call(other);
  3100. }
  3101. }
  3102. return false;
  3103. }
  3104. var COMPARE_PARTIAL_FLAG$3 = 1;
  3105. var objectProto$b = Object.prototype;
  3106. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  3107. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  3108. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  3109. if (objLength != othLength && !isPartial) {
  3110. return false;
  3111. }
  3112. var index = objLength;
  3113. while (index--) {
  3114. var key = objProps[index];
  3115. if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
  3116. return false;
  3117. }
  3118. }
  3119. var objStacked = stack.get(object);
  3120. var othStacked = stack.get(other);
  3121. if (objStacked && othStacked) {
  3122. return objStacked == other && othStacked == object;
  3123. }
  3124. var result = true;
  3125. stack.set(object, other);
  3126. stack.set(other, object);
  3127. var skipCtor = isPartial;
  3128. while (++index < objLength) {
  3129. key = objProps[index];
  3130. var objValue = object[key], othValue = other[key];
  3131. if (customizer) {
  3132. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  3133. }
  3134. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  3135. result = false;
  3136. break;
  3137. }
  3138. skipCtor || (skipCtor = key == "constructor");
  3139. }
  3140. if (result && !skipCtor) {
  3141. var objCtor = object.constructor, othCtor = other.constructor;
  3142. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  3143. result = false;
  3144. }
  3145. }
  3146. stack["delete"](object);
  3147. stack["delete"](other);
  3148. return result;
  3149. }
  3150. var COMPARE_PARTIAL_FLAG$2 = 1;
  3151. var argsTag = "[object Arguments]";
  3152. var arrayTag = "[object Array]";
  3153. var objectTag = "[object Object]";
  3154. var objectProto$a = Object.prototype;
  3155. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  3156. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3157. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  3158. objTag = objTag == argsTag ? objectTag : objTag;
  3159. othTag = othTag == argsTag ? objectTag : othTag;
  3160. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  3161. if (isSameTag && isBuffer(object)) {
  3162. if (!isBuffer(other)) {
  3163. return false;
  3164. }
  3165. objIsArr = true;
  3166. objIsObj = false;
  3167. }
  3168. if (isSameTag && !objIsObj) {
  3169. stack || (stack = new Stack());
  3170. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3171. }
  3172. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  3173. var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__");
  3174. if (objIsWrapped || othIsWrapped) {
  3175. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  3176. stack || (stack = new Stack());
  3177. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3178. }
  3179. }
  3180. if (!isSameTag) {
  3181. return false;
  3182. }
  3183. stack || (stack = new Stack());
  3184. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3185. }
  3186. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3187. if (value === other) {
  3188. return true;
  3189. }
  3190. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  3191. return value !== value && other !== other;
  3192. }
  3193. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3194. }
  3195. var COMPARE_PARTIAL_FLAG$1 = 1;
  3196. var COMPARE_UNORDERED_FLAG$1 = 2;
  3197. function baseIsMatch(object, source, matchData, customizer) {
  3198. var index = matchData.length, length = index, noCustomizer = !customizer;
  3199. if (object == null) {
  3200. return !length;
  3201. }
  3202. object = Object(object);
  3203. while (index--) {
  3204. var data = matchData[index];
  3205. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  3206. return false;
  3207. }
  3208. }
  3209. while (++index < length) {
  3210. data = matchData[index];
  3211. var key = data[0], objValue = object[key], srcValue = data[1];
  3212. if (noCustomizer && data[2]) {
  3213. if (objValue === void 0 && !(key in object)) {
  3214. return false;
  3215. }
  3216. } else {
  3217. var stack = new Stack();
  3218. if (customizer) {
  3219. var result = customizer(objValue, srcValue, key, object, source, stack);
  3220. }
  3221. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  3222. return false;
  3223. }
  3224. }
  3225. }
  3226. return true;
  3227. }
  3228. function isStrictComparable(value) {
  3229. return value === value && !isObject(value);
  3230. }
  3231. function getMatchData(object) {
  3232. var result = keys(object), length = result.length;
  3233. while (length--) {
  3234. var key = result[length], value = object[key];
  3235. result[length] = [key, value, isStrictComparable(value)];
  3236. }
  3237. return result;
  3238. }
  3239. function matchesStrictComparable(key, srcValue) {
  3240. return function(object) {
  3241. if (object == null) {
  3242. return false;
  3243. }
  3244. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  3245. };
  3246. }
  3247. function baseMatches(source) {
  3248. var matchData = getMatchData(source);
  3249. if (matchData.length == 1 && matchData[0][2]) {
  3250. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3251. }
  3252. return function(object) {
  3253. return object === source || baseIsMatch(object, source, matchData);
  3254. };
  3255. }
  3256. function baseHasIn(object, key) {
  3257. return object != null && key in Object(object);
  3258. }
  3259. function hasPath(object, path, hasFunc) {
  3260. path = castPath(path, object);
  3261. var index = -1, length = path.length, result = false;
  3262. while (++index < length) {
  3263. var key = toKey(path[index]);
  3264. if (!(result = object != null && hasFunc(object, key))) {
  3265. break;
  3266. }
  3267. object = object[key];
  3268. }
  3269. if (result || ++index != length) {
  3270. return result;
  3271. }
  3272. length = object == null ? 0 : object.length;
  3273. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  3274. }
  3275. function hasIn(object, path) {
  3276. return object != null && hasPath(object, path, baseHasIn);
  3277. }
  3278. var COMPARE_PARTIAL_FLAG = 1;
  3279. var COMPARE_UNORDERED_FLAG = 2;
  3280. function baseMatchesProperty(path, srcValue) {
  3281. if (isKey(path) && isStrictComparable(srcValue)) {
  3282. return matchesStrictComparable(toKey(path), srcValue);
  3283. }
  3284. return function(object) {
  3285. var objValue = get(object, path);
  3286. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3287. };
  3288. }
  3289. function baseProperty(key) {
  3290. return function(object) {
  3291. return object == null ? void 0 : object[key];
  3292. };
  3293. }
  3294. function basePropertyDeep(path) {
  3295. return function(object) {
  3296. return baseGet(object, path);
  3297. };
  3298. }
  3299. function property(path) {
  3300. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3301. }
  3302. function baseIteratee(value) {
  3303. if (typeof value == "function") {
  3304. return value;
  3305. }
  3306. if (value == null) {
  3307. return identity;
  3308. }
  3309. if (typeof value == "object") {
  3310. return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  3311. }
  3312. return property(value);
  3313. }
  3314. var FUNC_ERROR_TEXT$7 = "Expected a function";
  3315. function cond(pairs) {
  3316. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  3317. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  3318. if (typeof pair[1] != "function") {
  3319. throw new TypeError(FUNC_ERROR_TEXT$7);
  3320. }
  3321. return [toIteratee(pair[0]), pair[1]];
  3322. });
  3323. return baseRest(function(args) {
  3324. var index = -1;
  3325. while (++index < length) {
  3326. var pair = pairs[index];
  3327. if (apply(pair[0], this, args)) {
  3328. return apply(pair[1], this, args);
  3329. }
  3330. }
  3331. });
  3332. }
  3333. function baseConformsTo(object, source, props) {
  3334. var length = props.length;
  3335. if (object == null) {
  3336. return !length;
  3337. }
  3338. object = Object(object);
  3339. while (length--) {
  3340. var key = props[length], predicate = source[key], value = object[key];
  3341. if (value === void 0 && !(key in object) || !predicate(value)) {
  3342. return false;
  3343. }
  3344. }
  3345. return true;
  3346. }
  3347. function baseConforms(source) {
  3348. var props = keys(source);
  3349. return function(object) {
  3350. return baseConformsTo(object, source, props);
  3351. };
  3352. }
  3353. var CLONE_DEEP_FLAG$4 = 1;
  3354. function conforms(source) {
  3355. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  3356. }
  3357. function conformsTo(object, source) {
  3358. return source == null || baseConformsTo(object, source, keys(source));
  3359. }
  3360. function arrayAggregator(array, setter, iteratee, accumulator) {
  3361. var index = -1, length = array == null ? 0 : array.length;
  3362. while (++index < length) {
  3363. var value = array[index];
  3364. setter(accumulator, value, iteratee(value), array);
  3365. }
  3366. return accumulator;
  3367. }
  3368. function createBaseFor(fromRight) {
  3369. return function(object, iteratee, keysFunc) {
  3370. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  3371. while (length--) {
  3372. var key = props[fromRight ? length : ++index];
  3373. if (iteratee(iterable[key], key, iterable) === false) {
  3374. break;
  3375. }
  3376. }
  3377. return object;
  3378. };
  3379. }
  3380. var baseFor = createBaseFor();
  3381. function baseForOwn(object, iteratee) {
  3382. return object && baseFor(object, iteratee, keys);
  3383. }
  3384. function createBaseEach(eachFunc, fromRight) {
  3385. return function(collection, iteratee) {
  3386. if (collection == null) {
  3387. return collection;
  3388. }
  3389. if (!isArrayLike(collection)) {
  3390. return eachFunc(collection, iteratee);
  3391. }
  3392. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  3393. while (fromRight ? index-- : ++index < length) {
  3394. if (iteratee(iterable[index], index, iterable) === false) {
  3395. break;
  3396. }
  3397. }
  3398. return collection;
  3399. };
  3400. }
  3401. var baseEach = createBaseEach(baseForOwn);
  3402. function baseAggregator(collection, setter, iteratee, accumulator) {
  3403. baseEach(collection, function(value, key, collection2) {
  3404. setter(accumulator, value, iteratee(value), collection2);
  3405. });
  3406. return accumulator;
  3407. }
  3408. function createAggregator(setter, initializer) {
  3409. return function(collection, iteratee) {
  3410. var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  3411. return func(collection, setter, baseIteratee(iteratee), accumulator);
  3412. };
  3413. }
  3414. var objectProto$9 = Object.prototype;
  3415. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  3416. var countBy = createAggregator(function(result, value, key) {
  3417. if (hasOwnProperty$8.call(result, key)) {
  3418. ++result[key];
  3419. } else {
  3420. baseAssignValue(result, key, 1);
  3421. }
  3422. });
  3423. function create(prototype, properties) {
  3424. var result = baseCreate(prototype);
  3425. return properties == null ? result : baseAssign(result, properties);
  3426. }
  3427. var WRAP_CURRY_FLAG$1 = 8;
  3428. function curry(func, arity, guard) {
  3429. arity = guard ? void 0 : arity;
  3430. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  3431. result.placeholder = curry.placeholder;
  3432. return result;
  3433. }
  3434. curry.placeholder = {};
  3435. var WRAP_CURRY_RIGHT_FLAG = 16;
  3436. function curryRight(func, arity, guard) {
  3437. arity = guard ? void 0 : arity;
  3438. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  3439. result.placeholder = curryRight.placeholder;
  3440. return result;
  3441. }
  3442. curryRight.placeholder = {};
  3443. var now = function() {
  3444. return root.Date.now();
  3445. };
  3446. var FUNC_ERROR_TEXT$6 = "Expected a function";
  3447. var nativeMax$b = Math.max;
  3448. var nativeMin$b = Math.min;
  3449. function debounce(func, wait, options) {
  3450. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  3451. if (typeof func != "function") {
  3452. throw new TypeError(FUNC_ERROR_TEXT$6);
  3453. }
  3454. wait = toNumber(wait) || 0;
  3455. if (isObject(options)) {
  3456. leading = !!options.leading;
  3457. maxing = "maxWait" in options;
  3458. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  3459. trailing = "trailing" in options ? !!options.trailing : trailing;
  3460. }
  3461. function invokeFunc(time) {
  3462. var args = lastArgs, thisArg = lastThis;
  3463. lastArgs = lastThis = void 0;
  3464. lastInvokeTime = time;
  3465. result = func.apply(thisArg, args);
  3466. return result;
  3467. }
  3468. function leadingEdge(time) {
  3469. lastInvokeTime = time;
  3470. timerId = setTimeout(timerExpired, wait);
  3471. return leading ? invokeFunc(time) : result;
  3472. }
  3473. function remainingWait(time) {
  3474. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  3475. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  3476. }
  3477. function shouldInvoke(time) {
  3478. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  3479. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  3480. }
  3481. function timerExpired() {
  3482. var time = now();
  3483. if (shouldInvoke(time)) {
  3484. return trailingEdge(time);
  3485. }
  3486. timerId = setTimeout(timerExpired, remainingWait(time));
  3487. }
  3488. function trailingEdge(time) {
  3489. timerId = void 0;
  3490. if (trailing && lastArgs) {
  3491. return invokeFunc(time);
  3492. }
  3493. lastArgs = lastThis = void 0;
  3494. return result;
  3495. }
  3496. function cancel() {
  3497. if (timerId !== void 0) {
  3498. clearTimeout(timerId);
  3499. }
  3500. lastInvokeTime = 0;
  3501. lastArgs = lastCallTime = lastThis = timerId = void 0;
  3502. }
  3503. function flush() {
  3504. return timerId === void 0 ? result : trailingEdge(now());
  3505. }
  3506. function debounced() {
  3507. var time = now(), isInvoking = shouldInvoke(time);
  3508. lastArgs = arguments;
  3509. lastThis = this;
  3510. lastCallTime = time;
  3511. if (isInvoking) {
  3512. if (timerId === void 0) {
  3513. return leadingEdge(lastCallTime);
  3514. }
  3515. if (maxing) {
  3516. clearTimeout(timerId);
  3517. timerId = setTimeout(timerExpired, wait);
  3518. return invokeFunc(lastCallTime);
  3519. }
  3520. }
  3521. if (timerId === void 0) {
  3522. timerId = setTimeout(timerExpired, wait);
  3523. }
  3524. return result;
  3525. }
  3526. debounced.cancel = cancel;
  3527. debounced.flush = flush;
  3528. return debounced;
  3529. }
  3530. function defaultTo(value, defaultValue) {
  3531. return value == null || value !== value ? defaultValue : value;
  3532. }
  3533. var objectProto$8 = Object.prototype;
  3534. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  3535. var defaults = baseRest(function(object, sources) {
  3536. object = Object(object);
  3537. var index = -1;
  3538. var length = sources.length;
  3539. var guard = length > 2 ? sources[2] : void 0;
  3540. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  3541. length = 1;
  3542. }
  3543. while (++index < length) {
  3544. var source = sources[index];
  3545. var props = keysIn(source);
  3546. var propsIndex = -1;
  3547. var propsLength = props.length;
  3548. while (++propsIndex < propsLength) {
  3549. var key = props[propsIndex];
  3550. var value = object[key];
  3551. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) {
  3552. object[key] = source[key];
  3553. }
  3554. }
  3555. }
  3556. return object;
  3557. });
  3558. function assignMergeValue(object, key, value) {
  3559. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  3560. baseAssignValue(object, key, value);
  3561. }
  3562. }
  3563. function isArrayLikeObject(value) {
  3564. return isObjectLike(value) && isArrayLike(value);
  3565. }
  3566. function safeGet(object, key) {
  3567. if (key === "constructor" && typeof object[key] === "function") {
  3568. return;
  3569. }
  3570. if (key == "__proto__") {
  3571. return;
  3572. }
  3573. return object[key];
  3574. }
  3575. function toPlainObject(value) {
  3576. return copyObject(value, keysIn(value));
  3577. }
  3578. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  3579. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  3580. if (stacked) {
  3581. assignMergeValue(object, key, stacked);
  3582. return;
  3583. }
  3584. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  3585. var isCommon = newValue === void 0;
  3586. if (isCommon) {
  3587. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  3588. newValue = srcValue;
  3589. if (isArr || isBuff || isTyped) {
  3590. if (isArray(objValue)) {
  3591. newValue = objValue;
  3592. } else if (isArrayLikeObject(objValue)) {
  3593. newValue = copyArray(objValue);
  3594. } else if (isBuff) {
  3595. isCommon = false;
  3596. newValue = cloneBuffer(srcValue, true);
  3597. } else if (isTyped) {
  3598. isCommon = false;
  3599. newValue = cloneTypedArray(srcValue, true);
  3600. } else {
  3601. newValue = [];
  3602. }
  3603. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  3604. newValue = objValue;
  3605. if (isArguments(objValue)) {
  3606. newValue = toPlainObject(objValue);
  3607. } else if (!isObject(objValue) || isFunction(objValue)) {
  3608. newValue = initCloneObject(srcValue);
  3609. }
  3610. } else {
  3611. isCommon = false;
  3612. }
  3613. }
  3614. if (isCommon) {
  3615. stack.set(srcValue, newValue);
  3616. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  3617. stack["delete"](srcValue);
  3618. }
  3619. assignMergeValue(object, key, newValue);
  3620. }
  3621. function baseMerge(object, source, srcIndex, customizer, stack) {
  3622. if (object === source) {
  3623. return;
  3624. }
  3625. baseFor(source, function(srcValue, key) {
  3626. stack || (stack = new Stack());
  3627. if (isObject(srcValue)) {
  3628. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  3629. } else {
  3630. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  3631. if (newValue === void 0) {
  3632. newValue = srcValue;
  3633. }
  3634. assignMergeValue(object, key, newValue);
  3635. }
  3636. }, keysIn);
  3637. }
  3638. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  3639. if (isObject(objValue) && isObject(srcValue)) {
  3640. stack.set(srcValue, objValue);
  3641. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  3642. stack["delete"](srcValue);
  3643. }
  3644. return objValue;
  3645. }
  3646. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  3647. baseMerge(object, source, srcIndex, customizer);
  3648. });
  3649. var defaultsDeep = baseRest(function(args) {
  3650. args.push(void 0, customDefaultsMerge);
  3651. return apply(mergeWith, void 0, args);
  3652. });
  3653. var FUNC_ERROR_TEXT$5 = "Expected a function";
  3654. function baseDelay(func, wait, args) {
  3655. if (typeof func != "function") {
  3656. throw new TypeError(FUNC_ERROR_TEXT$5);
  3657. }
  3658. return setTimeout(function() {
  3659. func.apply(void 0, args);
  3660. }, wait);
  3661. }
  3662. var defer = baseRest(function(func, args) {
  3663. return baseDelay(func, 1, args);
  3664. });
  3665. var delay = baseRest(function(func, wait, args) {
  3666. return baseDelay(func, toNumber(wait) || 0, args);
  3667. });
  3668. function arrayIncludesWith(array, value, comparator) {
  3669. var index = -1, length = array == null ? 0 : array.length;
  3670. while (++index < length) {
  3671. if (comparator(value, array[index])) {
  3672. return true;
  3673. }
  3674. }
  3675. return false;
  3676. }
  3677. var LARGE_ARRAY_SIZE$1 = 200;
  3678. function baseDifference(array, values, iteratee, comparator) {
  3679. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  3680. if (!length) {
  3681. return result;
  3682. }
  3683. if (iteratee) {
  3684. values = arrayMap(values, baseUnary(iteratee));
  3685. }
  3686. if (comparator) {
  3687. includes = arrayIncludesWith;
  3688. isCommon = false;
  3689. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  3690. includes = cacheHas;
  3691. isCommon = false;
  3692. values = new SetCache(values);
  3693. }
  3694. outer:
  3695. while (++index < length) {
  3696. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  3697. value = comparator || value !== 0 ? value : 0;
  3698. if (isCommon && computed === computed) {
  3699. var valuesIndex = valuesLength;
  3700. while (valuesIndex--) {
  3701. if (values[valuesIndex] === computed) {
  3702. continue outer;
  3703. }
  3704. }
  3705. result.push(value);
  3706. } else if (!includes(values, computed, comparator)) {
  3707. result.push(value);
  3708. }
  3709. }
  3710. return result;
  3711. }
  3712. var difference = baseRest(function(array, values) {
  3713. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  3714. });
  3715. function last(array) {
  3716. var length = array == null ? 0 : array.length;
  3717. return length ? array[length - 1] : void 0;
  3718. }
  3719. var differenceBy = baseRest(function(array, values) {
  3720. var iteratee = last(values);
  3721. if (isArrayLikeObject(iteratee)) {
  3722. iteratee = void 0;
  3723. }
  3724. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  3725. });
  3726. var differenceWith = baseRest(function(array, values) {
  3727. var comparator = last(values);
  3728. if (isArrayLikeObject(comparator)) {
  3729. comparator = void 0;
  3730. }
  3731. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  3732. });
  3733. var divide = createMathOperation(function(dividend, divisor) {
  3734. return dividend / divisor;
  3735. }, 1);
  3736. function drop(array, n, guard) {
  3737. var length = array == null ? 0 : array.length;
  3738. if (!length) {
  3739. return [];
  3740. }
  3741. n = guard || n === void 0 ? 1 : toInteger(n);
  3742. return baseSlice(array, n < 0 ? 0 : n, length);
  3743. }
  3744. function dropRight(array, n, guard) {
  3745. var length = array == null ? 0 : array.length;
  3746. if (!length) {
  3747. return [];
  3748. }
  3749. n = guard || n === void 0 ? 1 : toInteger(n);
  3750. n = length - n;
  3751. return baseSlice(array, 0, n < 0 ? 0 : n);
  3752. }
  3753. function baseWhile(array, predicate, isDrop, fromRight) {
  3754. var length = array.length, index = fromRight ? length : -1;
  3755. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  3756. }
  3757. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  3758. }
  3759. function dropRightWhile(array, predicate) {
  3760. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  3761. }
  3762. function dropWhile(array, predicate) {
  3763. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  3764. }
  3765. function castFunction(value) {
  3766. return typeof value == "function" ? value : identity;
  3767. }
  3768. function forEach(collection, iteratee) {
  3769. var func = isArray(collection) ? arrayEach : baseEach;
  3770. return func(collection, castFunction(iteratee));
  3771. }
  3772. function arrayEachRight(array, iteratee) {
  3773. var length = array == null ? 0 : array.length;
  3774. while (length--) {
  3775. if (iteratee(array[length], length, array) === false) {
  3776. break;
  3777. }
  3778. }
  3779. return array;
  3780. }
  3781. var baseForRight = createBaseFor(true);
  3782. function baseForOwnRight(object, iteratee) {
  3783. return object && baseForRight(object, iteratee, keys);
  3784. }
  3785. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3786. function forEachRight(collection, iteratee) {
  3787. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  3788. return func(collection, castFunction(iteratee));
  3789. }
  3790. function endsWith(string, target, position) {
  3791. string = toString(string);
  3792. target = baseToString(target);
  3793. var length = string.length;
  3794. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  3795. var end = position;
  3796. position -= target.length;
  3797. return position >= 0 && string.slice(position, end) == target;
  3798. }
  3799. function baseToPairs(object, props) {
  3800. return arrayMap(props, function(key) {
  3801. return [key, object[key]];
  3802. });
  3803. }
  3804. function setToPairs(set) {
  3805. var index = -1, result = Array(set.size);
  3806. set.forEach(function(value) {
  3807. result[++index] = [value, value];
  3808. });
  3809. return result;
  3810. }
  3811. var mapTag$3 = "[object Map]";
  3812. var setTag$3 = "[object Set]";
  3813. function createToPairs(keysFunc) {
  3814. return function(object) {
  3815. var tag = getTag$1(object);
  3816. if (tag == mapTag$3) {
  3817. return mapToArray(object);
  3818. }
  3819. if (tag == setTag$3) {
  3820. return setToPairs(object);
  3821. }
  3822. return baseToPairs(object, keysFunc(object));
  3823. };
  3824. }
  3825. var toPairs = createToPairs(keys);
  3826. var toPairsIn = createToPairs(keysIn);
  3827. var htmlEscapes = {
  3828. "&": "&amp;",
  3829. "<": "&lt;",
  3830. ">": "&gt;",
  3831. '"': "&quot;",
  3832. "'": "&#39;"
  3833. };
  3834. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  3835. var reUnescapedHtml = /[&<>"']/g;
  3836. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  3837. function escape(string) {
  3838. string = toString(string);
  3839. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  3840. }
  3841. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3842. var reHasRegExpChar = RegExp(reRegExpChar.source);
  3843. function escapeRegExp(string) {
  3844. string = toString(string);
  3845. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  3846. }
  3847. function arrayEvery(array, predicate) {
  3848. var index = -1, length = array == null ? 0 : array.length;
  3849. while (++index < length) {
  3850. if (!predicate(array[index], index, array)) {
  3851. return false;
  3852. }
  3853. }
  3854. return true;
  3855. }
  3856. function baseEvery(collection, predicate) {
  3857. var result = true;
  3858. baseEach(collection, function(value, index, collection2) {
  3859. result = !!predicate(value, index, collection2);
  3860. return result;
  3861. });
  3862. return result;
  3863. }
  3864. function every(collection, predicate, guard) {
  3865. var func = isArray(collection) ? arrayEvery : baseEvery;
  3866. if (guard && isIterateeCall(collection, predicate, guard)) {
  3867. predicate = void 0;
  3868. }
  3869. return func(collection, baseIteratee(predicate));
  3870. }
  3871. var MAX_ARRAY_LENGTH$5 = 4294967295;
  3872. function toLength(value) {
  3873. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  3874. }
  3875. function baseFill(array, value, start, end) {
  3876. var length = array.length;
  3877. start = toInteger(start);
  3878. if (start < 0) {
  3879. start = -start > length ? 0 : length + start;
  3880. }
  3881. end = end === void 0 || end > length ? length : toInteger(end);
  3882. if (end < 0) {
  3883. end += length;
  3884. }
  3885. end = start > end ? 0 : toLength(end);
  3886. while (start < end) {
  3887. array[start++] = value;
  3888. }
  3889. return array;
  3890. }
  3891. function fill(array, value, start, end) {
  3892. var length = array == null ? 0 : array.length;
  3893. if (!length) {
  3894. return [];
  3895. }
  3896. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  3897. start = 0;
  3898. end = length;
  3899. }
  3900. return baseFill(array, value, start, end);
  3901. }
  3902. function baseFilter(collection, predicate) {
  3903. var result = [];
  3904. baseEach(collection, function(value, index, collection2) {
  3905. if (predicate(value, index, collection2)) {
  3906. result.push(value);
  3907. }
  3908. });
  3909. return result;
  3910. }
  3911. function filter(collection, predicate) {
  3912. var func = isArray(collection) ? arrayFilter : baseFilter;
  3913. return func(collection, baseIteratee(predicate));
  3914. }
  3915. function createFind(findIndexFunc) {
  3916. return function(collection, predicate, fromIndex) {
  3917. var iterable = Object(collection);
  3918. if (!isArrayLike(collection)) {
  3919. var iteratee = baseIteratee(predicate);
  3920. collection = keys(collection);
  3921. predicate = function(key) {
  3922. return iteratee(iterable[key], key, iterable);
  3923. };
  3924. }
  3925. var index = findIndexFunc(collection, predicate, fromIndex);
  3926. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  3927. };
  3928. }
  3929. var nativeMax$a = Math.max;
  3930. function findIndex(array, predicate, fromIndex) {
  3931. var length = array == null ? 0 : array.length;
  3932. if (!length) {
  3933. return -1;
  3934. }
  3935. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3936. if (index < 0) {
  3937. index = nativeMax$a(length + index, 0);
  3938. }
  3939. return baseFindIndex(array, baseIteratee(predicate), index);
  3940. }
  3941. var find = createFind(findIndex);
  3942. function baseFindKey(collection, predicate, eachFunc) {
  3943. var result;
  3944. eachFunc(collection, function(value, key, collection2) {
  3945. if (predicate(value, key, collection2)) {
  3946. result = key;
  3947. return false;
  3948. }
  3949. });
  3950. return result;
  3951. }
  3952. function findKey(object, predicate) {
  3953. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  3954. }
  3955. var nativeMax$9 = Math.max;
  3956. var nativeMin$a = Math.min;
  3957. function findLastIndex(array, predicate, fromIndex) {
  3958. var length = array == null ? 0 : array.length;
  3959. if (!length) {
  3960. return -1;
  3961. }
  3962. var index = length - 1;
  3963. if (fromIndex !== void 0) {
  3964. index = toInteger(fromIndex);
  3965. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  3966. }
  3967. return baseFindIndex(array, baseIteratee(predicate), index, true);
  3968. }
  3969. var findLast = createFind(findLastIndex);
  3970. function findLastKey(object, predicate) {
  3971. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  3972. }
  3973. function head(array) {
  3974. return array && array.length ? array[0] : void 0;
  3975. }
  3976. function baseMap(collection, iteratee) {
  3977. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  3978. baseEach(collection, function(value, key, collection2) {
  3979. result[++index] = iteratee(value, key, collection2);
  3980. });
  3981. return result;
  3982. }
  3983. function map(collection, iteratee) {
  3984. var func = isArray(collection) ? arrayMap : baseMap;
  3985. return func(collection, baseIteratee(iteratee));
  3986. }
  3987. function flatMap(collection, iteratee) {
  3988. return baseFlatten(map(collection, iteratee), 1);
  3989. }
  3990. var INFINITY$2 = 1 / 0;
  3991. function flatMapDeep(collection, iteratee) {
  3992. return baseFlatten(map(collection, iteratee), INFINITY$2);
  3993. }
  3994. function flatMapDepth(collection, iteratee, depth) {
  3995. depth = depth === void 0 ? 1 : toInteger(depth);
  3996. return baseFlatten(map(collection, iteratee), depth);
  3997. }
  3998. var INFINITY$1 = 1 / 0;
  3999. function flattenDeep(array) {
  4000. var length = array == null ? 0 : array.length;
  4001. return length ? baseFlatten(array, INFINITY$1) : [];
  4002. }
  4003. function flattenDepth(array, depth) {
  4004. var length = array == null ? 0 : array.length;
  4005. if (!length) {
  4006. return [];
  4007. }
  4008. depth = depth === void 0 ? 1 : toInteger(depth);
  4009. return baseFlatten(array, depth);
  4010. }
  4011. var WRAP_FLIP_FLAG = 512;
  4012. function flip(func) {
  4013. return createWrap(func, WRAP_FLIP_FLAG);
  4014. }
  4015. var floor$1 = createRound("floor");
  4016. var FUNC_ERROR_TEXT$4 = "Expected a function";
  4017. var WRAP_CURRY_FLAG = 8;
  4018. var WRAP_PARTIAL_FLAG$1 = 32;
  4019. var WRAP_ARY_FLAG = 128;
  4020. var WRAP_REARG_FLAG$1 = 256;
  4021. function createFlow(fromRight) {
  4022. return flatRest(function(funcs) {
  4023. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  4024. if (fromRight) {
  4025. funcs.reverse();
  4026. }
  4027. while (index--) {
  4028. var func = funcs[index];
  4029. if (typeof func != "function") {
  4030. throw new TypeError(FUNC_ERROR_TEXT$4);
  4031. }
  4032. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  4033. var wrapper = new LodashWrapper([], true);
  4034. }
  4035. }
  4036. index = wrapper ? index : length;
  4037. while (++index < length) {
  4038. func = funcs[index];
  4039. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  4040. 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) {
  4041. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  4042. } else {
  4043. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  4044. }
  4045. }
  4046. return function() {
  4047. var args = arguments, value = args[0];
  4048. if (wrapper && args.length == 1 && isArray(value)) {
  4049. return wrapper.plant(value).value();
  4050. }
  4051. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  4052. while (++index2 < length) {
  4053. result = funcs[index2].call(this, result);
  4054. }
  4055. return result;
  4056. };
  4057. });
  4058. }
  4059. var flow = createFlow();
  4060. var flowRight = createFlow(true);
  4061. function forIn(object, iteratee) {
  4062. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  4063. }
  4064. function forInRight(object, iteratee) {
  4065. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  4066. }
  4067. function forOwn(object, iteratee) {
  4068. return object && baseForOwn(object, castFunction(iteratee));
  4069. }
  4070. function forOwnRight(object, iteratee) {
  4071. return object && baseForOwnRight(object, castFunction(iteratee));
  4072. }
  4073. function fromPairs(pairs) {
  4074. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  4075. while (++index < length) {
  4076. var pair = pairs[index];
  4077. result[pair[0]] = pair[1];
  4078. }
  4079. return result;
  4080. }
  4081. function baseFunctions(object, props) {
  4082. return arrayFilter(props, function(key) {
  4083. return isFunction(object[key]);
  4084. });
  4085. }
  4086. function functions(object) {
  4087. return object == null ? [] : baseFunctions(object, keys(object));
  4088. }
  4089. function functionsIn(object) {
  4090. return object == null ? [] : baseFunctions(object, keysIn(object));
  4091. }
  4092. var objectProto$7 = Object.prototype;
  4093. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  4094. var groupBy = createAggregator(function(result, value, key) {
  4095. if (hasOwnProperty$6.call(result, key)) {
  4096. result[key].push(value);
  4097. } else {
  4098. baseAssignValue(result, key, [value]);
  4099. }
  4100. });
  4101. function baseGt(value, other) {
  4102. return value > other;
  4103. }
  4104. function createRelationalOperation(operator) {
  4105. return function(value, other) {
  4106. if (!(typeof value == "string" && typeof other == "string")) {
  4107. value = toNumber(value);
  4108. other = toNumber(other);
  4109. }
  4110. return operator(value, other);
  4111. };
  4112. }
  4113. var gt$1 = createRelationalOperation(baseGt);
  4114. var gte = createRelationalOperation(function(value, other) {
  4115. return value >= other;
  4116. });
  4117. var objectProto$6 = Object.prototype;
  4118. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  4119. function baseHas(object, key) {
  4120. return object != null && hasOwnProperty$5.call(object, key);
  4121. }
  4122. function has(object, path) {
  4123. return object != null && hasPath(object, path, baseHas);
  4124. }
  4125. var nativeMax$8 = Math.max;
  4126. var nativeMin$9 = Math.min;
  4127. function baseInRange(number, start, end) {
  4128. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  4129. }
  4130. function inRange(number, start, end) {
  4131. start = toFinite(start);
  4132. if (end === void 0) {
  4133. end = start;
  4134. start = 0;
  4135. } else {
  4136. end = toFinite(end);
  4137. }
  4138. number = toNumber(number);
  4139. return baseInRange(number, start, end);
  4140. }
  4141. var stringTag = "[object String]";
  4142. function isString(value) {
  4143. return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  4144. }
  4145. function baseValues(object, props) {
  4146. return arrayMap(props, function(key) {
  4147. return object[key];
  4148. });
  4149. }
  4150. function values(object) {
  4151. return object == null ? [] : baseValues(object, keys(object));
  4152. }
  4153. var nativeMax$7 = Math.max;
  4154. function includes(collection, value, fromIndex, guard) {
  4155. collection = isArrayLike(collection) ? collection : values(collection);
  4156. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  4157. var length = collection.length;
  4158. if (fromIndex < 0) {
  4159. fromIndex = nativeMax$7(length + fromIndex, 0);
  4160. }
  4161. return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  4162. }
  4163. var nativeMax$6 = Math.max;
  4164. function indexOf(array, value, fromIndex) {
  4165. var length = array == null ? 0 : array.length;
  4166. if (!length) {
  4167. return -1;
  4168. }
  4169. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4170. if (index < 0) {
  4171. index = nativeMax$6(length + index, 0);
  4172. }
  4173. return baseIndexOf(array, value, index);
  4174. }
  4175. function initial(array) {
  4176. var length = array == null ? 0 : array.length;
  4177. return length ? baseSlice(array, 0, -1) : [];
  4178. }
  4179. var nativeMin$8 = Math.min;
  4180. function baseIntersection(arrays, iteratee, comparator) {
  4181. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  4182. while (othIndex--) {
  4183. var array = arrays[othIndex];
  4184. if (othIndex && iteratee) {
  4185. array = arrayMap(array, baseUnary(iteratee));
  4186. }
  4187. maxLength = nativeMin$8(array.length, maxLength);
  4188. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  4189. }
  4190. array = arrays[0];
  4191. var index = -1, seen = caches[0];
  4192. outer:
  4193. while (++index < length && result.length < maxLength) {
  4194. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4195. value = comparator || value !== 0 ? value : 0;
  4196. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  4197. othIndex = othLength;
  4198. while (--othIndex) {
  4199. var cache = caches[othIndex];
  4200. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  4201. continue outer;
  4202. }
  4203. }
  4204. if (seen) {
  4205. seen.push(computed);
  4206. }
  4207. result.push(value);
  4208. }
  4209. }
  4210. return result;
  4211. }
  4212. function castArrayLikeObject(value) {
  4213. return isArrayLikeObject(value) ? value : [];
  4214. }
  4215. var intersection = baseRest(function(arrays) {
  4216. var mapped = arrayMap(arrays, castArrayLikeObject);
  4217. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  4218. });
  4219. var intersectionBy = baseRest(function(arrays) {
  4220. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4221. if (iteratee === last(mapped)) {
  4222. iteratee = void 0;
  4223. } else {
  4224. mapped.pop();
  4225. }
  4226. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  4227. });
  4228. var intersectionWith = baseRest(function(arrays) {
  4229. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4230. comparator = typeof comparator == "function" ? comparator : void 0;
  4231. if (comparator) {
  4232. mapped.pop();
  4233. }
  4234. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  4235. });
  4236. function baseInverter(object, setter, iteratee, accumulator) {
  4237. baseForOwn(object, function(value, key, object2) {
  4238. setter(accumulator, iteratee(value), key, object2);
  4239. });
  4240. return accumulator;
  4241. }
  4242. function createInverter(setter, toIteratee) {
  4243. return function(object, iteratee) {
  4244. return baseInverter(object, setter, toIteratee(iteratee), {});
  4245. };
  4246. }
  4247. var objectProto$5 = Object.prototype;
  4248. var nativeObjectToString$1 = objectProto$5.toString;
  4249. var invert = createInverter(function(result, value, key) {
  4250. if (value != null && typeof value.toString != "function") {
  4251. value = nativeObjectToString$1.call(value);
  4252. }
  4253. result[value] = key;
  4254. }, constant(identity));
  4255. var objectProto$4 = Object.prototype;
  4256. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4257. var nativeObjectToString = objectProto$4.toString;
  4258. var invertBy = createInverter(function(result, value, key) {
  4259. if (value != null && typeof value.toString != "function") {
  4260. value = nativeObjectToString.call(value);
  4261. }
  4262. if (hasOwnProperty$4.call(result, value)) {
  4263. result[value].push(key);
  4264. } else {
  4265. result[value] = [key];
  4266. }
  4267. }, baseIteratee);
  4268. function parent(object, path) {
  4269. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  4270. }
  4271. function baseInvoke(object, path, args) {
  4272. path = castPath(path, object);
  4273. object = parent(object, path);
  4274. var func = object == null ? object : object[toKey(last(path))];
  4275. return func == null ? void 0 : apply(func, object, args);
  4276. }
  4277. var invoke = baseRest(baseInvoke);
  4278. var invokeMap = baseRest(function(collection, path, args) {
  4279. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  4280. baseEach(collection, function(value) {
  4281. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  4282. });
  4283. return result;
  4284. });
  4285. var arrayBufferTag = "[object ArrayBuffer]";
  4286. function baseIsArrayBuffer(value) {
  4287. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4288. }
  4289. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  4290. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  4291. var boolTag = "[object Boolean]";
  4292. function isBoolean(value) {
  4293. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  4294. }
  4295. var dateTag = "[object Date]";
  4296. function baseIsDate(value) {
  4297. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4298. }
  4299. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  4300. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  4301. function isElement$2(value) {
  4302. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  4303. }
  4304. var mapTag$2 = "[object Map]";
  4305. var setTag$2 = "[object Set]";
  4306. var objectProto$3 = Object.prototype;
  4307. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4308. function isEmpty$1(value) {
  4309. if (value == null) {
  4310. return true;
  4311. }
  4312. if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  4313. return !value.length;
  4314. }
  4315. var tag = getTag$1(value);
  4316. if (tag == mapTag$2 || tag == setTag$2) {
  4317. return !value.size;
  4318. }
  4319. if (isPrototype(value)) {
  4320. return !baseKeys(value).length;
  4321. }
  4322. for (var key in value) {
  4323. if (hasOwnProperty$3.call(value, key)) {
  4324. return false;
  4325. }
  4326. }
  4327. return true;
  4328. }
  4329. function isEqual$1(value, other) {
  4330. return baseIsEqual(value, other);
  4331. }
  4332. function isEqualWith(value, other, customizer) {
  4333. customizer = typeof customizer == "function" ? customizer : void 0;
  4334. var result = customizer ? customizer(value, other) : void 0;
  4335. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  4336. }
  4337. var nativeIsFinite = root.isFinite;
  4338. function isFinite(value) {
  4339. return typeof value == "number" && nativeIsFinite(value);
  4340. }
  4341. function isInteger(value) {
  4342. return typeof value == "number" && value == toInteger(value);
  4343. }
  4344. function isMatch(object, source) {
  4345. return object === source || baseIsMatch(object, source, getMatchData(source));
  4346. }
  4347. function isMatchWith(object, source, customizer) {
  4348. customizer = typeof customizer == "function" ? customizer : void 0;
  4349. return baseIsMatch(object, source, getMatchData(source), customizer);
  4350. }
  4351. var numberTag = "[object Number]";
  4352. function isNumber(value) {
  4353. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  4354. }
  4355. function isNaN$1(value) {
  4356. return isNumber(value) && value != +value;
  4357. }
  4358. var isMaskable = coreJsData ? isFunction : stubFalse;
  4359. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  4360. function isNative(value) {
  4361. if (isMaskable(value)) {
  4362. throw new Error(CORE_ERROR_TEXT);
  4363. }
  4364. return baseIsNative(value);
  4365. }
  4366. function isNil(value) {
  4367. return value == null;
  4368. }
  4369. function isNull(value) {
  4370. return value === null;
  4371. }
  4372. var regexpTag = "[object RegExp]";
  4373. function baseIsRegExp(value) {
  4374. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4375. }
  4376. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  4377. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  4378. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  4379. function isSafeInteger(value) {
  4380. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  4381. }
  4382. function isUndefined$1(value) {
  4383. return value === void 0;
  4384. }
  4385. var weakMapTag = "[object WeakMap]";
  4386. function isWeakMap(value) {
  4387. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  4388. }
  4389. var weakSetTag = "[object WeakSet]";
  4390. function isWeakSet(value) {
  4391. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  4392. }
  4393. var CLONE_DEEP_FLAG$3 = 1;
  4394. function iteratee(func) {
  4395. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  4396. }
  4397. var arrayProto$4 = Array.prototype;
  4398. var nativeJoin = arrayProto$4.join;
  4399. function join(array, separator) {
  4400. return array == null ? "" : nativeJoin.call(array, separator);
  4401. }
  4402. var kebabCase = createCompounder(function(result, word, index) {
  4403. return result + (index ? "-" : "") + word.toLowerCase();
  4404. });
  4405. var keyBy = createAggregator(function(result, value, key) {
  4406. baseAssignValue(result, key, value);
  4407. });
  4408. function strictLastIndexOf(array, value, fromIndex) {
  4409. var index = fromIndex + 1;
  4410. while (index--) {
  4411. if (array[index] === value) {
  4412. return index;
  4413. }
  4414. }
  4415. return index;
  4416. }
  4417. var nativeMax$5 = Math.max;
  4418. var nativeMin$7 = Math.min;
  4419. function lastIndexOf(array, value, fromIndex) {
  4420. var length = array == null ? 0 : array.length;
  4421. if (!length) {
  4422. return -1;
  4423. }
  4424. var index = length;
  4425. if (fromIndex !== void 0) {
  4426. index = toInteger(fromIndex);
  4427. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  4428. }
  4429. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  4430. }
  4431. var lowerCase = createCompounder(function(result, word, index) {
  4432. return result + (index ? " " : "") + word.toLowerCase();
  4433. });
  4434. var lowerFirst = createCaseFirst("toLowerCase");
  4435. function baseLt(value, other) {
  4436. return value < other;
  4437. }
  4438. var lt$1 = createRelationalOperation(baseLt);
  4439. var lte = createRelationalOperation(function(value, other) {
  4440. return value <= other;
  4441. });
  4442. function mapKeys(object, iteratee) {
  4443. var result = {};
  4444. iteratee = baseIteratee(iteratee);
  4445. baseForOwn(object, function(value, key, object2) {
  4446. baseAssignValue(result, iteratee(value, key, object2), value);
  4447. });
  4448. return result;
  4449. }
  4450. function mapValues(object, iteratee) {
  4451. var result = {};
  4452. iteratee = baseIteratee(iteratee);
  4453. baseForOwn(object, function(value, key, object2) {
  4454. baseAssignValue(result, key, iteratee(value, key, object2));
  4455. });
  4456. return result;
  4457. }
  4458. var CLONE_DEEP_FLAG$2 = 1;
  4459. function matches(source) {
  4460. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  4461. }
  4462. var CLONE_DEEP_FLAG$1 = 1;
  4463. function matchesProperty(path, srcValue) {
  4464. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  4465. }
  4466. function baseExtremum(array, iteratee, comparator) {
  4467. var index = -1, length = array.length;
  4468. while (++index < length) {
  4469. var value = array[index], current = iteratee(value);
  4470. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  4471. var computed = current, result = value;
  4472. }
  4473. }
  4474. return result;
  4475. }
  4476. function max$3(array) {
  4477. return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
  4478. }
  4479. function maxBy(array, iteratee) {
  4480. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  4481. }
  4482. function baseSum(array, iteratee) {
  4483. var result, index = -1, length = array.length;
  4484. while (++index < length) {
  4485. var current = iteratee(array[index]);
  4486. if (current !== void 0) {
  4487. result = result === void 0 ? current : result + current;
  4488. }
  4489. }
  4490. return result;
  4491. }
  4492. var NAN = 0 / 0;
  4493. function baseMean(array, iteratee) {
  4494. var length = array == null ? 0 : array.length;
  4495. return length ? baseSum(array, iteratee) / length : NAN;
  4496. }
  4497. function mean(array) {
  4498. return baseMean(array, identity);
  4499. }
  4500. function meanBy(array, iteratee) {
  4501. return baseMean(array, baseIteratee(iteratee));
  4502. }
  4503. var merge = createAssigner(function(object, source, srcIndex) {
  4504. baseMerge(object, source, srcIndex);
  4505. });
  4506. var method = baseRest(function(path, args) {
  4507. return function(object) {
  4508. return baseInvoke(object, path, args);
  4509. };
  4510. });
  4511. var methodOf = baseRest(function(object, args) {
  4512. return function(path) {
  4513. return baseInvoke(object, path, args);
  4514. };
  4515. });
  4516. function min$3(array) {
  4517. return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
  4518. }
  4519. function minBy(array, iteratee) {
  4520. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  4521. }
  4522. function mixin$1(object, source, options) {
  4523. var props = keys(source), methodNames = baseFunctions(source, props);
  4524. var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
  4525. arrayEach(methodNames, function(methodName) {
  4526. var func = source[methodName];
  4527. object[methodName] = func;
  4528. if (isFunc) {
  4529. object.prototype[methodName] = function() {
  4530. var chainAll = this.__chain__;
  4531. if (chain || chainAll) {
  4532. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  4533. actions.push({ "func": func, "args": arguments, "thisArg": object });
  4534. result.__chain__ = chainAll;
  4535. return result;
  4536. }
  4537. return func.apply(object, arrayPush([this.value()], arguments));
  4538. };
  4539. }
  4540. });
  4541. return object;
  4542. }
  4543. var multiply = createMathOperation(function(multiplier, multiplicand) {
  4544. return multiplier * multiplicand;
  4545. }, 1);
  4546. var FUNC_ERROR_TEXT$3 = "Expected a function";
  4547. function negate(predicate) {
  4548. if (typeof predicate != "function") {
  4549. throw new TypeError(FUNC_ERROR_TEXT$3);
  4550. }
  4551. return function() {
  4552. var args = arguments;
  4553. switch (args.length) {
  4554. case 0:
  4555. return !predicate.call(this);
  4556. case 1:
  4557. return !predicate.call(this, args[0]);
  4558. case 2:
  4559. return !predicate.call(this, args[0], args[1]);
  4560. case 3:
  4561. return !predicate.call(this, args[0], args[1], args[2]);
  4562. }
  4563. return !predicate.apply(this, args);
  4564. };
  4565. }
  4566. function iteratorToArray(iterator) {
  4567. var data, result = [];
  4568. while (!(data = iterator.next()).done) {
  4569. result.push(data.value);
  4570. }
  4571. return result;
  4572. }
  4573. var mapTag$1 = "[object Map]";
  4574. var setTag$1 = "[object Set]";
  4575. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  4576. function toArray(value) {
  4577. if (!value) {
  4578. return [];
  4579. }
  4580. if (isArrayLike(value)) {
  4581. return isString(value) ? stringToArray(value) : copyArray(value);
  4582. }
  4583. if (symIterator$1 && value[symIterator$1]) {
  4584. return iteratorToArray(value[symIterator$1]());
  4585. }
  4586. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  4587. return func(value);
  4588. }
  4589. function wrapperNext() {
  4590. if (this.__values__ === void 0) {
  4591. this.__values__ = toArray(this.value());
  4592. }
  4593. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  4594. return { "done": done, "value": value };
  4595. }
  4596. function baseNth(array, n) {
  4597. var length = array.length;
  4598. if (!length) {
  4599. return;
  4600. }
  4601. n += n < 0 ? length : 0;
  4602. return isIndex(n, length) ? array[n] : void 0;
  4603. }
  4604. function nth(array, n) {
  4605. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  4606. }
  4607. function nthArg(n) {
  4608. n = toInteger(n);
  4609. return baseRest(function(args) {
  4610. return baseNth(args, n);
  4611. });
  4612. }
  4613. function baseUnset(object, path) {
  4614. path = castPath(path, object);
  4615. object = parent(object, path);
  4616. return object == null || delete object[toKey(last(path))];
  4617. }
  4618. function customOmitClone(value) {
  4619. return isPlainObject(value) ? void 0 : value;
  4620. }
  4621. var CLONE_DEEP_FLAG = 1;
  4622. var CLONE_FLAT_FLAG = 2;
  4623. var CLONE_SYMBOLS_FLAG = 4;
  4624. var omit = flatRest(function(object, paths) {
  4625. var result = {};
  4626. if (object == null) {
  4627. return result;
  4628. }
  4629. var isDeep = false;
  4630. paths = arrayMap(paths, function(path) {
  4631. path = castPath(path, object);
  4632. isDeep || (isDeep = path.length > 1);
  4633. return path;
  4634. });
  4635. copyObject(object, getAllKeysIn(object), result);
  4636. if (isDeep) {
  4637. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  4638. }
  4639. var length = paths.length;
  4640. while (length--) {
  4641. baseUnset(result, paths[length]);
  4642. }
  4643. return result;
  4644. });
  4645. function baseSet(object, path, value, customizer) {
  4646. if (!isObject(object)) {
  4647. return object;
  4648. }
  4649. path = castPath(path, object);
  4650. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  4651. while (nested != null && ++index < length) {
  4652. var key = toKey(path[index]), newValue = value;
  4653. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  4654. return object;
  4655. }
  4656. if (index != lastIndex) {
  4657. var objValue = nested[key];
  4658. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  4659. if (newValue === void 0) {
  4660. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  4661. }
  4662. }
  4663. assignValue(nested, key, newValue);
  4664. nested = nested[key];
  4665. }
  4666. return object;
  4667. }
  4668. function basePickBy(object, paths, predicate) {
  4669. var index = -1, length = paths.length, result = {};
  4670. while (++index < length) {
  4671. var path = paths[index], value = baseGet(object, path);
  4672. if (predicate(value, path)) {
  4673. baseSet(result, castPath(path, object), value);
  4674. }
  4675. }
  4676. return result;
  4677. }
  4678. function pickBy(object, predicate) {
  4679. if (object == null) {
  4680. return {};
  4681. }
  4682. var props = arrayMap(getAllKeysIn(object), function(prop) {
  4683. return [prop];
  4684. });
  4685. predicate = baseIteratee(predicate);
  4686. return basePickBy(object, props, function(value, path) {
  4687. return predicate(value, path[0]);
  4688. });
  4689. }
  4690. function omitBy(object, predicate) {
  4691. return pickBy(object, negate(baseIteratee(predicate)));
  4692. }
  4693. function once(func) {
  4694. return before(2, func);
  4695. }
  4696. function baseSortBy(array, comparer) {
  4697. var length = array.length;
  4698. array.sort(comparer);
  4699. while (length--) {
  4700. array[length] = array[length].value;
  4701. }
  4702. return array;
  4703. }
  4704. function compareAscending(value, other) {
  4705. if (value !== other) {
  4706. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  4707. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  4708. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  4709. return 1;
  4710. }
  4711. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  4712. return -1;
  4713. }
  4714. }
  4715. return 0;
  4716. }
  4717. function compareMultiple(object, other, orders) {
  4718. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  4719. while (++index < length) {
  4720. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4721. if (result) {
  4722. if (index >= ordersLength) {
  4723. return result;
  4724. }
  4725. var order = orders[index];
  4726. return result * (order == "desc" ? -1 : 1);
  4727. }
  4728. }
  4729. return object.index - other.index;
  4730. }
  4731. function baseOrderBy(collection, iteratees, orders) {
  4732. if (iteratees.length) {
  4733. iteratees = arrayMap(iteratees, function(iteratee) {
  4734. if (isArray(iteratee)) {
  4735. return function(value) {
  4736. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4737. };
  4738. }
  4739. return iteratee;
  4740. });
  4741. } else {
  4742. iteratees = [identity];
  4743. }
  4744. var index = -1;
  4745. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4746. var result = baseMap(collection, function(value, key, collection2) {
  4747. var criteria = arrayMap(iteratees, function(iteratee) {
  4748. return iteratee(value);
  4749. });
  4750. return { "criteria": criteria, "index": ++index, "value": value };
  4751. });
  4752. return baseSortBy(result, function(object, other) {
  4753. return compareMultiple(object, other, orders);
  4754. });
  4755. }
  4756. function orderBy$1(collection, iteratees, orders, guard) {
  4757. if (collection == null) {
  4758. return [];
  4759. }
  4760. if (!isArray(iteratees)) {
  4761. iteratees = iteratees == null ? [] : [iteratees];
  4762. }
  4763. orders = guard ? void 0 : orders;
  4764. if (!isArray(orders)) {
  4765. orders = orders == null ? [] : [orders];
  4766. }
  4767. return baseOrderBy(collection, iteratees, orders);
  4768. }
  4769. function createOver(arrayFunc) {
  4770. return flatRest(function(iteratees) {
  4771. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4772. return baseRest(function(args) {
  4773. var thisArg = this;
  4774. return arrayFunc(iteratees, function(iteratee) {
  4775. return apply(iteratee, thisArg, args);
  4776. });
  4777. });
  4778. });
  4779. }
  4780. var over = createOver(arrayMap);
  4781. var castRest = baseRest;
  4782. var nativeMin$6 = Math.min;
  4783. var overArgs = castRest(function(func, transforms) {
  4784. transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  4785. var funcsLength = transforms.length;
  4786. return baseRest(function(args) {
  4787. var index = -1, length = nativeMin$6(args.length, funcsLength);
  4788. while (++index < length) {
  4789. args[index] = transforms[index].call(this, args[index]);
  4790. }
  4791. return apply(func, this, args);
  4792. });
  4793. });
  4794. var overEvery = createOver(arrayEvery);
  4795. var overSome = createOver(arraySome);
  4796. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  4797. var nativeFloor$3 = Math.floor;
  4798. function baseRepeat(string, n) {
  4799. var result = "";
  4800. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  4801. return result;
  4802. }
  4803. do {
  4804. if (n % 2) {
  4805. result += string;
  4806. }
  4807. n = nativeFloor$3(n / 2);
  4808. if (n) {
  4809. string += string;
  4810. }
  4811. } while (n);
  4812. return result;
  4813. }
  4814. var asciiSize = baseProperty("length");
  4815. var rsAstralRange = "\\ud800-\\udfff";
  4816. var rsComboMarksRange = "\\u0300-\\u036f";
  4817. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  4818. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  4819. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  4820. var rsVarRange = "\\ufe0e\\ufe0f";
  4821. var rsAstral = "[" + rsAstralRange + "]";
  4822. var rsCombo = "[" + rsComboRange + "]";
  4823. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  4824. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  4825. var rsNonAstral = "[^" + rsAstralRange + "]";
  4826. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  4827. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  4828. var rsZWJ = "\\u200d";
  4829. var reOptMod = rsModifier + "?";
  4830. var rsOptVar = "[" + rsVarRange + "]?";
  4831. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  4832. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  4833. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  4834. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  4835. function unicodeSize(string) {
  4836. var result = reUnicode.lastIndex = 0;
  4837. while (reUnicode.test(string)) {
  4838. ++result;
  4839. }
  4840. return result;
  4841. }
  4842. function stringSize(string) {
  4843. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  4844. }
  4845. var nativeCeil$2 = Math.ceil;
  4846. function createPadding(length, chars) {
  4847. chars = chars === void 0 ? " " : baseToString(chars);
  4848. var charsLength = chars.length;
  4849. if (charsLength < 2) {
  4850. return charsLength ? baseRepeat(chars, length) : chars;
  4851. }
  4852. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  4853. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  4854. }
  4855. var nativeCeil$1 = Math.ceil;
  4856. var nativeFloor$2 = Math.floor;
  4857. function pad(string, length, chars) {
  4858. string = toString(string);
  4859. length = toInteger(length);
  4860. var strLength = length ? stringSize(string) : 0;
  4861. if (!length || strLength >= length) {
  4862. return string;
  4863. }
  4864. var mid = (length - strLength) / 2;
  4865. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  4866. }
  4867. function padEnd(string, length, chars) {
  4868. string = toString(string);
  4869. length = toInteger(length);
  4870. var strLength = length ? stringSize(string) : 0;
  4871. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  4872. }
  4873. function padStart(string, length, chars) {
  4874. string = toString(string);
  4875. length = toInteger(length);
  4876. var strLength = length ? stringSize(string) : 0;
  4877. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  4878. }
  4879. var reTrimStart$1 = /^\s+/;
  4880. var nativeParseInt = root.parseInt;
  4881. function parseInt$1(string, radix, guard) {
  4882. if (guard || radix == null) {
  4883. radix = 0;
  4884. } else if (radix) {
  4885. radix = +radix;
  4886. }
  4887. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  4888. }
  4889. var WRAP_PARTIAL_FLAG = 32;
  4890. var partial = baseRest(function(func, partials) {
  4891. var holders = replaceHolders(partials, getHolder(partial));
  4892. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  4893. });
  4894. partial.placeholder = {};
  4895. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  4896. var partialRight = baseRest(function(func, partials) {
  4897. var holders = replaceHolders(partials, getHolder(partialRight));
  4898. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  4899. });
  4900. partialRight.placeholder = {};
  4901. var partition = createAggregator(function(result, value, key) {
  4902. result[key ? 0 : 1].push(value);
  4903. }, function() {
  4904. return [[], []];
  4905. });
  4906. function basePick(object, paths) {
  4907. return basePickBy(object, paths, function(value, path) {
  4908. return hasIn(object, path);
  4909. });
  4910. }
  4911. var pick = flatRest(function(object, paths) {
  4912. return object == null ? {} : basePick(object, paths);
  4913. });
  4914. function wrapperPlant(value) {
  4915. var result, parent = this;
  4916. while (parent instanceof baseLodash) {
  4917. var clone = wrapperClone(parent);
  4918. clone.__index__ = 0;
  4919. clone.__values__ = void 0;
  4920. if (result) {
  4921. previous.__wrapped__ = clone;
  4922. } else {
  4923. result = clone;
  4924. }
  4925. var previous = clone;
  4926. parent = parent.__wrapped__;
  4927. }
  4928. previous.__wrapped__ = value;
  4929. return result;
  4930. }
  4931. function propertyOf(object) {
  4932. return function(path) {
  4933. return object == null ? void 0 : baseGet(object, path);
  4934. };
  4935. }
  4936. function baseIndexOfWith(array, value, fromIndex, comparator) {
  4937. var index = fromIndex - 1, length = array.length;
  4938. while (++index < length) {
  4939. if (comparator(array[index], value)) {
  4940. return index;
  4941. }
  4942. }
  4943. return -1;
  4944. }
  4945. var arrayProto$3 = Array.prototype;
  4946. var splice$1 = arrayProto$3.splice;
  4947. function basePullAll(array, values, iteratee, comparator) {
  4948. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  4949. if (array === values) {
  4950. values = copyArray(values);
  4951. }
  4952. if (iteratee) {
  4953. seen = arrayMap(array, baseUnary(iteratee));
  4954. }
  4955. while (++index < length) {
  4956. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  4957. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4958. if (seen !== array) {
  4959. splice$1.call(seen, fromIndex, 1);
  4960. }
  4961. splice$1.call(array, fromIndex, 1);
  4962. }
  4963. }
  4964. return array;
  4965. }
  4966. function pullAll(array, values) {
  4967. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  4968. }
  4969. var pull = baseRest(pullAll);
  4970. function pullAllBy(array, values, iteratee) {
  4971. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  4972. }
  4973. function pullAllWith(array, values, comparator) {
  4974. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  4975. }
  4976. var arrayProto$2 = Array.prototype;
  4977. var splice = arrayProto$2.splice;
  4978. function basePullAt(array, indexes) {
  4979. var length = array ? indexes.length : 0, lastIndex = length - 1;
  4980. while (length--) {
  4981. var index = indexes[length];
  4982. if (length == lastIndex || index !== previous) {
  4983. var previous = index;
  4984. if (isIndex(index)) {
  4985. splice.call(array, index, 1);
  4986. } else {
  4987. baseUnset(array, index);
  4988. }
  4989. }
  4990. }
  4991. return array;
  4992. }
  4993. var pullAt = flatRest(function(array, indexes) {
  4994. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  4995. basePullAt(array, arrayMap(indexes, function(index) {
  4996. return isIndex(index, length) ? +index : index;
  4997. }).sort(compareAscending));
  4998. return result;
  4999. });
  5000. var nativeFloor$1 = Math.floor;
  5001. var nativeRandom$1 = Math.random;
  5002. function baseRandom(lower, upper) {
  5003. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  5004. }
  5005. var freeParseFloat = parseFloat;
  5006. var nativeMin$5 = Math.min;
  5007. var nativeRandom = Math.random;
  5008. function random(lower, upper, floating) {
  5009. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  5010. upper = floating = void 0;
  5011. }
  5012. if (floating === void 0) {
  5013. if (typeof upper == "boolean") {
  5014. floating = upper;
  5015. upper = void 0;
  5016. } else if (typeof lower == "boolean") {
  5017. floating = lower;
  5018. lower = void 0;
  5019. }
  5020. }
  5021. if (lower === void 0 && upper === void 0) {
  5022. lower = 0;
  5023. upper = 1;
  5024. } else {
  5025. lower = toFinite(lower);
  5026. if (upper === void 0) {
  5027. upper = lower;
  5028. lower = 0;
  5029. } else {
  5030. upper = toFinite(upper);
  5031. }
  5032. }
  5033. if (lower > upper) {
  5034. var temp = lower;
  5035. lower = upper;
  5036. upper = temp;
  5037. }
  5038. if (floating || lower % 1 || upper % 1) {
  5039. var rand = nativeRandom();
  5040. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  5041. }
  5042. return baseRandom(lower, upper);
  5043. }
  5044. var nativeCeil = Math.ceil;
  5045. var nativeMax$4 = Math.max;
  5046. function baseRange(start, end, step, fromRight) {
  5047. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  5048. while (length--) {
  5049. result[fromRight ? length : ++index] = start;
  5050. start += step;
  5051. }
  5052. return result;
  5053. }
  5054. function createRange(fromRight) {
  5055. return function(start, end, step) {
  5056. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  5057. end = step = void 0;
  5058. }
  5059. start = toFinite(start);
  5060. if (end === void 0) {
  5061. end = start;
  5062. start = 0;
  5063. } else {
  5064. end = toFinite(end);
  5065. }
  5066. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  5067. return baseRange(start, end, step, fromRight);
  5068. };
  5069. }
  5070. var range$1 = createRange();
  5071. var rangeRight = createRange(true);
  5072. var WRAP_REARG_FLAG = 256;
  5073. var rearg = flatRest(function(func, indexes) {
  5074. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  5075. });
  5076. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  5077. eachFunc(collection, function(value, index, collection2) {
  5078. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  5079. });
  5080. return accumulator;
  5081. }
  5082. function reduce(collection, iteratee, accumulator) {
  5083. var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  5084. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  5085. }
  5086. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  5087. var length = array == null ? 0 : array.length;
  5088. if (initAccum && length) {
  5089. accumulator = array[--length];
  5090. }
  5091. while (length--) {
  5092. accumulator = iteratee(accumulator, array[length], length, array);
  5093. }
  5094. return accumulator;
  5095. }
  5096. function reduceRight(collection, iteratee, accumulator) {
  5097. var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  5098. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  5099. }
  5100. function reject(collection, predicate) {
  5101. var func = isArray(collection) ? arrayFilter : baseFilter;
  5102. return func(collection, negate(baseIteratee(predicate)));
  5103. }
  5104. function remove(array, predicate) {
  5105. var result = [];
  5106. if (!(array && array.length)) {
  5107. return result;
  5108. }
  5109. var index = -1, indexes = [], length = array.length;
  5110. predicate = baseIteratee(predicate);
  5111. while (++index < length) {
  5112. var value = array[index];
  5113. if (predicate(value, index, array)) {
  5114. result.push(value);
  5115. indexes.push(index);
  5116. }
  5117. }
  5118. basePullAt(array, indexes);
  5119. return result;
  5120. }
  5121. function repeat(string, n, guard) {
  5122. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  5123. n = 1;
  5124. } else {
  5125. n = toInteger(n);
  5126. }
  5127. return baseRepeat(toString(string), n);
  5128. }
  5129. function replace() {
  5130. var args = arguments, string = toString(args[0]);
  5131. return args.length < 3 ? string : string.replace(args[1], args[2]);
  5132. }
  5133. var FUNC_ERROR_TEXT$2 = "Expected a function";
  5134. function rest(func, start) {
  5135. if (typeof func != "function") {
  5136. throw new TypeError(FUNC_ERROR_TEXT$2);
  5137. }
  5138. start = start === void 0 ? start : toInteger(start);
  5139. return baseRest(func, start);
  5140. }
  5141. function result(object, path, defaultValue) {
  5142. path = castPath(path, object);
  5143. var index = -1, length = path.length;
  5144. if (!length) {
  5145. length = 1;
  5146. object = void 0;
  5147. }
  5148. while (++index < length) {
  5149. var value = object == null ? void 0 : object[toKey(path[index])];
  5150. if (value === void 0) {
  5151. index = length;
  5152. value = defaultValue;
  5153. }
  5154. object = isFunction(value) ? value.call(object) : value;
  5155. }
  5156. return object;
  5157. }
  5158. var arrayProto$1 = Array.prototype;
  5159. var nativeReverse = arrayProto$1.reverse;
  5160. function reverse(array) {
  5161. return array == null ? array : nativeReverse.call(array);
  5162. }
  5163. var round$1 = createRound("round");
  5164. function arraySample(array) {
  5165. var length = array.length;
  5166. return length ? array[baseRandom(0, length - 1)] : void 0;
  5167. }
  5168. function baseSample(collection) {
  5169. return arraySample(values(collection));
  5170. }
  5171. function sample(collection) {
  5172. var func = isArray(collection) ? arraySample : baseSample;
  5173. return func(collection);
  5174. }
  5175. function shuffleSelf(array, size) {
  5176. var index = -1, length = array.length, lastIndex = length - 1;
  5177. size = size === void 0 ? length : size;
  5178. while (++index < size) {
  5179. var rand = baseRandom(index, lastIndex), value = array[rand];
  5180. array[rand] = array[index];
  5181. array[index] = value;
  5182. }
  5183. array.length = size;
  5184. return array;
  5185. }
  5186. function arraySampleSize(array, n) {
  5187. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  5188. }
  5189. function baseSampleSize(collection, n) {
  5190. var array = values(collection);
  5191. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5192. }
  5193. function sampleSize(collection, n, guard) {
  5194. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  5195. n = 1;
  5196. } else {
  5197. n = toInteger(n);
  5198. }
  5199. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  5200. return func(collection, n);
  5201. }
  5202. function set(object, path, value) {
  5203. return object == null ? object : baseSet(object, path, value);
  5204. }
  5205. function setWith(object, path, value, customizer) {
  5206. customizer = typeof customizer == "function" ? customizer : void 0;
  5207. return object == null ? object : baseSet(object, path, value, customizer);
  5208. }
  5209. function arrayShuffle(array) {
  5210. return shuffleSelf(copyArray(array));
  5211. }
  5212. function baseShuffle(collection) {
  5213. return shuffleSelf(values(collection));
  5214. }
  5215. function shuffle(collection) {
  5216. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  5217. return func(collection);
  5218. }
  5219. var mapTag = "[object Map]";
  5220. var setTag = "[object Set]";
  5221. function size(collection) {
  5222. if (collection == null) {
  5223. return 0;
  5224. }
  5225. if (isArrayLike(collection)) {
  5226. return isString(collection) ? stringSize(collection) : collection.length;
  5227. }
  5228. var tag = getTag$1(collection);
  5229. if (tag == mapTag || tag == setTag) {
  5230. return collection.size;
  5231. }
  5232. return baseKeys(collection).length;
  5233. }
  5234. function slice(array, start, end) {
  5235. var length = array == null ? 0 : array.length;
  5236. if (!length) {
  5237. return [];
  5238. }
  5239. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  5240. start = 0;
  5241. end = length;
  5242. } else {
  5243. start = start == null ? 0 : toInteger(start);
  5244. end = end === void 0 ? length : toInteger(end);
  5245. }
  5246. return baseSlice(array, start, end);
  5247. }
  5248. var snakeCase = createCompounder(function(result, word, index) {
  5249. return result + (index ? "_" : "") + word.toLowerCase();
  5250. });
  5251. function baseSome(collection, predicate) {
  5252. var result;
  5253. baseEach(collection, function(value, index, collection2) {
  5254. result = predicate(value, index, collection2);
  5255. return !result;
  5256. });
  5257. return !!result;
  5258. }
  5259. function some(collection, predicate, guard) {
  5260. var func = isArray(collection) ? arraySome : baseSome;
  5261. if (guard && isIterateeCall(collection, predicate, guard)) {
  5262. predicate = void 0;
  5263. }
  5264. return func(collection, baseIteratee(predicate));
  5265. }
  5266. var sortBy = baseRest(function(collection, iteratees) {
  5267. if (collection == null) {
  5268. return [];
  5269. }
  5270. var length = iteratees.length;
  5271. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  5272. iteratees = [];
  5273. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  5274. iteratees = [iteratees[0]];
  5275. }
  5276. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  5277. });
  5278. var MAX_ARRAY_LENGTH$4 = 4294967295;
  5279. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  5280. var nativeFloor = Math.floor;
  5281. var nativeMin$4 = Math.min;
  5282. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5283. var low = 0, high = array == null ? 0 : array.length;
  5284. if (high === 0) {
  5285. return 0;
  5286. }
  5287. value = iteratee(value);
  5288. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  5289. while (low < high) {
  5290. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  5291. if (valIsNaN) {
  5292. var setLow = retHighest || othIsReflexive;
  5293. } else if (valIsUndefined) {
  5294. setLow = othIsReflexive && (retHighest || othIsDefined);
  5295. } else if (valIsNull) {
  5296. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5297. } else if (valIsSymbol) {
  5298. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5299. } else if (othIsNull || othIsSymbol) {
  5300. setLow = false;
  5301. } else {
  5302. setLow = retHighest ? computed <= value : computed < value;
  5303. }
  5304. if (setLow) {
  5305. low = mid + 1;
  5306. } else {
  5307. high = mid;
  5308. }
  5309. }
  5310. return nativeMin$4(high, MAX_ARRAY_INDEX);
  5311. }
  5312. var MAX_ARRAY_LENGTH$3 = 4294967295;
  5313. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  5314. function baseSortedIndex(array, value, retHighest) {
  5315. var low = 0, high = array == null ? low : array.length;
  5316. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5317. while (low < high) {
  5318. var mid = low + high >>> 1, computed = array[mid];
  5319. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  5320. low = mid + 1;
  5321. } else {
  5322. high = mid;
  5323. }
  5324. }
  5325. return high;
  5326. }
  5327. return baseSortedIndexBy(array, value, identity, retHighest);
  5328. }
  5329. function sortedIndex(array, value) {
  5330. return baseSortedIndex(array, value);
  5331. }
  5332. function sortedIndexBy(array, value, iteratee) {
  5333. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  5334. }
  5335. function sortedIndexOf(array, value) {
  5336. var length = array == null ? 0 : array.length;
  5337. if (length) {
  5338. var index = baseSortedIndex(array, value);
  5339. if (index < length && eq(array[index], value)) {
  5340. return index;
  5341. }
  5342. }
  5343. return -1;
  5344. }
  5345. function sortedLastIndex(array, value) {
  5346. return baseSortedIndex(array, value, true);
  5347. }
  5348. function sortedLastIndexBy(array, value, iteratee) {
  5349. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  5350. }
  5351. function sortedLastIndexOf(array, value) {
  5352. var length = array == null ? 0 : array.length;
  5353. if (length) {
  5354. var index = baseSortedIndex(array, value, true) - 1;
  5355. if (eq(array[index], value)) {
  5356. return index;
  5357. }
  5358. }
  5359. return -1;
  5360. }
  5361. function baseSortedUniq(array, iteratee) {
  5362. var index = -1, length = array.length, resIndex = 0, result = [];
  5363. while (++index < length) {
  5364. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5365. if (!index || !eq(computed, seen)) {
  5366. var seen = computed;
  5367. result[resIndex++] = value === 0 ? 0 : value;
  5368. }
  5369. }
  5370. return result;
  5371. }
  5372. function sortedUniq(array) {
  5373. return array && array.length ? baseSortedUniq(array) : [];
  5374. }
  5375. function sortedUniqBy(array, iteratee) {
  5376. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  5377. }
  5378. var MAX_ARRAY_LENGTH$2 = 4294967295;
  5379. function split(string, separator, limit) {
  5380. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  5381. separator = limit = void 0;
  5382. }
  5383. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  5384. if (!limit) {
  5385. return [];
  5386. }
  5387. string = toString(string);
  5388. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  5389. separator = baseToString(separator);
  5390. if (!separator && hasUnicode(string)) {
  5391. return castSlice(stringToArray(string), 0, limit);
  5392. }
  5393. }
  5394. return string.split(separator, limit);
  5395. }
  5396. var FUNC_ERROR_TEXT$1 = "Expected a function";
  5397. var nativeMax$3 = Math.max;
  5398. function spread(func, start) {
  5399. if (typeof func != "function") {
  5400. throw new TypeError(FUNC_ERROR_TEXT$1);
  5401. }
  5402. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  5403. return baseRest(function(args) {
  5404. var array = args[start], otherArgs = castSlice(args, 0, start);
  5405. if (array) {
  5406. arrayPush(otherArgs, array);
  5407. }
  5408. return apply(func, this, otherArgs);
  5409. });
  5410. }
  5411. var startCase = createCompounder(function(result, word, index) {
  5412. return result + (index ? " " : "") + upperFirst(word);
  5413. });
  5414. function startsWith(string, target, position) {
  5415. string = toString(string);
  5416. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  5417. target = baseToString(target);
  5418. return string.slice(position, position + target.length) == target;
  5419. }
  5420. function stubObject() {
  5421. return {};
  5422. }
  5423. function stubString() {
  5424. return "";
  5425. }
  5426. function stubTrue() {
  5427. return true;
  5428. }
  5429. var subtract = createMathOperation(function(minuend, subtrahend) {
  5430. return minuend - subtrahend;
  5431. }, 0);
  5432. function sum$1(array) {
  5433. return array && array.length ? baseSum(array, identity) : 0;
  5434. }
  5435. function sumBy(array, iteratee) {
  5436. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  5437. }
  5438. function tail(array) {
  5439. var length = array == null ? 0 : array.length;
  5440. return length ? baseSlice(array, 1, length) : [];
  5441. }
  5442. function take(array, n, guard) {
  5443. if (!(array && array.length)) {
  5444. return [];
  5445. }
  5446. n = guard || n === void 0 ? 1 : toInteger(n);
  5447. return baseSlice(array, 0, n < 0 ? 0 : n);
  5448. }
  5449. function takeRight(array, n, guard) {
  5450. var length = array == null ? 0 : array.length;
  5451. if (!length) {
  5452. return [];
  5453. }
  5454. n = guard || n === void 0 ? 1 : toInteger(n);
  5455. n = length - n;
  5456. return baseSlice(array, n < 0 ? 0 : n, length);
  5457. }
  5458. function takeRightWhile(array, predicate) {
  5459. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  5460. }
  5461. function takeWhile(array, predicate) {
  5462. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  5463. }
  5464. function tap(value, interceptor) {
  5465. interceptor(value);
  5466. return value;
  5467. }
  5468. var objectProto$2 = Object.prototype;
  5469. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  5470. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5471. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) {
  5472. return srcValue;
  5473. }
  5474. return objValue;
  5475. }
  5476. var stringEscapes = {
  5477. "\\": "\\",
  5478. "'": "'",
  5479. "\n": "n",
  5480. "\r": "r",
  5481. "\u2028": "u2028",
  5482. "\u2029": "u2029"
  5483. };
  5484. function escapeStringChar(chr) {
  5485. return "\\" + stringEscapes[chr];
  5486. }
  5487. var reInterpolate = /<%=([\s\S]+?)%>/g;
  5488. var reEscape = /<%-([\s\S]+?)%>/g;
  5489. var reEvaluate = /<%([\s\S]+?)%>/g;
  5490. var templateSettings = {
  5491. "escape": reEscape,
  5492. "evaluate": reEvaluate,
  5493. "interpolate": reInterpolate,
  5494. "variable": "",
  5495. "imports": {
  5496. "_": { "escape": escape }
  5497. }
  5498. };
  5499. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  5500. var reEmptyStringLeading = /\b__p \+= '';/g;
  5501. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  5502. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  5503. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  5504. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  5505. var reNoMatch = /($^)/;
  5506. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  5507. var objectProto$1 = Object.prototype;
  5508. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  5509. function template(string, options, guard) {
  5510. var settings = templateSettings.imports._.templateSettings || templateSettings;
  5511. if (guard && isIterateeCall(string, options, guard)) {
  5512. options = void 0;
  5513. }
  5514. string = toString(string);
  5515. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  5516. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  5517. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  5518. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  5519. var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  5520. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  5521. interpolateValue || (interpolateValue = esTemplateValue);
  5522. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  5523. if (escapeValue) {
  5524. isEscaping = true;
  5525. source += "' +\n__e(" + escapeValue + ") +\n'";
  5526. }
  5527. if (evaluateValue) {
  5528. isEvaluating = true;
  5529. source += "';\n" + evaluateValue + ";\n__p += '";
  5530. }
  5531. if (interpolateValue) {
  5532. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  5533. }
  5534. index = offset + match.length;
  5535. return match;
  5536. });
  5537. source += "';\n";
  5538. var variable = hasOwnProperty$1.call(options, "variable") && options.variable;
  5539. if (!variable) {
  5540. source = "with (obj) {\n" + source + "\n}\n";
  5541. } else if (reForbiddenIdentifierChars.test(variable)) {
  5542. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  5543. }
  5544. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  5545. 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}";
  5546. var result = attempt(function() {
  5547. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  5548. });
  5549. result.source = source;
  5550. if (isError(result)) {
  5551. throw result;
  5552. }
  5553. return result;
  5554. }
  5555. var FUNC_ERROR_TEXT = "Expected a function";
  5556. function throttle(func, wait, options) {
  5557. var leading = true, trailing = true;
  5558. if (typeof func != "function") {
  5559. throw new TypeError(FUNC_ERROR_TEXT);
  5560. }
  5561. if (isObject(options)) {
  5562. leading = "leading" in options ? !!options.leading : leading;
  5563. trailing = "trailing" in options ? !!options.trailing : trailing;
  5564. }
  5565. return debounce(func, wait, {
  5566. "leading": leading,
  5567. "maxWait": wait,
  5568. "trailing": trailing
  5569. });
  5570. }
  5571. function thru(value, interceptor) {
  5572. return interceptor(value);
  5573. }
  5574. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  5575. var MAX_ARRAY_LENGTH$1 = 4294967295;
  5576. var nativeMin$3 = Math.min;
  5577. function times(n, iteratee) {
  5578. n = toInteger(n);
  5579. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  5580. return [];
  5581. }
  5582. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  5583. iteratee = castFunction(iteratee);
  5584. n -= MAX_ARRAY_LENGTH$1;
  5585. var result = baseTimes(length, iteratee);
  5586. while (++index < n) {
  5587. iteratee(index);
  5588. }
  5589. return result;
  5590. }
  5591. function wrapperToIterator() {
  5592. return this;
  5593. }
  5594. function baseWrapperValue(value, actions) {
  5595. var result = value;
  5596. if (result instanceof LazyWrapper) {
  5597. result = result.value();
  5598. }
  5599. return arrayReduce(actions, function(result2, action) {
  5600. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  5601. }, result);
  5602. }
  5603. function wrapperValue() {
  5604. return baseWrapperValue(this.__wrapped__, this.__actions__);
  5605. }
  5606. function toLower(value) {
  5607. return toString(value).toLowerCase();
  5608. }
  5609. function toPath(value) {
  5610. if (isArray(value)) {
  5611. return arrayMap(value, toKey);
  5612. }
  5613. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  5614. }
  5615. var MAX_SAFE_INTEGER = 9007199254740991;
  5616. function toSafeInteger(value) {
  5617. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  5618. }
  5619. function toUpper(value) {
  5620. return toString(value).toUpperCase();
  5621. }
  5622. function transform(object, iteratee, accumulator) {
  5623. var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  5624. iteratee = baseIteratee(iteratee);
  5625. if (accumulator == null) {
  5626. var Ctor = object && object.constructor;
  5627. if (isArrLike) {
  5628. accumulator = isArr ? new Ctor() : [];
  5629. } else if (isObject(object)) {
  5630. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  5631. } else {
  5632. accumulator = {};
  5633. }
  5634. }
  5635. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  5636. return iteratee(accumulator, value, index, object2);
  5637. });
  5638. return accumulator;
  5639. }
  5640. function charsEndIndex(strSymbols, chrSymbols) {
  5641. var index = strSymbols.length;
  5642. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5643. }
  5644. return index;
  5645. }
  5646. function charsStartIndex(strSymbols, chrSymbols) {
  5647. var index = -1, length = strSymbols.length;
  5648. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5649. }
  5650. return index;
  5651. }
  5652. function trim(string, chars, guard) {
  5653. string = toString(string);
  5654. if (string && (guard || chars === void 0)) {
  5655. return baseTrim(string);
  5656. }
  5657. if (!string || !(chars = baseToString(chars))) {
  5658. return string;
  5659. }
  5660. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  5661. return castSlice(strSymbols, start, end).join("");
  5662. }
  5663. function trimEnd(string, chars, guard) {
  5664. string = toString(string);
  5665. if (string && (guard || chars === void 0)) {
  5666. return string.slice(0, trimmedEndIndex(string) + 1);
  5667. }
  5668. if (!string || !(chars = baseToString(chars))) {
  5669. return string;
  5670. }
  5671. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  5672. return castSlice(strSymbols, 0, end).join("");
  5673. }
  5674. var reTrimStart = /^\s+/;
  5675. function trimStart(string, chars, guard) {
  5676. string = toString(string);
  5677. if (string && (guard || chars === void 0)) {
  5678. return string.replace(reTrimStart, "");
  5679. }
  5680. if (!string || !(chars = baseToString(chars))) {
  5681. return string;
  5682. }
  5683. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  5684. return castSlice(strSymbols, start).join("");
  5685. }
  5686. var DEFAULT_TRUNC_LENGTH = 30;
  5687. var DEFAULT_TRUNC_OMISSION = "...";
  5688. var reFlags = /\w*$/;
  5689. function truncate(string, options) {
  5690. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  5691. if (isObject(options)) {
  5692. var separator = "separator" in options ? options.separator : separator;
  5693. length = "length" in options ? toInteger(options.length) : length;
  5694. omission = "omission" in options ? baseToString(options.omission) : omission;
  5695. }
  5696. string = toString(string);
  5697. var strLength = string.length;
  5698. if (hasUnicode(string)) {
  5699. var strSymbols = stringToArray(string);
  5700. strLength = strSymbols.length;
  5701. }
  5702. if (length >= strLength) {
  5703. return string;
  5704. }
  5705. var end = length - stringSize(omission);
  5706. if (end < 1) {
  5707. return omission;
  5708. }
  5709. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  5710. if (separator === void 0) {
  5711. return result + omission;
  5712. }
  5713. if (strSymbols) {
  5714. end += result.length - end;
  5715. }
  5716. if (isRegExp(separator)) {
  5717. if (string.slice(end).search(separator)) {
  5718. var match, substring = result;
  5719. if (!separator.global) {
  5720. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  5721. }
  5722. separator.lastIndex = 0;
  5723. while (match = separator.exec(substring)) {
  5724. var newEnd = match.index;
  5725. }
  5726. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  5727. }
  5728. } else if (string.indexOf(baseToString(separator), end) != end) {
  5729. var index = result.lastIndexOf(separator);
  5730. if (index > -1) {
  5731. result = result.slice(0, index);
  5732. }
  5733. }
  5734. return result + omission;
  5735. }
  5736. function unary(func) {
  5737. return ary(func, 1);
  5738. }
  5739. var htmlUnescapes = {
  5740. "&amp;": "&",
  5741. "&lt;": "<",
  5742. "&gt;": ">",
  5743. "&quot;": '"',
  5744. "&#39;": "'"
  5745. };
  5746. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  5747. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  5748. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  5749. function unescape(string) {
  5750. string = toString(string);
  5751. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  5752. }
  5753. var INFINITY = 1 / 0;
  5754. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
  5755. return new Set$1(values);
  5756. };
  5757. var LARGE_ARRAY_SIZE = 200;
  5758. function baseUniq(array, iteratee, comparator) {
  5759. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5760. if (comparator) {
  5761. isCommon = false;
  5762. includes = arrayIncludesWith;
  5763. } else if (length >= LARGE_ARRAY_SIZE) {
  5764. var set = iteratee ? null : createSet(array);
  5765. if (set) {
  5766. return setToArray(set);
  5767. }
  5768. isCommon = false;
  5769. includes = cacheHas;
  5770. seen = new SetCache();
  5771. } else {
  5772. seen = iteratee ? [] : result;
  5773. }
  5774. outer:
  5775. while (++index < length) {
  5776. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5777. value = comparator || value !== 0 ? value : 0;
  5778. if (isCommon && computed === computed) {
  5779. var seenIndex = seen.length;
  5780. while (seenIndex--) {
  5781. if (seen[seenIndex] === computed) {
  5782. continue outer;
  5783. }
  5784. }
  5785. if (iteratee) {
  5786. seen.push(computed);
  5787. }
  5788. result.push(value);
  5789. } else if (!includes(seen, computed, comparator)) {
  5790. if (seen !== result) {
  5791. seen.push(computed);
  5792. }
  5793. result.push(value);
  5794. }
  5795. }
  5796. return result;
  5797. }
  5798. var union = baseRest(function(arrays) {
  5799. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5800. });
  5801. var unionBy = baseRest(function(arrays) {
  5802. var iteratee = last(arrays);
  5803. if (isArrayLikeObject(iteratee)) {
  5804. iteratee = void 0;
  5805. }
  5806. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  5807. });
  5808. var unionWith = baseRest(function(arrays) {
  5809. var comparator = last(arrays);
  5810. comparator = typeof comparator == "function" ? comparator : void 0;
  5811. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  5812. });
  5813. function uniq(array) {
  5814. return array && array.length ? baseUniq(array) : [];
  5815. }
  5816. function uniqBy(array, iteratee) {
  5817. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  5818. }
  5819. function uniqWith(array, comparator) {
  5820. comparator = typeof comparator == "function" ? comparator : void 0;
  5821. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  5822. }
  5823. var idCounter = 0;
  5824. function uniqueId(prefix) {
  5825. var id = ++idCounter;
  5826. return toString(prefix) + id;
  5827. }
  5828. function unset(object, path) {
  5829. return object == null ? true : baseUnset(object, path);
  5830. }
  5831. var nativeMax$2 = Math.max;
  5832. function unzip(array) {
  5833. if (!(array && array.length)) {
  5834. return [];
  5835. }
  5836. var length = 0;
  5837. array = arrayFilter(array, function(group) {
  5838. if (isArrayLikeObject(group)) {
  5839. length = nativeMax$2(group.length, length);
  5840. return true;
  5841. }
  5842. });
  5843. return baseTimes(length, function(index) {
  5844. return arrayMap(array, baseProperty(index));
  5845. });
  5846. }
  5847. function unzipWith(array, iteratee) {
  5848. if (!(array && array.length)) {
  5849. return [];
  5850. }
  5851. var result = unzip(array);
  5852. if (iteratee == null) {
  5853. return result;
  5854. }
  5855. return arrayMap(result, function(group) {
  5856. return apply(iteratee, void 0, group);
  5857. });
  5858. }
  5859. function baseUpdate(object, path, updater, customizer) {
  5860. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5861. }
  5862. function update(object, path, updater) {
  5863. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  5864. }
  5865. function updateWith(object, path, updater, customizer) {
  5866. customizer = typeof customizer == "function" ? customizer : void 0;
  5867. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  5868. }
  5869. var upperCase = createCompounder(function(result, word, index) {
  5870. return result + (index ? " " : "") + word.toUpperCase();
  5871. });
  5872. function valuesIn(object) {
  5873. return object == null ? [] : baseValues(object, keysIn(object));
  5874. }
  5875. var without = baseRest(function(array, values) {
  5876. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  5877. });
  5878. function wrap(value, wrapper) {
  5879. return partial(castFunction(wrapper), value);
  5880. }
  5881. var wrapperAt = flatRest(function(paths) {
  5882. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  5883. return baseAt(object, paths);
  5884. };
  5885. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  5886. return this.thru(interceptor);
  5887. }
  5888. value = value.slice(start, +start + (length ? 1 : 0));
  5889. value.__actions__.push({
  5890. "func": thru,
  5891. "args": [interceptor],
  5892. "thisArg": void 0
  5893. });
  5894. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  5895. if (length && !array.length) {
  5896. array.push(void 0);
  5897. }
  5898. return array;
  5899. });
  5900. });
  5901. function wrapperChain() {
  5902. return chain(this);
  5903. }
  5904. function wrapperReverse() {
  5905. var value = this.__wrapped__;
  5906. if (value instanceof LazyWrapper) {
  5907. var wrapped = value;
  5908. if (this.__actions__.length) {
  5909. wrapped = new LazyWrapper(this);
  5910. }
  5911. wrapped = wrapped.reverse();
  5912. wrapped.__actions__.push({
  5913. "func": thru,
  5914. "args": [reverse],
  5915. "thisArg": void 0
  5916. });
  5917. return new LodashWrapper(wrapped, this.__chain__);
  5918. }
  5919. return this.thru(reverse);
  5920. }
  5921. function baseXor(arrays, iteratee, comparator) {
  5922. var length = arrays.length;
  5923. if (length < 2) {
  5924. return length ? baseUniq(arrays[0]) : [];
  5925. }
  5926. var index = -1, result = Array(length);
  5927. while (++index < length) {
  5928. var array = arrays[index], othIndex = -1;
  5929. while (++othIndex < length) {
  5930. if (othIndex != index) {
  5931. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5932. }
  5933. }
  5934. }
  5935. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5936. }
  5937. var xor = baseRest(function(arrays) {
  5938. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  5939. });
  5940. var xorBy = baseRest(function(arrays) {
  5941. var iteratee = last(arrays);
  5942. if (isArrayLikeObject(iteratee)) {
  5943. iteratee = void 0;
  5944. }
  5945. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  5946. });
  5947. var xorWith = baseRest(function(arrays) {
  5948. var comparator = last(arrays);
  5949. comparator = typeof comparator == "function" ? comparator : void 0;
  5950. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  5951. });
  5952. var zip = baseRest(unzip);
  5953. function baseZipObject(props, values, assignFunc) {
  5954. var index = -1, length = props.length, valsLength = values.length, result = {};
  5955. while (++index < length) {
  5956. var value = index < valsLength ? values[index] : void 0;
  5957. assignFunc(result, props[index], value);
  5958. }
  5959. return result;
  5960. }
  5961. function zipObject(props, values) {
  5962. return baseZipObject(props || [], values || [], assignValue);
  5963. }
  5964. function zipObjectDeep(props, values) {
  5965. return baseZipObject(props || [], values || [], baseSet);
  5966. }
  5967. var zipWith = baseRest(function(arrays) {
  5968. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  5969. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  5970. return unzipWith(arrays, iteratee);
  5971. });
  5972. var array = {
  5973. chunk,
  5974. compact,
  5975. concat,
  5976. difference,
  5977. differenceBy,
  5978. differenceWith,
  5979. drop,
  5980. dropRight,
  5981. dropRightWhile,
  5982. dropWhile,
  5983. fill,
  5984. findIndex,
  5985. findLastIndex,
  5986. first: head,
  5987. flatten,
  5988. flattenDeep,
  5989. flattenDepth,
  5990. fromPairs,
  5991. head,
  5992. indexOf,
  5993. initial,
  5994. intersection,
  5995. intersectionBy,
  5996. intersectionWith,
  5997. join,
  5998. last,
  5999. lastIndexOf,
  6000. nth,
  6001. pull,
  6002. pullAll,
  6003. pullAllBy,
  6004. pullAllWith,
  6005. pullAt,
  6006. remove,
  6007. reverse,
  6008. slice,
  6009. sortedIndex,
  6010. sortedIndexBy,
  6011. sortedIndexOf,
  6012. sortedLastIndex,
  6013. sortedLastIndexBy,
  6014. sortedLastIndexOf,
  6015. sortedUniq,
  6016. sortedUniqBy,
  6017. tail,
  6018. take,
  6019. takeRight,
  6020. takeRightWhile,
  6021. takeWhile,
  6022. union,
  6023. unionBy,
  6024. unionWith,
  6025. uniq,
  6026. uniqBy,
  6027. uniqWith,
  6028. unzip,
  6029. unzipWith,
  6030. without,
  6031. xor,
  6032. xorBy,
  6033. xorWith,
  6034. zip,
  6035. zipObject,
  6036. zipObjectDeep,
  6037. zipWith
  6038. };
  6039. var collection = {
  6040. countBy,
  6041. each: forEach,
  6042. eachRight: forEachRight,
  6043. every,
  6044. filter,
  6045. find,
  6046. findLast,
  6047. flatMap,
  6048. flatMapDeep,
  6049. flatMapDepth,
  6050. forEach,
  6051. forEachRight,
  6052. groupBy,
  6053. includes,
  6054. invokeMap,
  6055. keyBy,
  6056. map,
  6057. orderBy: orderBy$1,
  6058. partition,
  6059. reduce,
  6060. reduceRight,
  6061. reject,
  6062. sample,
  6063. sampleSize,
  6064. shuffle,
  6065. size,
  6066. some,
  6067. sortBy
  6068. };
  6069. var date$1 = {
  6070. now
  6071. };
  6072. var func = {
  6073. after,
  6074. ary,
  6075. before,
  6076. bind,
  6077. bindKey,
  6078. curry,
  6079. curryRight,
  6080. debounce,
  6081. defer,
  6082. delay,
  6083. flip,
  6084. memoize,
  6085. negate,
  6086. once,
  6087. overArgs,
  6088. partial,
  6089. partialRight,
  6090. rearg,
  6091. rest,
  6092. spread,
  6093. throttle,
  6094. unary,
  6095. wrap
  6096. };
  6097. var lang = {
  6098. castArray: castArray$1,
  6099. clone,
  6100. cloneDeep,
  6101. cloneDeepWith,
  6102. cloneWith,
  6103. conformsTo,
  6104. eq,
  6105. gt: gt$1,
  6106. gte,
  6107. isArguments,
  6108. isArray,
  6109. isArrayBuffer,
  6110. isArrayLike,
  6111. isArrayLikeObject,
  6112. isBoolean,
  6113. isBuffer,
  6114. isDate,
  6115. isElement: isElement$2,
  6116. isEmpty: isEmpty$1,
  6117. isEqual: isEqual$1,
  6118. isEqualWith,
  6119. isError,
  6120. isFinite,
  6121. isFunction,
  6122. isInteger,
  6123. isLength,
  6124. isMap,
  6125. isMatch,
  6126. isMatchWith,
  6127. isNaN: isNaN$1,
  6128. isNative,
  6129. isNil,
  6130. isNull,
  6131. isNumber,
  6132. isObject,
  6133. isObjectLike,
  6134. isPlainObject,
  6135. isRegExp,
  6136. isSafeInteger,
  6137. isSet,
  6138. isString,
  6139. isSymbol,
  6140. isTypedArray,
  6141. isUndefined: isUndefined$1,
  6142. isWeakMap,
  6143. isWeakSet,
  6144. lt: lt$1,
  6145. lte,
  6146. toArray,
  6147. toFinite,
  6148. toInteger,
  6149. toLength,
  6150. toNumber,
  6151. toPlainObject,
  6152. toSafeInteger,
  6153. toString
  6154. };
  6155. var math = {
  6156. add,
  6157. ceil,
  6158. divide,
  6159. floor: floor$1,
  6160. max: max$3,
  6161. maxBy,
  6162. mean,
  6163. meanBy,
  6164. min: min$3,
  6165. minBy,
  6166. multiply,
  6167. round: round$1,
  6168. subtract,
  6169. sum: sum$1,
  6170. sumBy
  6171. };
  6172. var number = {
  6173. clamp,
  6174. inRange,
  6175. random
  6176. };
  6177. var object = {
  6178. assign,
  6179. assignIn,
  6180. assignInWith,
  6181. assignWith,
  6182. at: at$1,
  6183. create,
  6184. defaults,
  6185. defaultsDeep,
  6186. entries: toPairs,
  6187. entriesIn: toPairsIn,
  6188. extend: assignIn,
  6189. extendWith: assignInWith,
  6190. findKey,
  6191. findLastKey,
  6192. forIn,
  6193. forInRight,
  6194. forOwn,
  6195. forOwnRight,
  6196. functions,
  6197. functionsIn,
  6198. get,
  6199. has,
  6200. hasIn,
  6201. invert,
  6202. invertBy,
  6203. invoke,
  6204. keys,
  6205. keysIn,
  6206. mapKeys,
  6207. mapValues,
  6208. merge,
  6209. mergeWith,
  6210. omit,
  6211. omitBy,
  6212. pick,
  6213. pickBy,
  6214. result,
  6215. set,
  6216. setWith,
  6217. toPairs,
  6218. toPairsIn,
  6219. transform,
  6220. unset,
  6221. update,
  6222. updateWith,
  6223. values,
  6224. valuesIn
  6225. };
  6226. var seq = {
  6227. at: wrapperAt,
  6228. chain,
  6229. commit: wrapperCommit,
  6230. lodash,
  6231. next: wrapperNext,
  6232. plant: wrapperPlant,
  6233. reverse: wrapperReverse,
  6234. tap,
  6235. thru,
  6236. toIterator: wrapperToIterator,
  6237. toJSON: wrapperValue,
  6238. value: wrapperValue,
  6239. valueOf: wrapperValue,
  6240. wrapperChain
  6241. };
  6242. var string$1 = {
  6243. camelCase,
  6244. capitalize: capitalize$1,
  6245. deburr,
  6246. endsWith,
  6247. escape,
  6248. escapeRegExp,
  6249. kebabCase,
  6250. lowerCase,
  6251. lowerFirst,
  6252. pad,
  6253. padEnd,
  6254. padStart,
  6255. parseInt: parseInt$1,
  6256. repeat,
  6257. replace,
  6258. snakeCase,
  6259. split,
  6260. startCase,
  6261. startsWith,
  6262. template,
  6263. templateSettings,
  6264. toLower,
  6265. toUpper,
  6266. trim,
  6267. trimEnd,
  6268. trimStart,
  6269. truncate,
  6270. unescape,
  6271. upperCase,
  6272. upperFirst,
  6273. words
  6274. };
  6275. var util = {
  6276. attempt,
  6277. bindAll,
  6278. cond,
  6279. conforms,
  6280. constant,
  6281. defaultTo,
  6282. flow,
  6283. flowRight,
  6284. identity,
  6285. iteratee,
  6286. matches,
  6287. matchesProperty,
  6288. method,
  6289. methodOf,
  6290. mixin: mixin$1,
  6291. noop,
  6292. nthArg,
  6293. over,
  6294. overEvery,
  6295. overSome,
  6296. property,
  6297. propertyOf,
  6298. range: range$1,
  6299. rangeRight,
  6300. stubArray,
  6301. stubFalse,
  6302. stubObject,
  6303. stubString,
  6304. stubTrue,
  6305. times,
  6306. toPath,
  6307. uniqueId
  6308. };
  6309. function lazyClone() {
  6310. var result = new LazyWrapper(this.__wrapped__);
  6311. result.__actions__ = copyArray(this.__actions__);
  6312. result.__dir__ = this.__dir__;
  6313. result.__filtered__ = this.__filtered__;
  6314. result.__iteratees__ = copyArray(this.__iteratees__);
  6315. result.__takeCount__ = this.__takeCount__;
  6316. result.__views__ = copyArray(this.__views__);
  6317. return result;
  6318. }
  6319. function lazyReverse() {
  6320. if (this.__filtered__) {
  6321. var result = new LazyWrapper(this);
  6322. result.__dir__ = -1;
  6323. result.__filtered__ = true;
  6324. } else {
  6325. result = this.clone();
  6326. result.__dir__ *= -1;
  6327. }
  6328. return result;
  6329. }
  6330. var nativeMax$1 = Math.max;
  6331. var nativeMin$2 = Math.min;
  6332. function getView(start, end, transforms) {
  6333. var index = -1, length = transforms.length;
  6334. while (++index < length) {
  6335. var data = transforms[index], size = data.size;
  6336. switch (data.type) {
  6337. case "drop":
  6338. start += size;
  6339. break;
  6340. case "dropRight":
  6341. end -= size;
  6342. break;
  6343. case "take":
  6344. end = nativeMin$2(end, start + size);
  6345. break;
  6346. case "takeRight":
  6347. start = nativeMax$1(start, end - size);
  6348. break;
  6349. }
  6350. }
  6351. return { "start": start, "end": end };
  6352. }
  6353. var LAZY_FILTER_FLAG$1 = 1;
  6354. var LAZY_MAP_FLAG = 2;
  6355. var nativeMin$1 = Math.min;
  6356. function lazyValue() {
  6357. 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__);
  6358. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  6359. return baseWrapperValue(array, this.__actions__);
  6360. }
  6361. var result = [];
  6362. outer:
  6363. while (length-- && resIndex < takeCount) {
  6364. index += dir;
  6365. var iterIndex = -1, value = array[index];
  6366. while (++iterIndex < iterLength) {
  6367. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  6368. if (type == LAZY_MAP_FLAG) {
  6369. value = computed;
  6370. } else if (!computed) {
  6371. if (type == LAZY_FILTER_FLAG$1) {
  6372. continue outer;
  6373. } else {
  6374. break outer;
  6375. }
  6376. }
  6377. }
  6378. result[resIndex++] = value;
  6379. }
  6380. return result;
  6381. }
  6382. var VERSION = "4.17.21";
  6383. var WRAP_BIND_KEY_FLAG = 2;
  6384. var LAZY_FILTER_FLAG = 1;
  6385. var LAZY_WHILE_FLAG = 3;
  6386. var MAX_ARRAY_LENGTH = 4294967295;
  6387. var arrayProto = Array.prototype;
  6388. var objectProto = Object.prototype;
  6389. var hasOwnProperty = objectProto.hasOwnProperty;
  6390. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  6391. var nativeMax = Math.max;
  6392. var nativeMin = Math.min;
  6393. var mixin = function(func2) {
  6394. return function(object2, source, options) {
  6395. if (options == null) {
  6396. var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  6397. if (!(methodNames ? methodNames.length : isObj)) {
  6398. options = source;
  6399. source = object2;
  6400. object2 = this;
  6401. }
  6402. }
  6403. return func2(object2, source, options);
  6404. };
  6405. }(mixin$1);
  6406. lodash.after = func.after;
  6407. lodash.ary = func.ary;
  6408. lodash.assign = object.assign;
  6409. lodash.assignIn = object.assignIn;
  6410. lodash.assignInWith = object.assignInWith;
  6411. lodash.assignWith = object.assignWith;
  6412. lodash.at = object.at;
  6413. lodash.before = func.before;
  6414. lodash.bind = func.bind;
  6415. lodash.bindAll = util.bindAll;
  6416. lodash.bindKey = func.bindKey;
  6417. lodash.castArray = lang.castArray;
  6418. lodash.chain = seq.chain;
  6419. lodash.chunk = array.chunk;
  6420. lodash.compact = array.compact;
  6421. lodash.concat = array.concat;
  6422. lodash.cond = util.cond;
  6423. lodash.conforms = util.conforms;
  6424. lodash.constant = util.constant;
  6425. lodash.countBy = collection.countBy;
  6426. lodash.create = object.create;
  6427. lodash.curry = func.curry;
  6428. lodash.curryRight = func.curryRight;
  6429. lodash.debounce = func.debounce;
  6430. lodash.defaults = object.defaults;
  6431. lodash.defaultsDeep = object.defaultsDeep;
  6432. lodash.defer = func.defer;
  6433. lodash.delay = func.delay;
  6434. lodash.difference = array.difference;
  6435. lodash.differenceBy = array.differenceBy;
  6436. lodash.differenceWith = array.differenceWith;
  6437. lodash.drop = array.drop;
  6438. lodash.dropRight = array.dropRight;
  6439. lodash.dropRightWhile = array.dropRightWhile;
  6440. lodash.dropWhile = array.dropWhile;
  6441. lodash.fill = array.fill;
  6442. lodash.filter = collection.filter;
  6443. lodash.flatMap = collection.flatMap;
  6444. lodash.flatMapDeep = collection.flatMapDeep;
  6445. lodash.flatMapDepth = collection.flatMapDepth;
  6446. lodash.flatten = array.flatten;
  6447. lodash.flattenDeep = array.flattenDeep;
  6448. lodash.flattenDepth = array.flattenDepth;
  6449. lodash.flip = func.flip;
  6450. lodash.flow = util.flow;
  6451. lodash.flowRight = util.flowRight;
  6452. lodash.fromPairs = array.fromPairs;
  6453. lodash.functions = object.functions;
  6454. lodash.functionsIn = object.functionsIn;
  6455. lodash.groupBy = collection.groupBy;
  6456. lodash.initial = array.initial;
  6457. lodash.intersection = array.intersection;
  6458. lodash.intersectionBy = array.intersectionBy;
  6459. lodash.intersectionWith = array.intersectionWith;
  6460. lodash.invert = object.invert;
  6461. lodash.invertBy = object.invertBy;
  6462. lodash.invokeMap = collection.invokeMap;
  6463. lodash.iteratee = util.iteratee;
  6464. lodash.keyBy = collection.keyBy;
  6465. lodash.keys = keys;
  6466. lodash.keysIn = object.keysIn;
  6467. lodash.map = collection.map;
  6468. lodash.mapKeys = object.mapKeys;
  6469. lodash.mapValues = object.mapValues;
  6470. lodash.matches = util.matches;
  6471. lodash.matchesProperty = util.matchesProperty;
  6472. lodash.memoize = func.memoize;
  6473. lodash.merge = object.merge;
  6474. lodash.mergeWith = object.mergeWith;
  6475. lodash.method = util.method;
  6476. lodash.methodOf = util.methodOf;
  6477. lodash.mixin = mixin;
  6478. lodash.negate = negate;
  6479. lodash.nthArg = util.nthArg;
  6480. lodash.omit = object.omit;
  6481. lodash.omitBy = object.omitBy;
  6482. lodash.once = func.once;
  6483. lodash.orderBy = collection.orderBy;
  6484. lodash.over = util.over;
  6485. lodash.overArgs = func.overArgs;
  6486. lodash.overEvery = util.overEvery;
  6487. lodash.overSome = util.overSome;
  6488. lodash.partial = func.partial;
  6489. lodash.partialRight = func.partialRight;
  6490. lodash.partition = collection.partition;
  6491. lodash.pick = object.pick;
  6492. lodash.pickBy = object.pickBy;
  6493. lodash.property = util.property;
  6494. lodash.propertyOf = util.propertyOf;
  6495. lodash.pull = array.pull;
  6496. lodash.pullAll = array.pullAll;
  6497. lodash.pullAllBy = array.pullAllBy;
  6498. lodash.pullAllWith = array.pullAllWith;
  6499. lodash.pullAt = array.pullAt;
  6500. lodash.range = util.range;
  6501. lodash.rangeRight = util.rangeRight;
  6502. lodash.rearg = func.rearg;
  6503. lodash.reject = collection.reject;
  6504. lodash.remove = array.remove;
  6505. lodash.rest = func.rest;
  6506. lodash.reverse = array.reverse;
  6507. lodash.sampleSize = collection.sampleSize;
  6508. lodash.set = object.set;
  6509. lodash.setWith = object.setWith;
  6510. lodash.shuffle = collection.shuffle;
  6511. lodash.slice = array.slice;
  6512. lodash.sortBy = collection.sortBy;
  6513. lodash.sortedUniq = array.sortedUniq;
  6514. lodash.sortedUniqBy = array.sortedUniqBy;
  6515. lodash.split = string$1.split;
  6516. lodash.spread = func.spread;
  6517. lodash.tail = array.tail;
  6518. lodash.take = array.take;
  6519. lodash.takeRight = array.takeRight;
  6520. lodash.takeRightWhile = array.takeRightWhile;
  6521. lodash.takeWhile = array.takeWhile;
  6522. lodash.tap = seq.tap;
  6523. lodash.throttle = func.throttle;
  6524. lodash.thru = thru;
  6525. lodash.toArray = lang.toArray;
  6526. lodash.toPairs = object.toPairs;
  6527. lodash.toPairsIn = object.toPairsIn;
  6528. lodash.toPath = util.toPath;
  6529. lodash.toPlainObject = lang.toPlainObject;
  6530. lodash.transform = object.transform;
  6531. lodash.unary = func.unary;
  6532. lodash.union = array.union;
  6533. lodash.unionBy = array.unionBy;
  6534. lodash.unionWith = array.unionWith;
  6535. lodash.uniq = array.uniq;
  6536. lodash.uniqBy = array.uniqBy;
  6537. lodash.uniqWith = array.uniqWith;
  6538. lodash.unset = object.unset;
  6539. lodash.unzip = array.unzip;
  6540. lodash.unzipWith = array.unzipWith;
  6541. lodash.update = object.update;
  6542. lodash.updateWith = object.updateWith;
  6543. lodash.values = object.values;
  6544. lodash.valuesIn = object.valuesIn;
  6545. lodash.without = array.without;
  6546. lodash.words = string$1.words;
  6547. lodash.wrap = func.wrap;
  6548. lodash.xor = array.xor;
  6549. lodash.xorBy = array.xorBy;
  6550. lodash.xorWith = array.xorWith;
  6551. lodash.zip = array.zip;
  6552. lodash.zipObject = array.zipObject;
  6553. lodash.zipObjectDeep = array.zipObjectDeep;
  6554. lodash.zipWith = array.zipWith;
  6555. lodash.entries = object.toPairs;
  6556. lodash.entriesIn = object.toPairsIn;
  6557. lodash.extend = object.assignIn;
  6558. lodash.extendWith = object.assignInWith;
  6559. mixin(lodash, lodash);
  6560. lodash.add = math.add;
  6561. lodash.attempt = util.attempt;
  6562. lodash.camelCase = string$1.camelCase;
  6563. lodash.capitalize = string$1.capitalize;
  6564. lodash.ceil = math.ceil;
  6565. lodash.clamp = number.clamp;
  6566. lodash.clone = lang.clone;
  6567. lodash.cloneDeep = lang.cloneDeep;
  6568. lodash.cloneDeepWith = lang.cloneDeepWith;
  6569. lodash.cloneWith = lang.cloneWith;
  6570. lodash.conformsTo = lang.conformsTo;
  6571. lodash.deburr = string$1.deburr;
  6572. lodash.defaultTo = util.defaultTo;
  6573. lodash.divide = math.divide;
  6574. lodash.endsWith = string$1.endsWith;
  6575. lodash.eq = lang.eq;
  6576. lodash.escape = string$1.escape;
  6577. lodash.escapeRegExp = string$1.escapeRegExp;
  6578. lodash.every = collection.every;
  6579. lodash.find = collection.find;
  6580. lodash.findIndex = array.findIndex;
  6581. lodash.findKey = object.findKey;
  6582. lodash.findLast = collection.findLast;
  6583. lodash.findLastIndex = array.findLastIndex;
  6584. lodash.findLastKey = object.findLastKey;
  6585. lodash.floor = math.floor;
  6586. lodash.forEach = collection.forEach;
  6587. lodash.forEachRight = collection.forEachRight;
  6588. lodash.forIn = object.forIn;
  6589. lodash.forInRight = object.forInRight;
  6590. lodash.forOwn = object.forOwn;
  6591. lodash.forOwnRight = object.forOwnRight;
  6592. lodash.get = object.get;
  6593. lodash.gt = lang.gt;
  6594. lodash.gte = lang.gte;
  6595. lodash.has = object.has;
  6596. lodash.hasIn = object.hasIn;
  6597. lodash.head = array.head;
  6598. lodash.identity = identity;
  6599. lodash.includes = collection.includes;
  6600. lodash.indexOf = array.indexOf;
  6601. lodash.inRange = number.inRange;
  6602. lodash.invoke = object.invoke;
  6603. lodash.isArguments = lang.isArguments;
  6604. lodash.isArray = isArray;
  6605. lodash.isArrayBuffer = lang.isArrayBuffer;
  6606. lodash.isArrayLike = lang.isArrayLike;
  6607. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  6608. lodash.isBoolean = lang.isBoolean;
  6609. lodash.isBuffer = lang.isBuffer;
  6610. lodash.isDate = lang.isDate;
  6611. lodash.isElement = lang.isElement;
  6612. lodash.isEmpty = lang.isEmpty;
  6613. lodash.isEqual = lang.isEqual;
  6614. lodash.isEqualWith = lang.isEqualWith;
  6615. lodash.isError = lang.isError;
  6616. lodash.isFinite = lang.isFinite;
  6617. lodash.isFunction = lang.isFunction;
  6618. lodash.isInteger = lang.isInteger;
  6619. lodash.isLength = lang.isLength;
  6620. lodash.isMap = lang.isMap;
  6621. lodash.isMatch = lang.isMatch;
  6622. lodash.isMatchWith = lang.isMatchWith;
  6623. lodash.isNaN = lang.isNaN;
  6624. lodash.isNative = lang.isNative;
  6625. lodash.isNil = lang.isNil;
  6626. lodash.isNull = lang.isNull;
  6627. lodash.isNumber = lang.isNumber;
  6628. lodash.isObject = isObject;
  6629. lodash.isObjectLike = lang.isObjectLike;
  6630. lodash.isPlainObject = lang.isPlainObject;
  6631. lodash.isRegExp = lang.isRegExp;
  6632. lodash.isSafeInteger = lang.isSafeInteger;
  6633. lodash.isSet = lang.isSet;
  6634. lodash.isString = lang.isString;
  6635. lodash.isSymbol = lang.isSymbol;
  6636. lodash.isTypedArray = lang.isTypedArray;
  6637. lodash.isUndefined = lang.isUndefined;
  6638. lodash.isWeakMap = lang.isWeakMap;
  6639. lodash.isWeakSet = lang.isWeakSet;
  6640. lodash.join = array.join;
  6641. lodash.kebabCase = string$1.kebabCase;
  6642. lodash.last = last;
  6643. lodash.lastIndexOf = array.lastIndexOf;
  6644. lodash.lowerCase = string$1.lowerCase;
  6645. lodash.lowerFirst = string$1.lowerFirst;
  6646. lodash.lt = lang.lt;
  6647. lodash.lte = lang.lte;
  6648. lodash.max = math.max;
  6649. lodash.maxBy = math.maxBy;
  6650. lodash.mean = math.mean;
  6651. lodash.meanBy = math.meanBy;
  6652. lodash.min = math.min;
  6653. lodash.minBy = math.minBy;
  6654. lodash.stubArray = util.stubArray;
  6655. lodash.stubFalse = util.stubFalse;
  6656. lodash.stubObject = util.stubObject;
  6657. lodash.stubString = util.stubString;
  6658. lodash.stubTrue = util.stubTrue;
  6659. lodash.multiply = math.multiply;
  6660. lodash.nth = array.nth;
  6661. lodash.noop = util.noop;
  6662. lodash.now = date$1.now;
  6663. lodash.pad = string$1.pad;
  6664. lodash.padEnd = string$1.padEnd;
  6665. lodash.padStart = string$1.padStart;
  6666. lodash.parseInt = string$1.parseInt;
  6667. lodash.random = number.random;
  6668. lodash.reduce = collection.reduce;
  6669. lodash.reduceRight = collection.reduceRight;
  6670. lodash.repeat = string$1.repeat;
  6671. lodash.replace = string$1.replace;
  6672. lodash.result = object.result;
  6673. lodash.round = math.round;
  6674. lodash.sample = collection.sample;
  6675. lodash.size = collection.size;
  6676. lodash.snakeCase = string$1.snakeCase;
  6677. lodash.some = collection.some;
  6678. lodash.sortedIndex = array.sortedIndex;
  6679. lodash.sortedIndexBy = array.sortedIndexBy;
  6680. lodash.sortedIndexOf = array.sortedIndexOf;
  6681. lodash.sortedLastIndex = array.sortedLastIndex;
  6682. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  6683. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  6684. lodash.startCase = string$1.startCase;
  6685. lodash.startsWith = string$1.startsWith;
  6686. lodash.subtract = math.subtract;
  6687. lodash.sum = math.sum;
  6688. lodash.sumBy = math.sumBy;
  6689. lodash.template = string$1.template;
  6690. lodash.times = util.times;
  6691. lodash.toFinite = lang.toFinite;
  6692. lodash.toInteger = toInteger;
  6693. lodash.toLength = lang.toLength;
  6694. lodash.toLower = string$1.toLower;
  6695. lodash.toNumber = lang.toNumber;
  6696. lodash.toSafeInteger = lang.toSafeInteger;
  6697. lodash.toString = lang.toString;
  6698. lodash.toUpper = string$1.toUpper;
  6699. lodash.trim = string$1.trim;
  6700. lodash.trimEnd = string$1.trimEnd;
  6701. lodash.trimStart = string$1.trimStart;
  6702. lodash.truncate = string$1.truncate;
  6703. lodash.unescape = string$1.unescape;
  6704. lodash.uniqueId = util.uniqueId;
  6705. lodash.upperCase = string$1.upperCase;
  6706. lodash.upperFirst = string$1.upperFirst;
  6707. lodash.each = collection.forEach;
  6708. lodash.eachRight = collection.forEachRight;
  6709. lodash.first = array.head;
  6710. mixin(lodash, function() {
  6711. var source = {};
  6712. baseForOwn(lodash, function(func2, methodName) {
  6713. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  6714. source[methodName] = func2;
  6715. }
  6716. });
  6717. return source;
  6718. }(), { "chain": false });
  6719. lodash.VERSION = VERSION;
  6720. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  6721. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  6722. lodash[methodName].placeholder = lodash;
  6723. });
  6724. arrayEach(["drop", "take"], function(methodName, index) {
  6725. LazyWrapper.prototype[methodName] = function(n) {
  6726. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  6727. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  6728. if (result.__filtered__) {
  6729. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  6730. } else {
  6731. result.__views__.push({
  6732. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  6733. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  6734. });
  6735. }
  6736. return result;
  6737. };
  6738. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  6739. return this.reverse()[methodName](n).reverse();
  6740. };
  6741. });
  6742. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  6743. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  6744. LazyWrapper.prototype[methodName] = function(iteratee) {
  6745. var result = this.clone();
  6746. result.__iteratees__.push({
  6747. "iteratee": baseIteratee(iteratee),
  6748. "type": type
  6749. });
  6750. result.__filtered__ = result.__filtered__ || isFilter;
  6751. return result;
  6752. };
  6753. });
  6754. arrayEach(["head", "last"], function(methodName, index) {
  6755. var takeName = "take" + (index ? "Right" : "");
  6756. LazyWrapper.prototype[methodName] = function() {
  6757. return this[takeName](1).value()[0];
  6758. };
  6759. });
  6760. arrayEach(["initial", "tail"], function(methodName, index) {
  6761. var dropName = "drop" + (index ? "" : "Right");
  6762. LazyWrapper.prototype[methodName] = function() {
  6763. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  6764. };
  6765. });
  6766. LazyWrapper.prototype.compact = function() {
  6767. return this.filter(identity);
  6768. };
  6769. LazyWrapper.prototype.find = function(predicate) {
  6770. return this.filter(predicate).head();
  6771. };
  6772. LazyWrapper.prototype.findLast = function(predicate) {
  6773. return this.reverse().find(predicate);
  6774. };
  6775. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  6776. if (typeof path == "function") {
  6777. return new LazyWrapper(this);
  6778. }
  6779. return this.map(function(value) {
  6780. return baseInvoke(value, path, args);
  6781. });
  6782. });
  6783. LazyWrapper.prototype.reject = function(predicate) {
  6784. return this.filter(negate(baseIteratee(predicate)));
  6785. };
  6786. LazyWrapper.prototype.slice = function(start, end) {
  6787. start = toInteger(start);
  6788. var result = this;
  6789. if (result.__filtered__ && (start > 0 || end < 0)) {
  6790. return new LazyWrapper(result);
  6791. }
  6792. if (start < 0) {
  6793. result = result.takeRight(-start);
  6794. } else if (start) {
  6795. result = result.drop(start);
  6796. }
  6797. if (end !== void 0) {
  6798. end = toInteger(end);
  6799. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  6800. }
  6801. return result;
  6802. };
  6803. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  6804. return this.reverse().takeWhile(predicate).reverse();
  6805. };
  6806. LazyWrapper.prototype.toArray = function() {
  6807. return this.take(MAX_ARRAY_LENGTH);
  6808. };
  6809. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6810. 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);
  6811. if (!lodashFunc) {
  6812. return;
  6813. }
  6814. lodash.prototype[methodName] = function() {
  6815. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value);
  6816. var interceptor = function(value2) {
  6817. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  6818. return isTaker && chainAll ? result2[0] : result2;
  6819. };
  6820. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  6821. isLazy = useLazy = false;
  6822. }
  6823. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  6824. if (!retUnwrapped && useLazy) {
  6825. value = onlyLazy ? value : new LazyWrapper(this);
  6826. var result = func2.apply(value, args);
  6827. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  6828. return new LodashWrapper(result, chainAll);
  6829. }
  6830. if (isUnwrapped && onlyLazy) {
  6831. return func2.apply(this, args);
  6832. }
  6833. result = this.thru(interceptor);
  6834. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  6835. };
  6836. });
  6837. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  6838. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  6839. lodash.prototype[methodName] = function() {
  6840. var args = arguments;
  6841. if (retUnwrapped && !this.__chain__) {
  6842. var value = this.value();
  6843. return func2.apply(isArray(value) ? value : [], args);
  6844. }
  6845. return this[chainName](function(value2) {
  6846. return func2.apply(isArray(value2) ? value2 : [], args);
  6847. });
  6848. };
  6849. });
  6850. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6851. var lodashFunc = lodash[methodName];
  6852. if (lodashFunc) {
  6853. var key = lodashFunc.name + "";
  6854. if (!hasOwnProperty.call(realNames, key)) {
  6855. realNames[key] = [];
  6856. }
  6857. realNames[key].push({ "name": methodName, "func": lodashFunc });
  6858. }
  6859. });
  6860. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  6861. "name": "wrapper",
  6862. "func": void 0
  6863. }];
  6864. LazyWrapper.prototype.clone = lazyClone;
  6865. LazyWrapper.prototype.reverse = lazyReverse;
  6866. LazyWrapper.prototype.value = lazyValue;
  6867. lodash.prototype.at = seq.at;
  6868. lodash.prototype.chain = seq.wrapperChain;
  6869. lodash.prototype.commit = seq.commit;
  6870. lodash.prototype.next = seq.next;
  6871. lodash.prototype.plant = seq.plant;
  6872. lodash.prototype.reverse = seq.reverse;
  6873. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  6874. lodash.prototype.first = lodash.prototype.head;
  6875. if (symIterator) {
  6876. lodash.prototype[symIterator] = seq.toIterator;
  6877. }
  6878. /**
  6879. * @license
  6880. * Lodash (Custom Build) <https://lodash.com/>
  6881. * Build: `lodash modularize exports="es" -o ./`
  6882. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  6883. * Released under MIT license <https://lodash.com/license>
  6884. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6885. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6886. */
  6887. const isUndefined = (val) => val === void 0;
  6888. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  6889. const isElement$1 = (e) => {
  6890. if (typeof Element === "undefined")
  6891. return false;
  6892. return e instanceof Element;
  6893. };
  6894. const isPropAbsent = (prop) => {
  6895. return isNil(prop);
  6896. };
  6897. const isStringNumber = (val) => {
  6898. if (!isString$1(val)) {
  6899. return false;
  6900. }
  6901. return !Number.isNaN(Number(val));
  6902. };
  6903. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  6904. const capitalize = (str) => capitalize$2(str);
  6905. const keysOf = (arr) => Object.keys(arr);
  6906. const entriesOf = (arr) => Object.entries(arr);
  6907. const getProp = (obj, path, defaultValue) => {
  6908. return {
  6909. get value() {
  6910. return get(obj, path, defaultValue);
  6911. },
  6912. set value(val) {
  6913. set(obj, path, val);
  6914. }
  6915. };
  6916. };
  6917. class ElementPlusError extends Error {
  6918. constructor(m) {
  6919. super(m);
  6920. this.name = "ElementPlusError";
  6921. }
  6922. }
  6923. function throwError(scope, m) {
  6924. throw new ElementPlusError(`[${scope}] ${m}`);
  6925. }
  6926. function debugWarn(scope, message) {
  6927. }
  6928. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  6929. const hasClass = (el, cls) => {
  6930. if (!el || !cls)
  6931. return false;
  6932. if (cls.includes(" "))
  6933. throw new Error("className should not contain space.");
  6934. return el.classList.contains(cls);
  6935. };
  6936. const addClass = (el, cls) => {
  6937. if (!el || !cls.trim())
  6938. return;
  6939. el.classList.add(...classNameToArray(cls));
  6940. };
  6941. const removeClass = (el, cls) => {
  6942. if (!el || !cls.trim())
  6943. return;
  6944. el.classList.remove(...classNameToArray(cls));
  6945. };
  6946. const getStyle = (element, styleName) => {
  6947. var _a;
  6948. if (!isClient || !element || !styleName)
  6949. return "";
  6950. let key = camelize(styleName);
  6951. if (key === "float")
  6952. key = "cssFloat";
  6953. try {
  6954. const style = element.style[key];
  6955. if (style)
  6956. return style;
  6957. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  6958. return computed ? computed[key] : "";
  6959. } catch (e) {
  6960. return element.style[key];
  6961. }
  6962. };
  6963. function addUnit(value, defaultUnit = "px") {
  6964. if (!value)
  6965. return "";
  6966. if (isNumber$1(value) || isStringNumber(value)) {
  6967. return `${value}${defaultUnit}`;
  6968. } else if (isString$1(value)) {
  6969. return value;
  6970. }
  6971. }
  6972. const isScroll = (el, isVertical) => {
  6973. if (!isClient)
  6974. return false;
  6975. const key = {
  6976. undefined: "overflow",
  6977. true: "overflow-y",
  6978. false: "overflow-x"
  6979. }[String(isVertical)];
  6980. const overflow = getStyle(el, key);
  6981. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  6982. };
  6983. const getScrollContainer = (el, isVertical) => {
  6984. if (!isClient)
  6985. return;
  6986. let parent = el;
  6987. while (parent) {
  6988. if ([window, document, document.documentElement].includes(parent))
  6989. return window;
  6990. if (isScroll(parent, isVertical))
  6991. return parent;
  6992. parent = parent.parentNode;
  6993. }
  6994. return parent;
  6995. };
  6996. let scrollBarWidth;
  6997. const getScrollBarWidth = (namespace) => {
  6998. var _a;
  6999. if (!isClient)
  7000. return 0;
  7001. if (scrollBarWidth !== void 0)
  7002. return scrollBarWidth;
  7003. const outer = document.createElement("div");
  7004. outer.className = `${namespace}-scrollbar__wrap`;
  7005. outer.style.visibility = "hidden";
  7006. outer.style.width = "100px";
  7007. outer.style.position = "absolute";
  7008. outer.style.top = "-9999px";
  7009. document.body.appendChild(outer);
  7010. const widthNoScroll = outer.offsetWidth;
  7011. outer.style.overflow = "scroll";
  7012. const inner = document.createElement("div");
  7013. inner.style.width = "100%";
  7014. outer.appendChild(inner);
  7015. const widthWithScroll = inner.offsetWidth;
  7016. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7017. scrollBarWidth = widthNoScroll - widthWithScroll;
  7018. return scrollBarWidth;
  7019. };
  7020. function scrollIntoView(container, selected) {
  7021. if (!isClient)
  7022. return;
  7023. if (!selected) {
  7024. container.scrollTop = 0;
  7025. return;
  7026. }
  7027. const offsetParents = [];
  7028. let pointer = selected.offsetParent;
  7029. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7030. offsetParents.push(pointer);
  7031. pointer = pointer.offsetParent;
  7032. }
  7033. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7034. const bottom = top + selected.offsetHeight;
  7035. const viewRectTop = container.scrollTop;
  7036. const viewRectBottom = viewRectTop + container.clientHeight;
  7037. if (top < viewRectTop) {
  7038. container.scrollTop = top;
  7039. } else if (bottom > viewRectBottom) {
  7040. container.scrollTop = bottom - container.clientHeight;
  7041. }
  7042. }
  7043. let target = !isClient ? void 0 : document.body;
  7044. function createGlobalNode(id) {
  7045. const el = document.createElement("div");
  7046. if (id !== void 0) {
  7047. el.setAttribute("id", id);
  7048. }
  7049. target.appendChild(el);
  7050. return el;
  7051. }
  7052. function removeGlobalNode(el) {
  7053. el.remove();
  7054. }
  7055. var export_helper_default = (sfc, props) => {
  7056. let target = sfc.__vccOpts || sfc;
  7057. for (let [key, val] of props)
  7058. target[key] = val;
  7059. return target;
  7060. };
  7061. var _sfc_main6 = {
  7062. name: "ArrowDown"
  7063. };
  7064. var _hoisted_16$1 = {
  7065. viewBox: "0 0 1024 1024",
  7066. xmlns: "http://www.w3.org/2000/svg"
  7067. };
  7068. var _hoisted_26 = /* @__PURE__ */ vue.createElementVNode("path", {
  7069. fill: "currentColor",
  7070. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  7071. }, null, -1);
  7072. var _hoisted_36 = [
  7073. _hoisted_26
  7074. ];
  7075. function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
  7076. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_16$1, _hoisted_36);
  7077. }
  7078. var arrow_down_default = /* @__PURE__ */ export_helper_default(_sfc_main6, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]);
  7079. var _sfc_main8 = {
  7080. name: "ArrowLeft"
  7081. };
  7082. var _hoisted_18$1 = {
  7083. viewBox: "0 0 1024 1024",
  7084. xmlns: "http://www.w3.org/2000/svg"
  7085. };
  7086. var _hoisted_28 = /* @__PURE__ */ vue.createElementVNode("path", {
  7087. fill: "currentColor",
  7088. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  7089. }, null, -1);
  7090. var _hoisted_38 = [
  7091. _hoisted_28
  7092. ];
  7093. function _sfc_render8(_ctx, _cache, $props, $setup, $data, $options) {
  7094. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_18$1, _hoisted_38);
  7095. }
  7096. var arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main8, [["render", _sfc_render8], ["__file", "arrow-left.vue"]]);
  7097. var _sfc_main10 = {
  7098. name: "ArrowRight"
  7099. };
  7100. var _hoisted_110 = {
  7101. viewBox: "0 0 1024 1024",
  7102. xmlns: "http://www.w3.org/2000/svg"
  7103. };
  7104. var _hoisted_210 = /* @__PURE__ */ vue.createElementVNode("path", {
  7105. fill: "currentColor",
  7106. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  7107. }, null, -1);
  7108. var _hoisted_310 = [
  7109. _hoisted_210
  7110. ];
  7111. function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) {
  7112. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_110, _hoisted_310);
  7113. }
  7114. var arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main10, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]);
  7115. var _sfc_main12 = {
  7116. name: "ArrowUp"
  7117. };
  7118. var _hoisted_112 = {
  7119. viewBox: "0 0 1024 1024",
  7120. xmlns: "http://www.w3.org/2000/svg"
  7121. };
  7122. var _hoisted_212 = /* @__PURE__ */ vue.createElementVNode("path", {
  7123. fill: "currentColor",
  7124. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
  7125. }, null, -1);
  7126. var _hoisted_312 = [
  7127. _hoisted_212
  7128. ];
  7129. function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) {
  7130. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_112, _hoisted_312);
  7131. }
  7132. var arrow_up_default = /* @__PURE__ */ export_helper_default(_sfc_main12, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]);
  7133. var _sfc_main14 = {
  7134. name: "Back"
  7135. };
  7136. var _hoisted_114 = {
  7137. viewBox: "0 0 1024 1024",
  7138. xmlns: "http://www.w3.org/2000/svg"
  7139. };
  7140. var _hoisted_214 = /* @__PURE__ */ vue.createElementVNode("path", {
  7141. fill: "currentColor",
  7142. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64z"
  7143. }, null, -1);
  7144. var _hoisted_314 = /* @__PURE__ */ vue.createElementVNode("path", {
  7145. fill: "currentColor",
  7146. d: "m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312L237.248 512z"
  7147. }, null, -1);
  7148. var _hoisted_44 = [
  7149. _hoisted_214,
  7150. _hoisted_314
  7151. ];
  7152. function _sfc_render14(_ctx, _cache, $props, $setup, $data, $options) {
  7153. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_114, _hoisted_44);
  7154. }
  7155. var back_default = /* @__PURE__ */ export_helper_default(_sfc_main14, [["render", _sfc_render14], ["__file", "back.vue"]]);
  7156. var _sfc_main29 = {
  7157. name: "Calendar"
  7158. };
  7159. var _hoisted_129 = {
  7160. viewBox: "0 0 1024 1024",
  7161. xmlns: "http://www.w3.org/2000/svg"
  7162. };
  7163. var _hoisted_229 = /* @__PURE__ */ vue.createElementVNode("path", {
  7164. fill: "currentColor",
  7165. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z"
  7166. }, null, -1);
  7167. var _hoisted_328 = [
  7168. _hoisted_229
  7169. ];
  7170. function _sfc_render29(_ctx, _cache, $props, $setup, $data, $options) {
  7171. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_129, _hoisted_328);
  7172. }
  7173. var calendar_default = /* @__PURE__ */ export_helper_default(_sfc_main29, [["render", _sfc_render29], ["__file", "calendar.vue"]]);
  7174. var _sfc_main34 = {
  7175. name: "CaretRight"
  7176. };
  7177. var _hoisted_134 = {
  7178. viewBox: "0 0 1024 1024",
  7179. xmlns: "http://www.w3.org/2000/svg"
  7180. };
  7181. var _hoisted_234 = /* @__PURE__ */ vue.createElementVNode("path", {
  7182. fill: "currentColor",
  7183. d: "M384 192v640l384-320.064z"
  7184. }, null, -1);
  7185. var _hoisted_333 = [
  7186. _hoisted_234
  7187. ];
  7188. function _sfc_render34(_ctx, _cache, $props, $setup, $data, $options) {
  7189. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_134, _hoisted_333);
  7190. }
  7191. var caret_right_default = /* @__PURE__ */ export_helper_default(_sfc_main34, [["render", _sfc_render34], ["__file", "caret-right.vue"]]);
  7192. var _sfc_main35 = {
  7193. name: "CaretTop"
  7194. };
  7195. var _hoisted_135 = {
  7196. viewBox: "0 0 1024 1024",
  7197. xmlns: "http://www.w3.org/2000/svg"
  7198. };
  7199. var _hoisted_235 = /* @__PURE__ */ vue.createElementVNode("path", {
  7200. fill: "currentColor",
  7201. d: "M512 320 192 704h639.936z"
  7202. }, null, -1);
  7203. var _hoisted_334 = [
  7204. _hoisted_235
  7205. ];
  7206. function _sfc_render35(_ctx, _cache, $props, $setup, $data, $options) {
  7207. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_135, _hoisted_334);
  7208. }
  7209. var caret_top_default = /* @__PURE__ */ export_helper_default(_sfc_main35, [["render", _sfc_render35], ["__file", "caret-top.vue"]]);
  7210. var _sfc_main43 = {
  7211. name: "Check"
  7212. };
  7213. var _hoisted_143 = {
  7214. viewBox: "0 0 1024 1024",
  7215. xmlns: "http://www.w3.org/2000/svg"
  7216. };
  7217. var _hoisted_243 = /* @__PURE__ */ vue.createElementVNode("path", {
  7218. fill: "currentColor",
  7219. d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
  7220. }, null, -1);
  7221. var _hoisted_342 = [
  7222. _hoisted_243
  7223. ];
  7224. function _sfc_render43(_ctx, _cache, $props, $setup, $data, $options) {
  7225. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_143, _hoisted_342);
  7226. }
  7227. var check_default = /* @__PURE__ */ export_helper_default(_sfc_main43, [["render", _sfc_render43], ["__file", "check.vue"]]);
  7228. var _sfc_main47 = {
  7229. name: "CircleCheckFilled"
  7230. };
  7231. var _hoisted_147 = {
  7232. viewBox: "0 0 1024 1024",
  7233. xmlns: "http://www.w3.org/2000/svg"
  7234. };
  7235. var _hoisted_247 = /* @__PURE__ */ vue.createElementVNode("path", {
  7236. fill: "currentColor",
  7237. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"
  7238. }, null, -1);
  7239. var _hoisted_346 = [
  7240. _hoisted_247
  7241. ];
  7242. function _sfc_render47(_ctx, _cache, $props, $setup, $data, $options) {
  7243. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_147, _hoisted_346);
  7244. }
  7245. var circle_check_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main47, [["render", _sfc_render47], ["__file", "circle-check-filled.vue"]]);
  7246. var _sfc_main48 = {
  7247. name: "CircleCheck"
  7248. };
  7249. var _hoisted_148 = {
  7250. viewBox: "0 0 1024 1024",
  7251. xmlns: "http://www.w3.org/2000/svg"
  7252. };
  7253. var _hoisted_248 = /* @__PURE__ */ vue.createElementVNode("path", {
  7254. fill: "currentColor",
  7255. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7256. }, null, -1);
  7257. var _hoisted_347 = /* @__PURE__ */ vue.createElementVNode("path", {
  7258. fill: "currentColor",
  7259. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  7260. }, null, -1);
  7261. var _hoisted_414 = [
  7262. _hoisted_248,
  7263. _hoisted_347
  7264. ];
  7265. function _sfc_render48(_ctx, _cache, $props, $setup, $data, $options) {
  7266. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_148, _hoisted_414);
  7267. }
  7268. var circle_check_default = /* @__PURE__ */ export_helper_default(_sfc_main48, [["render", _sfc_render48], ["__file", "circle-check.vue"]]);
  7269. var _sfc_main49 = {
  7270. name: "CircleCloseFilled"
  7271. };
  7272. var _hoisted_149 = {
  7273. viewBox: "0 0 1024 1024",
  7274. xmlns: "http://www.w3.org/2000/svg"
  7275. };
  7276. var _hoisted_249 = /* @__PURE__ */ vue.createElementVNode("path", {
  7277. fill: "currentColor",
  7278. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"
  7279. }, null, -1);
  7280. var _hoisted_348 = [
  7281. _hoisted_249
  7282. ];
  7283. function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
  7284. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_149, _hoisted_348);
  7285. }
  7286. var circle_close_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main49, [["render", _sfc_render49], ["__file", "circle-close-filled.vue"]]);
  7287. var _sfc_main50 = {
  7288. name: "CircleClose"
  7289. };
  7290. var _hoisted_150 = {
  7291. viewBox: "0 0 1024 1024",
  7292. xmlns: "http://www.w3.org/2000/svg"
  7293. };
  7294. var _hoisted_250 = /* @__PURE__ */ vue.createElementVNode("path", {
  7295. fill: "currentColor",
  7296. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
  7297. }, null, -1);
  7298. var _hoisted_349 = /* @__PURE__ */ vue.createElementVNode("path", {
  7299. fill: "currentColor",
  7300. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7301. }, null, -1);
  7302. var _hoisted_415 = [
  7303. _hoisted_250,
  7304. _hoisted_349
  7305. ];
  7306. function _sfc_render50(_ctx, _cache, $props, $setup, $data, $options) {
  7307. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_150, _hoisted_415);
  7308. }
  7309. var circle_close_default = /* @__PURE__ */ export_helper_default(_sfc_main50, [["render", _sfc_render50], ["__file", "circle-close.vue"]]);
  7310. var _sfc_main53 = {
  7311. name: "Clock"
  7312. };
  7313. var _hoisted_153 = {
  7314. viewBox: "0 0 1024 1024",
  7315. xmlns: "http://www.w3.org/2000/svg"
  7316. };
  7317. var _hoisted_253 = /* @__PURE__ */ vue.createElementVNode("path", {
  7318. fill: "currentColor",
  7319. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7320. }, null, -1);
  7321. var _hoisted_352 = /* @__PURE__ */ vue.createElementVNode("path", {
  7322. fill: "currentColor",
  7323. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  7324. }, null, -1);
  7325. var _hoisted_417 = /* @__PURE__ */ vue.createElementVNode("path", {
  7326. fill: "currentColor",
  7327. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  7328. }, null, -1);
  7329. var _hoisted_55 = [
  7330. _hoisted_253,
  7331. _hoisted_352,
  7332. _hoisted_417
  7333. ];
  7334. function _sfc_render53(_ctx, _cache, $props, $setup, $data, $options) {
  7335. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_153, _hoisted_55);
  7336. }
  7337. var clock_default = /* @__PURE__ */ export_helper_default(_sfc_main53, [["render", _sfc_render53], ["__file", "clock.vue"]]);
  7338. var _sfc_main55 = {
  7339. name: "Close"
  7340. };
  7341. var _hoisted_155 = {
  7342. viewBox: "0 0 1024 1024",
  7343. xmlns: "http://www.w3.org/2000/svg"
  7344. };
  7345. var _hoisted_255 = /* @__PURE__ */ vue.createElementVNode("path", {
  7346. fill: "currentColor",
  7347. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  7348. }, null, -1);
  7349. var _hoisted_354 = [
  7350. _hoisted_255
  7351. ];
  7352. function _sfc_render55(_ctx, _cache, $props, $setup, $data, $options) {
  7353. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_155, _hoisted_354);
  7354. }
  7355. var close_default = /* @__PURE__ */ export_helper_default(_sfc_main55, [["render", _sfc_render55], ["__file", "close.vue"]]);
  7356. var _sfc_main71 = {
  7357. name: "DArrowLeft"
  7358. };
  7359. var _hoisted_171 = {
  7360. viewBox: "0 0 1024 1024",
  7361. xmlns: "http://www.w3.org/2000/svg"
  7362. };
  7363. var _hoisted_271 = /* @__PURE__ */ vue.createElementVNode("path", {
  7364. fill: "currentColor",
  7365. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  7366. }, null, -1);
  7367. var _hoisted_370 = [
  7368. _hoisted_271
  7369. ];
  7370. function _sfc_render71(_ctx, _cache, $props, $setup, $data, $options) {
  7371. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_171, _hoisted_370);
  7372. }
  7373. var d_arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main71, [["render", _sfc_render71], ["__file", "d-arrow-left.vue"]]);
  7374. var _sfc_main72 = {
  7375. name: "DArrowRight"
  7376. };
  7377. var _hoisted_172 = {
  7378. viewBox: "0 0 1024 1024",
  7379. xmlns: "http://www.w3.org/2000/svg"
  7380. };
  7381. var _hoisted_272 = /* @__PURE__ */ vue.createElementVNode("path", {
  7382. fill: "currentColor",
  7383. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688zm-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  7384. }, null, -1);
  7385. var _hoisted_371 = [
  7386. _hoisted_272
  7387. ];
  7388. function _sfc_render72(_ctx, _cache, $props, $setup, $data, $options) {
  7389. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_172, _hoisted_371);
  7390. }
  7391. var d_arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main72, [["render", _sfc_render72], ["__file", "d-arrow-right.vue"]]);
  7392. var _sfc_main79 = {
  7393. name: "Delete"
  7394. };
  7395. var _hoisted_179 = {
  7396. viewBox: "0 0 1024 1024",
  7397. xmlns: "http://www.w3.org/2000/svg"
  7398. };
  7399. var _hoisted_279 = /* @__PURE__ */ vue.createElementVNode("path", {
  7400. fill: "currentColor",
  7401. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  7402. }, null, -1);
  7403. var _hoisted_378 = [
  7404. _hoisted_279
  7405. ];
  7406. function _sfc_render79(_ctx, _cache, $props, $setup, $data, $options) {
  7407. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_179, _hoisted_378);
  7408. }
  7409. var delete_default = /* @__PURE__ */ export_helper_default(_sfc_main79, [["render", _sfc_render79], ["__file", "delete.vue"]]);
  7410. var _sfc_main89 = {
  7411. name: "Document"
  7412. };
  7413. var _hoisted_189 = {
  7414. viewBox: "0 0 1024 1024",
  7415. xmlns: "http://www.w3.org/2000/svg"
  7416. };
  7417. var _hoisted_289 = /* @__PURE__ */ vue.createElementVNode("path", {
  7418. fill: "currentColor",
  7419. d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
  7420. }, null, -1);
  7421. var _hoisted_388 = [
  7422. _hoisted_289
  7423. ];
  7424. function _sfc_render89(_ctx, _cache, $props, $setup, $data, $options) {
  7425. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_189, _hoisted_388);
  7426. }
  7427. var document_default = /* @__PURE__ */ export_helper_default(_sfc_main89, [["render", _sfc_render89], ["__file", "document.vue"]]);
  7428. var _sfc_main117 = {
  7429. name: "FullScreen"
  7430. };
  7431. var _hoisted_1117 = {
  7432. viewBox: "0 0 1024 1024",
  7433. xmlns: "http://www.w3.org/2000/svg"
  7434. };
  7435. var _hoisted_2117 = /* @__PURE__ */ vue.createElementVNode("path", {
  7436. fill: "currentColor",
  7437. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z"
  7438. }, null, -1);
  7439. var _hoisted_3116 = [
  7440. _hoisted_2117
  7441. ];
  7442. function _sfc_render117(_ctx, _cache, $props, $setup, $data, $options) {
  7443. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1117, _hoisted_3116);
  7444. }
  7445. var full_screen_default = /* @__PURE__ */ export_helper_default(_sfc_main117, [["render", _sfc_render117], ["__file", "full-screen.vue"]]);
  7446. var _sfc_main130 = {
  7447. name: "Hide"
  7448. };
  7449. var _hoisted_1130 = {
  7450. viewBox: "0 0 1024 1024",
  7451. xmlns: "http://www.w3.org/2000/svg"
  7452. };
  7453. var _hoisted_2130 = /* @__PURE__ */ vue.createElementVNode("path", {
  7454. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z",
  7455. fill: "currentColor"
  7456. }, null, -1);
  7457. var _hoisted_3129 = /* @__PURE__ */ vue.createElementVNode("path", {
  7458. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z",
  7459. fill: "currentColor"
  7460. }, null, -1);
  7461. var _hoisted_436 = [
  7462. _hoisted_2130,
  7463. _hoisted_3129
  7464. ];
  7465. function _sfc_render130(_ctx, _cache, $props, $setup, $data, $options) {
  7466. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1130, _hoisted_436);
  7467. }
  7468. var hide_default = /* @__PURE__ */ export_helper_default(_sfc_main130, [["render", _sfc_render130], ["__file", "hide.vue"]]);
  7469. var _sfc_main140 = {
  7470. name: "InfoFilled"
  7471. };
  7472. var _hoisted_1140 = {
  7473. viewBox: "0 0 1024 1024",
  7474. xmlns: "http://www.w3.org/2000/svg"
  7475. };
  7476. var _hoisted_2140 = /* @__PURE__ */ vue.createElementVNode("path", {
  7477. fill: "currentColor",
  7478. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
  7479. }, null, -1);
  7480. var _hoisted_3139 = [
  7481. _hoisted_2140
  7482. ];
  7483. function _sfc_render140(_ctx, _cache, $props, $setup, $data, $options) {
  7484. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1140, _hoisted_3139);
  7485. }
  7486. var info_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main140, [["render", _sfc_render140], ["__file", "info-filled.vue"]]);
  7487. var _sfc_main147 = {
  7488. name: "Loading"
  7489. };
  7490. var _hoisted_1147 = {
  7491. viewBox: "0 0 1024 1024",
  7492. xmlns: "http://www.w3.org/2000/svg"
  7493. };
  7494. var _hoisted_2147 = /* @__PURE__ */ vue.createElementVNode("path", {
  7495. fill: "currentColor",
  7496. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  7497. }, null, -1);
  7498. var _hoisted_3146 = [
  7499. _hoisted_2147
  7500. ];
  7501. function _sfc_render147(_ctx, _cache, $props, $setup, $data, $options) {
  7502. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1147, _hoisted_3146);
  7503. }
  7504. var loading_default = /* @__PURE__ */ export_helper_default(_sfc_main147, [["render", _sfc_render147], ["__file", "loading.vue"]]);
  7505. var _sfc_main165 = {
  7506. name: "Minus"
  7507. };
  7508. var _hoisted_1165 = {
  7509. viewBox: "0 0 1024 1024",
  7510. xmlns: "http://www.w3.org/2000/svg"
  7511. };
  7512. var _hoisted_2165 = /* @__PURE__ */ vue.createElementVNode("path", {
  7513. fill: "currentColor",
  7514. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  7515. }, null, -1);
  7516. var _hoisted_3164 = [
  7517. _hoisted_2165
  7518. ];
  7519. function _sfc_render165(_ctx, _cache, $props, $setup, $data, $options) {
  7520. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1165, _hoisted_3164);
  7521. }
  7522. var minus_default = /* @__PURE__ */ export_helper_default(_sfc_main165, [["render", _sfc_render165], ["__file", "minus.vue"]]);
  7523. var _sfc_main170 = {
  7524. name: "MoreFilled"
  7525. };
  7526. var _hoisted_1170 = {
  7527. viewBox: "0 0 1024 1024",
  7528. xmlns: "http://www.w3.org/2000/svg"
  7529. };
  7530. var _hoisted_2170 = /* @__PURE__ */ vue.createElementVNode("path", {
  7531. fill: "currentColor",
  7532. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224z"
  7533. }, null, -1);
  7534. var _hoisted_3169 = [
  7535. _hoisted_2170
  7536. ];
  7537. function _sfc_render170(_ctx, _cache, $props, $setup, $data, $options) {
  7538. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1170, _hoisted_3169);
  7539. }
  7540. var more_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main170, [["render", _sfc_render170], ["__file", "more-filled.vue"]]);
  7541. var _sfc_main171 = {
  7542. name: "More"
  7543. };
  7544. var _hoisted_1171 = {
  7545. viewBox: "0 0 1024 1024",
  7546. xmlns: "http://www.w3.org/2000/svg"
  7547. };
  7548. var _hoisted_2171 = /* @__PURE__ */ vue.createElementVNode("path", {
  7549. fill: "currentColor",
  7550. d: "M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96z"
  7551. }, null, -1);
  7552. var _hoisted_3170 = [
  7553. _hoisted_2171
  7554. ];
  7555. function _sfc_render171(_ctx, _cache, $props, $setup, $data, $options) {
  7556. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1171, _hoisted_3170);
  7557. }
  7558. var more_default = /* @__PURE__ */ export_helper_default(_sfc_main171, [["render", _sfc_render171], ["__file", "more.vue"]]);
  7559. var _sfc_main191 = {
  7560. name: "PictureFilled"
  7561. };
  7562. var _hoisted_1191 = {
  7563. viewBox: "0 0 1024 1024",
  7564. xmlns: "http://www.w3.org/2000/svg"
  7565. };
  7566. var _hoisted_2191 = /* @__PURE__ */ vue.createElementVNode("path", {
  7567. fill: "currentColor",
  7568. d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32H96zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112zM256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384z"
  7569. }, null, -1);
  7570. var _hoisted_3190 = [
  7571. _hoisted_2191
  7572. ];
  7573. function _sfc_render191(_ctx, _cache, $props, $setup, $data, $options) {
  7574. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1191, _hoisted_3190);
  7575. }
  7576. var picture_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main191, [["render", _sfc_render191], ["__file", "picture-filled.vue"]]);
  7577. var _sfc_main197 = {
  7578. name: "Plus"
  7579. };
  7580. var _hoisted_1197 = {
  7581. viewBox: "0 0 1024 1024",
  7582. xmlns: "http://www.w3.org/2000/svg"
  7583. };
  7584. var _hoisted_2197 = /* @__PURE__ */ vue.createElementVNode("path", {
  7585. fill: "currentColor",
  7586. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
  7587. }, null, -1);
  7588. var _hoisted_3196 = [
  7589. _hoisted_2197
  7590. ];
  7591. function _sfc_render197(_ctx, _cache, $props, $setup, $data, $options) {
  7592. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1197, _hoisted_3196);
  7593. }
  7594. var plus_default = /* @__PURE__ */ export_helper_default(_sfc_main197, [["render", _sfc_render197], ["__file", "plus.vue"]]);
  7595. var _sfc_main206 = {
  7596. name: "QuestionFilled"
  7597. };
  7598. var _hoisted_1206 = {
  7599. viewBox: "0 0 1024 1024",
  7600. xmlns: "http://www.w3.org/2000/svg"
  7601. };
  7602. var _hoisted_2206 = /* @__PURE__ */ vue.createElementVNode("path", {
  7603. fill: "currentColor",
  7604. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z"
  7605. }, null, -1);
  7606. var _hoisted_3205 = [
  7607. _hoisted_2206
  7608. ];
  7609. function _sfc_render206(_ctx, _cache, $props, $setup, $data, $options) {
  7610. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1206, _hoisted_3205);
  7611. }
  7612. var question_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main206, [["render", _sfc_render206], ["__file", "question-filled.vue"]]);
  7613. var _sfc_main210 = {
  7614. name: "RefreshLeft"
  7615. };
  7616. var _hoisted_1210 = {
  7617. viewBox: "0 0 1024 1024",
  7618. xmlns: "http://www.w3.org/2000/svg"
  7619. };
  7620. var _hoisted_2210 = /* @__PURE__ */ vue.createElementVNode("path", {
  7621. fill: "currentColor",
  7622. d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"
  7623. }, null, -1);
  7624. var _hoisted_3209 = [
  7625. _hoisted_2210
  7626. ];
  7627. function _sfc_render210(_ctx, _cache, $props, $setup, $data, $options) {
  7628. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1210, _hoisted_3209);
  7629. }
  7630. var refresh_left_default = /* @__PURE__ */ export_helper_default(_sfc_main210, [["render", _sfc_render210], ["__file", "refresh-left.vue"]]);
  7631. var _sfc_main211 = {
  7632. name: "RefreshRight"
  7633. };
  7634. var _hoisted_1211 = {
  7635. viewBox: "0 0 1024 1024",
  7636. xmlns: "http://www.w3.org/2000/svg"
  7637. };
  7638. var _hoisted_2211 = /* @__PURE__ */ vue.createElementVNode("path", {
  7639. fill: "currentColor",
  7640. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  7641. }, null, -1);
  7642. var _hoisted_3210 = [
  7643. _hoisted_2211
  7644. ];
  7645. function _sfc_render211(_ctx, _cache, $props, $setup, $data, $options) {
  7646. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1211, _hoisted_3210);
  7647. }
  7648. var refresh_right_default = /* @__PURE__ */ export_helper_default(_sfc_main211, [["render", _sfc_render211], ["__file", "refresh-right.vue"]]);
  7649. var _sfc_main217 = {
  7650. name: "ScaleToOriginal"
  7651. };
  7652. var _hoisted_1217 = {
  7653. viewBox: "0 0 1024 1024",
  7654. xmlns: "http://www.w3.org/2000/svg"
  7655. };
  7656. var _hoisted_2217 = /* @__PURE__ */ vue.createElementVNode("path", {
  7657. fill: "currentColor",
  7658. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zM512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412zM512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512z"
  7659. }, null, -1);
  7660. var _hoisted_3216 = [
  7661. _hoisted_2217
  7662. ];
  7663. function _sfc_render217(_ctx, _cache, $props, $setup, $data, $options) {
  7664. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1217, _hoisted_3216);
  7665. }
  7666. var scale_to_original_default = /* @__PURE__ */ export_helper_default(_sfc_main217, [["render", _sfc_render217], ["__file", "scale-to-original.vue"]]);
  7667. var _sfc_main220 = {
  7668. name: "Search"
  7669. };
  7670. var _hoisted_1220 = {
  7671. viewBox: "0 0 1024 1024",
  7672. xmlns: "http://www.w3.org/2000/svg"
  7673. };
  7674. var _hoisted_2220 = /* @__PURE__ */ vue.createElementVNode("path", {
  7675. fill: "currentColor",
  7676. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704z"
  7677. }, null, -1);
  7678. var _hoisted_3219 = [
  7679. _hoisted_2220
  7680. ];
  7681. function _sfc_render220(_ctx, _cache, $props, $setup, $data, $options) {
  7682. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1220, _hoisted_3219);
  7683. }
  7684. var search_default = /* @__PURE__ */ export_helper_default(_sfc_main220, [["render", _sfc_render220], ["__file", "search.vue"]]);
  7685. var _sfc_main236 = {
  7686. name: "SortDown"
  7687. };
  7688. var _hoisted_1236 = {
  7689. viewBox: "0 0 1024 1024",
  7690. xmlns: "http://www.w3.org/2000/svg"
  7691. };
  7692. var _hoisted_2236 = /* @__PURE__ */ vue.createElementVNode("path", {
  7693. fill: "currentColor",
  7694. d: "M576 96v709.568L333.312 562.816A32 32 0 1 0 288 608l297.408 297.344A32 32 0 0 0 640 882.688V96a32 32 0 0 0-64 0z"
  7695. }, null, -1);
  7696. var _hoisted_3235 = [
  7697. _hoisted_2236
  7698. ];
  7699. function _sfc_render236(_ctx, _cache, $props, $setup, $data, $options) {
  7700. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1236, _hoisted_3235);
  7701. }
  7702. var sort_down_default = /* @__PURE__ */ export_helper_default(_sfc_main236, [["render", _sfc_render236], ["__file", "sort-down.vue"]]);
  7703. var _sfc_main237 = {
  7704. name: "SortUp"
  7705. };
  7706. var _hoisted_1237 = {
  7707. viewBox: "0 0 1024 1024",
  7708. xmlns: "http://www.w3.org/2000/svg"
  7709. };
  7710. var _hoisted_2237 = /* @__PURE__ */ vue.createElementVNode("path", {
  7711. fill: "currentColor",
  7712. d: "M384 141.248V928a32 32 0 1 0 64 0V218.56l242.688 242.688A32 32 0 1 0 736 416L438.592 118.656A32 32 0 0 0 384 141.248z"
  7713. }, null, -1);
  7714. var _hoisted_3236 = [
  7715. _hoisted_2237
  7716. ];
  7717. function _sfc_render237(_ctx, _cache, $props, $setup, $data, $options) {
  7718. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1237, _hoisted_3236);
  7719. }
  7720. var sort_up_default = /* @__PURE__ */ export_helper_default(_sfc_main237, [["render", _sfc_render237], ["__file", "sort-up.vue"]]);
  7721. var _sfc_main240 = {
  7722. name: "StarFilled"
  7723. };
  7724. var _hoisted_1240 = {
  7725. viewBox: "0 0 1024 1024",
  7726. xmlns: "http://www.w3.org/2000/svg"
  7727. };
  7728. var _hoisted_2240 = /* @__PURE__ */ vue.createElementVNode("path", {
  7729. fill: "currentColor",
  7730. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  7731. }, null, -1);
  7732. var _hoisted_3239 = [
  7733. _hoisted_2240
  7734. ];
  7735. function _sfc_render240(_ctx, _cache, $props, $setup, $data, $options) {
  7736. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1240, _hoisted_3239);
  7737. }
  7738. var star_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main240, [["render", _sfc_render240], ["__file", "star-filled.vue"]]);
  7739. var _sfc_main241 = {
  7740. name: "Star"
  7741. };
  7742. var _hoisted_1241 = {
  7743. viewBox: "0 0 1024 1024",
  7744. xmlns: "http://www.w3.org/2000/svg"
  7745. };
  7746. var _hoisted_2241 = /* @__PURE__ */ vue.createElementVNode("path", {
  7747. fill: "currentColor",
  7748. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  7749. }, null, -1);
  7750. var _hoisted_3240 = [
  7751. _hoisted_2241
  7752. ];
  7753. function _sfc_render241(_ctx, _cache, $props, $setup, $data, $options) {
  7754. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1241, _hoisted_3240);
  7755. }
  7756. var star_default = /* @__PURE__ */ export_helper_default(_sfc_main241, [["render", _sfc_render241], ["__file", "star.vue"]]);
  7757. var _sfc_main243 = {
  7758. name: "SuccessFilled"
  7759. };
  7760. var _hoisted_1243 = {
  7761. viewBox: "0 0 1024 1024",
  7762. xmlns: "http://www.w3.org/2000/svg"
  7763. };
  7764. var _hoisted_2243 = /* @__PURE__ */ vue.createElementVNode("path", {
  7765. fill: "currentColor",
  7766. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"
  7767. }, null, -1);
  7768. var _hoisted_3242 = [
  7769. _hoisted_2243
  7770. ];
  7771. function _sfc_render243(_ctx, _cache, $props, $setup, $data, $options) {
  7772. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1243, _hoisted_3242);
  7773. }
  7774. var success_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main243, [["render", _sfc_render243], ["__file", "success-filled.vue"]]);
  7775. var _sfc_main274 = {
  7776. name: "View"
  7777. };
  7778. var _hoisted_1274 = {
  7779. viewBox: "0 0 1024 1024",
  7780. xmlns: "http://www.w3.org/2000/svg"
  7781. };
  7782. var _hoisted_2274 = /* @__PURE__ */ vue.createElementVNode("path", {
  7783. fill: "currentColor",
  7784. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  7785. }, null, -1);
  7786. var _hoisted_3273 = [
  7787. _hoisted_2274
  7788. ];
  7789. function _sfc_render274(_ctx, _cache, $props, $setup, $data, $options) {
  7790. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1274, _hoisted_3273);
  7791. }
  7792. var view_default = /* @__PURE__ */ export_helper_default(_sfc_main274, [["render", _sfc_render274], ["__file", "view.vue"]]);
  7793. var _sfc_main277 = {
  7794. name: "WarningFilled"
  7795. };
  7796. var _hoisted_1277 = {
  7797. viewBox: "0 0 1024 1024",
  7798. xmlns: "http://www.w3.org/2000/svg"
  7799. };
  7800. var _hoisted_2277 = /* @__PURE__ */ vue.createElementVNode("path", {
  7801. fill: "currentColor",
  7802. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
  7803. }, null, -1);
  7804. var _hoisted_3276 = [
  7805. _hoisted_2277
  7806. ];
  7807. function _sfc_render277(_ctx, _cache, $props, $setup, $data, $options) {
  7808. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1277, _hoisted_3276);
  7809. }
  7810. var warning_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main277, [["render", _sfc_render277], ["__file", "warning-filled.vue"]]);
  7811. var _sfc_main282 = {
  7812. name: "ZoomIn"
  7813. };
  7814. var _hoisted_1282 = {
  7815. viewBox: "0 0 1024 1024",
  7816. xmlns: "http://www.w3.org/2000/svg"
  7817. };
  7818. var _hoisted_2282 = /* @__PURE__ */ vue.createElementVNode("path", {
  7819. fill: "currentColor",
  7820. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z"
  7821. }, null, -1);
  7822. var _hoisted_3281 = [
  7823. _hoisted_2282
  7824. ];
  7825. function _sfc_render282(_ctx, _cache, $props, $setup, $data, $options) {
  7826. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1282, _hoisted_3281);
  7827. }
  7828. var zoom_in_default = /* @__PURE__ */ export_helper_default(_sfc_main282, [["render", _sfc_render282], ["__file", "zoom-in.vue"]]);
  7829. var _sfc_main283 = {
  7830. name: "ZoomOut"
  7831. };
  7832. var _hoisted_1283 = {
  7833. viewBox: "0 0 1024 1024",
  7834. xmlns: "http://www.w3.org/2000/svg"
  7835. };
  7836. var _hoisted_2283 = /* @__PURE__ */ vue.createElementVNode("path", {
  7837. fill: "currentColor",
  7838. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"
  7839. }, null, -1);
  7840. var _hoisted_3282 = [
  7841. _hoisted_2283
  7842. ];
  7843. function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) {
  7844. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1283, _hoisted_3282);
  7845. }
  7846. var zoom_out_default = /* @__PURE__ */ export_helper_default(_sfc_main283, [["render", _sfc_render283], ["__file", "zoom-out.vue"]]);
  7847. /*! Element Plus Icons Vue v2.0.6 */
  7848. const epPropKey = "__epPropKey";
  7849. const definePropType = (val) => val;
  7850. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7851. const buildProp = (prop, key) => {
  7852. if (!isObject$1(prop) || isEpProp(prop))
  7853. return prop;
  7854. const { values, required, default: defaultValue, type, validator } = prop;
  7855. const _validator = values || validator ? (val) => {
  7856. let valid = false;
  7857. let allowedValues = [];
  7858. if (values) {
  7859. allowedValues = Array.from(values);
  7860. if (hasOwn(prop, "default")) {
  7861. allowedValues.push(defaultValue);
  7862. }
  7863. valid || (valid = allowedValues.includes(val));
  7864. }
  7865. if (validator)
  7866. valid || (valid = validator(val));
  7867. if (!valid && allowedValues.length > 0) {
  7868. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7869. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7870. }
  7871. return valid;
  7872. } : void 0;
  7873. const epProp = {
  7874. type,
  7875. required: !!required,
  7876. validator: _validator,
  7877. [epPropKey]: true
  7878. };
  7879. if (hasOwn(prop, "default"))
  7880. epProp.default = defaultValue;
  7881. return epProp;
  7882. };
  7883. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7884. key,
  7885. buildProp(option, key)
  7886. ]));
  7887. const iconPropType = definePropType([
  7888. String,
  7889. Object,
  7890. Function
  7891. ]);
  7892. const CloseComponents = {
  7893. Close: close_default
  7894. };
  7895. const TypeComponents = {
  7896. Close: close_default,
  7897. SuccessFilled: success_filled_default,
  7898. InfoFilled: info_filled_default,
  7899. WarningFilled: warning_filled_default,
  7900. CircleCloseFilled: circle_close_filled_default
  7901. };
  7902. const TypeComponentsMap = {
  7903. success: success_filled_default,
  7904. warning: warning_filled_default,
  7905. error: circle_close_filled_default,
  7906. info: info_filled_default
  7907. };
  7908. const ValidateComponentsMap = {
  7909. validating: loading_default,
  7910. success: circle_check_default,
  7911. error: circle_close_default
  7912. };
  7913. const withInstall = (main, extra) => {
  7914. main.install = (app) => {
  7915. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7916. app.component(comp.name, comp);
  7917. }
  7918. };
  7919. if (extra) {
  7920. for (const [key, comp] of Object.entries(extra)) {
  7921. main[key] = comp;
  7922. }
  7923. }
  7924. return main;
  7925. };
  7926. const withInstallFunction = (fn, name) => {
  7927. fn.install = (app) => {
  7928. fn._context = app._context;
  7929. app.config.globalProperties[name] = fn;
  7930. };
  7931. return fn;
  7932. };
  7933. const withInstallDirective = (directive, name) => {
  7934. directive.install = (app) => {
  7935. app.directive(name, directive);
  7936. };
  7937. return directive;
  7938. };
  7939. const withNoopInstall = (component) => {
  7940. component.install = NOOP;
  7941. return component;
  7942. };
  7943. const composeRefs = (...refs) => {
  7944. return (el) => {
  7945. refs.forEach((ref) => {
  7946. if (isFunction$1(ref)) {
  7947. ref(el);
  7948. } else {
  7949. ref.value = el;
  7950. }
  7951. });
  7952. };
  7953. };
  7954. const EVENT_CODE = {
  7955. tab: "Tab",
  7956. enter: "Enter",
  7957. space: "Space",
  7958. left: "ArrowLeft",
  7959. up: "ArrowUp",
  7960. right: "ArrowRight",
  7961. down: "ArrowDown",
  7962. esc: "Escape",
  7963. delete: "Delete",
  7964. backspace: "Backspace",
  7965. numpadEnter: "NumpadEnter",
  7966. pageUp: "PageUp",
  7967. pageDown: "PageDown",
  7968. home: "Home",
  7969. end: "End"
  7970. };
  7971. const datePickTypes = [
  7972. "year",
  7973. "month",
  7974. "date",
  7975. "dates",
  7976. "week",
  7977. "datetime",
  7978. "datetimerange",
  7979. "daterange",
  7980. "monthrange"
  7981. ];
  7982. const WEEK_DAYS = [
  7983. "sun",
  7984. "mon",
  7985. "tue",
  7986. "wed",
  7987. "thu",
  7988. "fri",
  7989. "sat"
  7990. ];
  7991. const UPDATE_MODEL_EVENT = "update:modelValue";
  7992. const CHANGE_EVENT = "change";
  7993. const INPUT_EVENT = "input";
  7994. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  7995. const componentSizes = ["", "default", "small", "large"];
  7996. const componentSizeMap = {
  7997. large: 40,
  7998. default: 32,
  7999. small: 24
  8000. };
  8001. const getComponentSize = (size) => {
  8002. return componentSizeMap[size || "default"];
  8003. };
  8004. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8005. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8006. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8007. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8008. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8009. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8010. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8011. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8012. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8013. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8014. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8015. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8016. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8017. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8018. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8019. return PatchFlags2;
  8020. })(PatchFlags || {});
  8021. function isFragment(node) {
  8022. return vue.isVNode(node) && node.type === vue.Fragment;
  8023. }
  8024. function isComment(node) {
  8025. return vue.isVNode(node) && node.type === vue.Comment;
  8026. }
  8027. function isValidElementNode(node) {
  8028. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8029. }
  8030. const getNormalizedProps = (node) => {
  8031. if (!vue.isVNode(node)) {
  8032. return {};
  8033. }
  8034. const raw = node.props || {};
  8035. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8036. const props = {};
  8037. Object.keys(type).forEach((key) => {
  8038. if (hasOwn(type[key], "default")) {
  8039. props[key] = type[key].default;
  8040. }
  8041. });
  8042. Object.keys(raw).forEach((key) => {
  8043. props[camelize(key)] = raw[key];
  8044. });
  8045. return props;
  8046. };
  8047. const ensureOnlyChild = (children) => {
  8048. if (!isArray$1(children) || children.length > 1) {
  8049. throw new Error("expect to receive a single Vue element child");
  8050. }
  8051. return children[0];
  8052. };
  8053. const flattedChildren = (children) => {
  8054. const vNodes = isArray$1(children) ? children : [children];
  8055. const result = [];
  8056. vNodes.forEach((child) => {
  8057. var _a;
  8058. if (isArray$1(child)) {
  8059. result.push(...flattedChildren(child));
  8060. } else if (vue.isVNode(child) && isArray$1(child.children)) {
  8061. result.push(...flattedChildren(child.children));
  8062. } else {
  8063. result.push(child);
  8064. if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8065. result.push(...flattedChildren(child.component.subTree));
  8066. }
  8067. }
  8068. });
  8069. return result;
  8070. };
  8071. const unique = (arr) => [...new Set(arr)];
  8072. const castArray = (arr) => {
  8073. if (!arr && arr !== 0)
  8074. return [];
  8075. return Array.isArray(arr) ? arr : [arr];
  8076. };
  8077. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  8078. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  8079. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  8080. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  8081. const generateId = () => Math.floor(Math.random() * 1e4);
  8082. const mutable = (val) => val;
  8083. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8084. const LISTENER_PREFIX = /^on[A-Z]/;
  8085. const useAttrs = (params = {}) => {
  8086. const { excludeListeners = false, excludeKeys } = params;
  8087. const allExcludeKeys = vue.computed(() => {
  8088. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8089. });
  8090. const instance = vue.getCurrentInstance();
  8091. if (!instance) {
  8092. return vue.computed(() => ({}));
  8093. }
  8094. return vue.computed(() => {
  8095. var _a;
  8096. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8097. });
  8098. };
  8099. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8100. vue.watch(() => vue.unref(condition), (val) => {
  8101. }, {
  8102. immediate: true
  8103. });
  8104. };
  8105. const useDraggable = (targetRef, dragRef, draggable) => {
  8106. let transform = {
  8107. offsetX: 0,
  8108. offsetY: 0
  8109. };
  8110. const onMousedown = (e) => {
  8111. const downX = e.clientX;
  8112. const downY = e.clientY;
  8113. const { offsetX, offsetY } = transform;
  8114. const targetRect = targetRef.value.getBoundingClientRect();
  8115. const targetLeft = targetRect.left;
  8116. const targetTop = targetRect.top;
  8117. const targetWidth = targetRect.width;
  8118. const targetHeight = targetRect.height;
  8119. const clientWidth = document.documentElement.clientWidth;
  8120. const clientHeight = document.documentElement.clientHeight;
  8121. const minLeft = -targetLeft + offsetX;
  8122. const minTop = -targetTop + offsetY;
  8123. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8124. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8125. const onMousemove = (e2) => {
  8126. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  8127. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  8128. transform = {
  8129. offsetX: moveX,
  8130. offsetY: moveY
  8131. };
  8132. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8133. };
  8134. const onMouseup = () => {
  8135. document.removeEventListener("mousemove", onMousemove);
  8136. document.removeEventListener("mouseup", onMouseup);
  8137. };
  8138. document.addEventListener("mousemove", onMousemove);
  8139. document.addEventListener("mouseup", onMouseup);
  8140. };
  8141. const onDraggable = () => {
  8142. if (dragRef.value && targetRef.value) {
  8143. dragRef.value.addEventListener("mousedown", onMousedown);
  8144. }
  8145. };
  8146. const offDraggable = () => {
  8147. if (dragRef.value && targetRef.value) {
  8148. dragRef.value.removeEventListener("mousedown", onMousedown);
  8149. }
  8150. };
  8151. vue.onMounted(() => {
  8152. vue.watchEffect(() => {
  8153. if (draggable.value) {
  8154. onDraggable();
  8155. } else {
  8156. offDraggable();
  8157. }
  8158. });
  8159. });
  8160. vue.onBeforeUnmount(() => {
  8161. offDraggable();
  8162. });
  8163. };
  8164. const useFocus = (el) => {
  8165. return {
  8166. focus: () => {
  8167. var _a, _b;
  8168. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8169. }
  8170. };
  8171. };
  8172. var English = {
  8173. name: "en",
  8174. el: {
  8175. colorpicker: {
  8176. confirm: "OK",
  8177. clear: "Clear",
  8178. defaultLabel: "color picker",
  8179. description: "current color is {color}. press enter to select a new color."
  8180. },
  8181. datepicker: {
  8182. now: "Now",
  8183. today: "Today",
  8184. cancel: "Cancel",
  8185. clear: "Clear",
  8186. confirm: "OK",
  8187. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8188. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8189. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8190. selectedDate: "Selected date",
  8191. selectDate: "Select date",
  8192. selectTime: "Select time",
  8193. startDate: "Start Date",
  8194. startTime: "Start Time",
  8195. endDate: "End Date",
  8196. endTime: "End Time",
  8197. prevYear: "Previous Year",
  8198. nextYear: "Next Year",
  8199. prevMonth: "Previous Month",
  8200. nextMonth: "Next Month",
  8201. year: "",
  8202. month1: "January",
  8203. month2: "February",
  8204. month3: "March",
  8205. month4: "April",
  8206. month5: "May",
  8207. month6: "June",
  8208. month7: "July",
  8209. month8: "August",
  8210. month9: "September",
  8211. month10: "October",
  8212. month11: "November",
  8213. month12: "December",
  8214. week: "week",
  8215. weeks: {
  8216. sun: "Sun",
  8217. mon: "Mon",
  8218. tue: "Tue",
  8219. wed: "Wed",
  8220. thu: "Thu",
  8221. fri: "Fri",
  8222. sat: "Sat"
  8223. },
  8224. weeksFull: {
  8225. sun: "Sunday",
  8226. mon: "Monday",
  8227. tue: "Tuesday",
  8228. wed: "Wednesday",
  8229. thu: "Thursday",
  8230. fri: "Friday",
  8231. sat: "Saturday"
  8232. },
  8233. months: {
  8234. jan: "Jan",
  8235. feb: "Feb",
  8236. mar: "Mar",
  8237. apr: "Apr",
  8238. may: "May",
  8239. jun: "Jun",
  8240. jul: "Jul",
  8241. aug: "Aug",
  8242. sep: "Sep",
  8243. oct: "Oct",
  8244. nov: "Nov",
  8245. dec: "Dec"
  8246. }
  8247. },
  8248. inputNumber: {
  8249. decrease: "decrease number",
  8250. increase: "increase number"
  8251. },
  8252. select: {
  8253. loading: "Loading",
  8254. noMatch: "No matching data",
  8255. noData: "No data",
  8256. placeholder: "Select"
  8257. },
  8258. dropdown: {
  8259. toggleDropdown: "Toggle Dropdown"
  8260. },
  8261. cascader: {
  8262. noMatch: "No matching data",
  8263. loading: "Loading",
  8264. placeholder: "Select",
  8265. noData: "No data"
  8266. },
  8267. pagination: {
  8268. goto: "Go to",
  8269. pagesize: "/page",
  8270. total: "Total {total}",
  8271. pageClassifier: "",
  8272. page: "Page",
  8273. prev: "Go to previous page",
  8274. next: "Go to next page",
  8275. currentPage: "page {pager}",
  8276. prevPages: "Previous {pager} pages",
  8277. nextPages: "Next {pager} pages",
  8278. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8279. },
  8280. dialog: {
  8281. close: "Close this dialog"
  8282. },
  8283. drawer: {
  8284. close: "Close this dialog"
  8285. },
  8286. messagebox: {
  8287. title: "Message",
  8288. confirm: "OK",
  8289. cancel: "Cancel",
  8290. error: "Illegal input",
  8291. close: "Close this dialog"
  8292. },
  8293. upload: {
  8294. deleteTip: "press delete to remove",
  8295. delete: "Delete",
  8296. preview: "Preview",
  8297. continue: "Continue"
  8298. },
  8299. slider: {
  8300. defaultLabel: "slider between {min} and {max}",
  8301. defaultRangeStartLabel: "pick start value",
  8302. defaultRangeEndLabel: "pick end value"
  8303. },
  8304. table: {
  8305. emptyText: "No Data",
  8306. confirmFilter: "Confirm",
  8307. resetFilter: "Reset",
  8308. clearFilter: "All",
  8309. sumText: "Sum"
  8310. },
  8311. tree: {
  8312. emptyText: "No Data"
  8313. },
  8314. transfer: {
  8315. noMatch: "No matching data",
  8316. noData: "No data",
  8317. titles: ["List 1", "List 2"],
  8318. filterPlaceholder: "Enter keyword",
  8319. noCheckedFormat: "{total} items",
  8320. hasCheckedFormat: "{checked}/{total} checked"
  8321. },
  8322. image: {
  8323. error: "FAILED"
  8324. },
  8325. pageHeader: {
  8326. title: "Back"
  8327. },
  8328. popconfirm: {
  8329. confirmButtonText: "Yes",
  8330. cancelButtonText: "No"
  8331. }
  8332. }
  8333. };
  8334. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8335. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8336. var _a;
  8337. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8338. });
  8339. const buildLocaleContext = (locale) => {
  8340. const lang = vue.computed(() => vue.unref(locale).name);
  8341. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8342. return {
  8343. lang,
  8344. locale: localeRef,
  8345. t: buildTranslator(locale)
  8346. };
  8347. };
  8348. const localeContextKey = Symbol("localeContextKey");
  8349. const useLocale = (localeOverrides) => {
  8350. const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
  8351. return buildLocaleContext(vue.computed(() => locale.value || English));
  8352. };
  8353. let activeEffectScope;
  8354. function recordEffectScope(effect2, scope = activeEffectScope) {
  8355. if (scope && scope.active) {
  8356. scope.effects.push(effect2);
  8357. }
  8358. }
  8359. const createDep = (effects) => {
  8360. const dep = new Set(effects);
  8361. dep.w = 0;
  8362. dep.n = 0;
  8363. return dep;
  8364. };
  8365. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  8366. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  8367. const initDepMarkers = ({ deps }) => {
  8368. if (deps.length) {
  8369. for (let i = 0; i < deps.length; i++) {
  8370. deps[i].w |= trackOpBit;
  8371. }
  8372. }
  8373. };
  8374. const finalizeDepMarkers = (effect2) => {
  8375. const { deps } = effect2;
  8376. if (deps.length) {
  8377. let ptr = 0;
  8378. for (let i = 0; i < deps.length; i++) {
  8379. const dep = deps[i];
  8380. if (wasTracked(dep) && !newTracked(dep)) {
  8381. dep.delete(effect2);
  8382. } else {
  8383. deps[ptr++] = dep;
  8384. }
  8385. dep.w &= ~trackOpBit;
  8386. dep.n &= ~trackOpBit;
  8387. }
  8388. deps.length = ptr;
  8389. }
  8390. };
  8391. let effectTrackDepth = 0;
  8392. let trackOpBit = 1;
  8393. const maxMarkerBits = 30;
  8394. let activeEffect;
  8395. class ReactiveEffect {
  8396. constructor(fn, scheduler2 = null, scope) {
  8397. this.fn = fn;
  8398. this.scheduler = scheduler2;
  8399. this.active = true;
  8400. this.deps = [];
  8401. this.parent = void 0;
  8402. recordEffectScope(this, scope);
  8403. }
  8404. run() {
  8405. if (!this.active) {
  8406. return this.fn();
  8407. }
  8408. let parent = activeEffect;
  8409. let lastShouldTrack = shouldTrack;
  8410. while (parent) {
  8411. if (parent === this) {
  8412. return;
  8413. }
  8414. parent = parent.parent;
  8415. }
  8416. try {
  8417. this.parent = activeEffect;
  8418. activeEffect = this;
  8419. shouldTrack = true;
  8420. trackOpBit = 1 << ++effectTrackDepth;
  8421. if (effectTrackDepth <= maxMarkerBits) {
  8422. initDepMarkers(this);
  8423. } else {
  8424. cleanupEffect(this);
  8425. }
  8426. return this.fn();
  8427. } finally {
  8428. if (effectTrackDepth <= maxMarkerBits) {
  8429. finalizeDepMarkers(this);
  8430. }
  8431. trackOpBit = 1 << --effectTrackDepth;
  8432. activeEffect = this.parent;
  8433. shouldTrack = lastShouldTrack;
  8434. this.parent = void 0;
  8435. if (this.deferStop) {
  8436. this.stop();
  8437. }
  8438. }
  8439. }
  8440. stop() {
  8441. if (activeEffect === this) {
  8442. this.deferStop = true;
  8443. } else if (this.active) {
  8444. cleanupEffect(this);
  8445. if (this.onStop) {
  8446. this.onStop();
  8447. }
  8448. this.active = false;
  8449. }
  8450. }
  8451. }
  8452. function cleanupEffect(effect2) {
  8453. const { deps } = effect2;
  8454. if (deps.length) {
  8455. for (let i = 0; i < deps.length; i++) {
  8456. deps[i].delete(effect2);
  8457. }
  8458. deps.length = 0;
  8459. }
  8460. }
  8461. let shouldTrack = true;
  8462. function trackEffects(dep, debuggerEventExtraInfo) {
  8463. let shouldTrack2 = false;
  8464. if (effectTrackDepth <= maxMarkerBits) {
  8465. if (!newTracked(dep)) {
  8466. dep.n |= trackOpBit;
  8467. shouldTrack2 = !wasTracked(dep);
  8468. }
  8469. } else {
  8470. shouldTrack2 = !dep.has(activeEffect);
  8471. }
  8472. if (shouldTrack2) {
  8473. dep.add(activeEffect);
  8474. activeEffect.deps.push(dep);
  8475. }
  8476. }
  8477. function triggerEffects(dep, debuggerEventExtraInfo) {
  8478. const effects = isArray$1(dep) ? dep : [...dep];
  8479. for (const effect2 of effects) {
  8480. if (effect2.computed) {
  8481. triggerEffect(effect2);
  8482. }
  8483. }
  8484. for (const effect2 of effects) {
  8485. if (!effect2.computed) {
  8486. triggerEffect(effect2);
  8487. }
  8488. }
  8489. }
  8490. function triggerEffect(effect2, debuggerEventExtraInfo) {
  8491. if (effect2 !== activeEffect || effect2.allowRecurse) {
  8492. if (effect2.scheduler) {
  8493. effect2.scheduler();
  8494. } else {
  8495. effect2.run();
  8496. }
  8497. }
  8498. }
  8499. function toRaw(observed) {
  8500. const raw = observed && observed["__v_raw"];
  8501. return raw ? toRaw(raw) : observed;
  8502. }
  8503. function trackRefValue(ref2) {
  8504. if (shouldTrack && activeEffect) {
  8505. ref2 = toRaw(ref2);
  8506. {
  8507. trackEffects(ref2.dep || (ref2.dep = createDep()));
  8508. }
  8509. }
  8510. }
  8511. function triggerRefValue(ref2, newVal) {
  8512. ref2 = toRaw(ref2);
  8513. if (ref2.dep) {
  8514. {
  8515. triggerEffects(ref2.dep);
  8516. }
  8517. }
  8518. }
  8519. class ComputedRefImpl {
  8520. constructor(getter, _setter, isReadonly2, isSSR) {
  8521. this._setter = _setter;
  8522. this.dep = void 0;
  8523. this.__v_isRef = true;
  8524. this._dirty = true;
  8525. this.effect = new ReactiveEffect(getter, () => {
  8526. if (!this._dirty) {
  8527. this._dirty = true;
  8528. triggerRefValue(this);
  8529. }
  8530. });
  8531. this.effect.computed = this;
  8532. this.effect.active = this._cacheable = !isSSR;
  8533. this["__v_isReadonly"] = isReadonly2;
  8534. }
  8535. get value() {
  8536. const self = toRaw(this);
  8537. trackRefValue(self);
  8538. if (self._dirty || !self._cacheable) {
  8539. self._dirty = false;
  8540. self._value = self.effect.run();
  8541. }
  8542. return self._value;
  8543. }
  8544. set value(newValue) {
  8545. this._setter(newValue);
  8546. }
  8547. }
  8548. function computed(getterOrOptions, debugOptions, isSSR = false) {
  8549. let getter;
  8550. let setter;
  8551. const onlyGetter = isFunction$1(getterOrOptions);
  8552. if (onlyGetter) {
  8553. getter = getterOrOptions;
  8554. setter = NOOP;
  8555. } else {
  8556. getter = getterOrOptions.get;
  8557. setter = getterOrOptions.set;
  8558. }
  8559. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  8560. return cRef;
  8561. }
  8562. const defaultNamespace = "el";
  8563. const statePrefix = "is-";
  8564. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8565. let cls = `${namespace}-${block}`;
  8566. if (blockSuffix) {
  8567. cls += `-${blockSuffix}`;
  8568. }
  8569. if (element) {
  8570. cls += `__${element}`;
  8571. }
  8572. if (modifier) {
  8573. cls += `--${modifier}`;
  8574. }
  8575. return cls;
  8576. };
  8577. const namespaceContextKey = Symbol("namespaceContextKey");
  8578. const useGetDerivedNamespace = (namespaceOverrides) => {
  8579. const derivedNamespace = namespaceOverrides || vue.inject(namespaceContextKey, vue.ref(defaultNamespace));
  8580. const namespace = vue.computed(() => {
  8581. return vue.unref(derivedNamespace) || defaultNamespace;
  8582. });
  8583. return namespace;
  8584. };
  8585. const useNamespace = (block, namespaceOverrides) => {
  8586. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8587. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8588. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8589. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8590. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8591. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8592. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8593. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8594. const is = (name, ...args) => {
  8595. const state = args.length >= 1 ? args[0] : true;
  8596. return name && state ? `${statePrefix}${name}` : "";
  8597. };
  8598. const cssVar = (object) => {
  8599. const styles = {};
  8600. for (const key in object) {
  8601. if (object[key]) {
  8602. styles[`--${namespace.value}-${key}`] = object[key];
  8603. }
  8604. }
  8605. return styles;
  8606. };
  8607. const cssVarBlock = (object) => {
  8608. const styles = {};
  8609. for (const key in object) {
  8610. if (object[key]) {
  8611. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8612. }
  8613. }
  8614. return styles;
  8615. };
  8616. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8617. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8618. return {
  8619. namespace,
  8620. b,
  8621. e,
  8622. m,
  8623. be,
  8624. em,
  8625. bm,
  8626. bem,
  8627. is,
  8628. cssVar,
  8629. cssVarName,
  8630. cssVarBlock,
  8631. cssVarBlockName
  8632. };
  8633. };
  8634. const useLockscreen = (trigger, options = {}) => {
  8635. if (!vue.isRef(trigger)) {
  8636. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8637. }
  8638. const ns = options.ns || useNamespace("popup");
  8639. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  8640. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8641. return;
  8642. }
  8643. let scrollBarWidth = 0;
  8644. let withoutHiddenClass = false;
  8645. let bodyWidth = "0";
  8646. const cleanup = () => {
  8647. setTimeout(() => {
  8648. removeClass(document == null ? void 0 : document.body, hiddenCls.value);
  8649. if (withoutHiddenClass && document) {
  8650. document.body.style.width = bodyWidth;
  8651. }
  8652. }, 200);
  8653. };
  8654. vue.watch(trigger, (val) => {
  8655. if (!val) {
  8656. cleanup();
  8657. return;
  8658. }
  8659. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8660. if (withoutHiddenClass) {
  8661. bodyWidth = document.body.style.width;
  8662. }
  8663. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8664. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8665. const bodyOverflowY = getStyle(document.body, "overflowY");
  8666. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8667. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8668. }
  8669. addClass(document.body, hiddenCls.value);
  8670. });
  8671. vue.onScopeDispose(() => cleanup());
  8672. };
  8673. const modalStack = [];
  8674. const closeModal = (e) => {
  8675. if (modalStack.length === 0)
  8676. return;
  8677. if (e.code === EVENT_CODE.esc) {
  8678. e.stopPropagation();
  8679. const topModal = modalStack[modalStack.length - 1];
  8680. topModal.handleClose();
  8681. }
  8682. };
  8683. const useModal = (instance, visibleRef) => {
  8684. vue.watch(visibleRef, (val) => {
  8685. if (val) {
  8686. modalStack.push(instance);
  8687. } else {
  8688. modalStack.splice(modalStack.indexOf(instance), 1);
  8689. }
  8690. });
  8691. };
  8692. if (isClient)
  8693. useEventListener(document, "keydown", closeModal);
  8694. const _prop = buildProp({
  8695. type: definePropType(Boolean),
  8696. default: null
  8697. });
  8698. const _event = buildProp({
  8699. type: definePropType(Function)
  8700. });
  8701. const createModelToggleComposable = (name) => {
  8702. const updateEventKey = `update:${name}`;
  8703. const updateEventKeyRaw = `onUpdate:${name}`;
  8704. const useModelToggleEmits2 = [updateEventKey];
  8705. const useModelToggleProps2 = {
  8706. [name]: _prop,
  8707. [updateEventKeyRaw]: _event
  8708. };
  8709. const useModelToggle2 = ({
  8710. indicator,
  8711. toggleReason,
  8712. shouldHideWhenRouteChanges,
  8713. shouldProceed,
  8714. onShow,
  8715. onHide
  8716. }) => {
  8717. const instance = vue.getCurrentInstance();
  8718. const { emit } = instance;
  8719. const props = instance.props;
  8720. const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw]));
  8721. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8722. const doShow = (event) => {
  8723. if (indicator.value === true) {
  8724. return;
  8725. }
  8726. indicator.value = true;
  8727. if (toggleReason) {
  8728. toggleReason.value = event;
  8729. }
  8730. if (isFunction$1(onShow)) {
  8731. onShow(event);
  8732. }
  8733. };
  8734. const doHide = (event) => {
  8735. if (indicator.value === false) {
  8736. return;
  8737. }
  8738. indicator.value = false;
  8739. if (toggleReason) {
  8740. toggleReason.value = event;
  8741. }
  8742. if (isFunction$1(onHide)) {
  8743. onHide(event);
  8744. }
  8745. };
  8746. const show = (event) => {
  8747. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8748. return;
  8749. const shouldEmit = hasUpdateHandler.value && isClient;
  8750. if (shouldEmit) {
  8751. emit(updateEventKey, true);
  8752. }
  8753. if (isModelBindingAbsent.value || !shouldEmit) {
  8754. doShow(event);
  8755. }
  8756. };
  8757. const hide = (event) => {
  8758. if (props.disabled === true || !isClient)
  8759. return;
  8760. const shouldEmit = hasUpdateHandler.value && isClient;
  8761. if (shouldEmit) {
  8762. emit(updateEventKey, false);
  8763. }
  8764. if (isModelBindingAbsent.value || !shouldEmit) {
  8765. doHide(event);
  8766. }
  8767. };
  8768. const onChange = (val) => {
  8769. if (!isBoolean$1(val))
  8770. return;
  8771. if (props.disabled && val) {
  8772. if (hasUpdateHandler.value) {
  8773. emit(updateEventKey, false);
  8774. }
  8775. } else if (indicator.value !== val) {
  8776. if (val) {
  8777. doShow();
  8778. } else {
  8779. doHide();
  8780. }
  8781. }
  8782. };
  8783. const toggle = () => {
  8784. if (indicator.value) {
  8785. hide();
  8786. } else {
  8787. show();
  8788. }
  8789. };
  8790. vue.watch(() => props[name], onChange);
  8791. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8792. vue.watch(() => ({
  8793. ...instance.proxy.$route
  8794. }), () => {
  8795. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8796. hide();
  8797. }
  8798. });
  8799. }
  8800. vue.onMounted(() => {
  8801. onChange(props[name]);
  8802. });
  8803. return {
  8804. hide,
  8805. show,
  8806. toggle,
  8807. hasUpdateHandler
  8808. };
  8809. };
  8810. return {
  8811. useModelToggle: useModelToggle2,
  8812. useModelToggleProps: useModelToggleProps2,
  8813. useModelToggleEmits: useModelToggleEmits2
  8814. };
  8815. };
  8816. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8817. const usePreventGlobal = (indicator, evt, cb) => {
  8818. const prevent = (e) => {
  8819. if (cb(e))
  8820. e.stopImmediatePropagation();
  8821. };
  8822. let stop = void 0;
  8823. vue.watch(() => indicator.value, (val) => {
  8824. if (val) {
  8825. stop = useEventListener(document, evt, prevent, true);
  8826. } else {
  8827. stop == null ? void 0 : stop();
  8828. }
  8829. }, { immediate: true });
  8830. };
  8831. const useProp = (name) => {
  8832. const vm = vue.getCurrentInstance();
  8833. return vue.computed(() => {
  8834. var _a, _b;
  8835. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  8836. });
  8837. };
  8838. 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});
  8839. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8840. const stateUpdater = {
  8841. name: "updateState",
  8842. enabled: true,
  8843. phase: "write",
  8844. fn: ({ state }) => {
  8845. const derivedState = deriveState(state);
  8846. Object.assign(states.value, derivedState);
  8847. },
  8848. requires: ["computeStyles"]
  8849. };
  8850. const options = vue.computed(() => {
  8851. const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
  8852. return {
  8853. onFirstUpdate,
  8854. placement: placement || "bottom",
  8855. strategy: strategy || "absolute",
  8856. modifiers: [
  8857. ...modifiers || [],
  8858. stateUpdater,
  8859. { name: "applyStyles", enabled: false }
  8860. ]
  8861. };
  8862. });
  8863. const instanceRef = vue.shallowRef();
  8864. const states = vue.ref({
  8865. styles: {
  8866. popper: {
  8867. position: vue.unref(options).strategy,
  8868. left: "0",
  8869. top: "0"
  8870. },
  8871. arrow: {
  8872. position: "absolute"
  8873. }
  8874. },
  8875. attributes: {}
  8876. });
  8877. const destroy = () => {
  8878. if (!instanceRef.value)
  8879. return;
  8880. instanceRef.value.destroy();
  8881. instanceRef.value = void 0;
  8882. };
  8883. vue.watch(options, (newOptions) => {
  8884. const instance = vue.unref(instanceRef);
  8885. if (instance) {
  8886. instance.setOptions(newOptions);
  8887. }
  8888. }, {
  8889. deep: true
  8890. });
  8891. vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8892. destroy();
  8893. if (!referenceElement || !popperElement)
  8894. return;
  8895. instanceRef.value = yn(referenceElement, popperElement, vue.unref(options));
  8896. });
  8897. vue.onBeforeUnmount(() => {
  8898. destroy();
  8899. });
  8900. return {
  8901. state: vue.computed(() => {
  8902. var _a;
  8903. return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  8904. }),
  8905. styles: vue.computed(() => vue.unref(states).styles),
  8906. attributes: vue.computed(() => vue.unref(states).attributes),
  8907. update: () => {
  8908. var _a;
  8909. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update();
  8910. },
  8911. forceUpdate: () => {
  8912. var _a;
  8913. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  8914. },
  8915. instanceRef: vue.computed(() => vue.unref(instanceRef))
  8916. };
  8917. };
  8918. function deriveState(state) {
  8919. const elements = Object.keys(state.elements);
  8920. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  8921. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  8922. return {
  8923. styles,
  8924. attributes
  8925. };
  8926. }
  8927. const useRestoreActive = (toggle, initialFocus) => {
  8928. let previousActive;
  8929. vue.watch(() => toggle.value, (val) => {
  8930. var _a, _b;
  8931. if (val) {
  8932. previousActive = document.activeElement;
  8933. if (vue.isRef(initialFocus)) {
  8934. (_b = (_a = initialFocus.value).focus) == null ? void 0 : _b.call(_a);
  8935. }
  8936. } else {
  8937. {
  8938. previousActive.focus();
  8939. }
  8940. }
  8941. });
  8942. };
  8943. const useSameTarget = (handleClick) => {
  8944. if (!handleClick) {
  8945. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8946. }
  8947. let mousedownTarget = false;
  8948. let mouseupTarget = false;
  8949. const onClick = (e) => {
  8950. if (mousedownTarget && mouseupTarget) {
  8951. handleClick(e);
  8952. }
  8953. mousedownTarget = mouseupTarget = false;
  8954. };
  8955. const onMousedown = (e) => {
  8956. mousedownTarget = e.target === e.currentTarget;
  8957. };
  8958. const onMouseup = (e) => {
  8959. mouseupTarget = e.target === e.currentTarget;
  8960. };
  8961. return { onClick, onMousedown, onMouseup };
  8962. };
  8963. const useTeleport = (contentRenderer, appendToBody) => {
  8964. const isTeleportVisible = vue.ref(false);
  8965. if (!isClient) {
  8966. return {
  8967. isTeleportVisible,
  8968. showTeleport: NOOP,
  8969. hideTeleport: NOOP,
  8970. renderTeleport: NOOP
  8971. };
  8972. }
  8973. let $el = null;
  8974. const showTeleport = () => {
  8975. isTeleportVisible.value = true;
  8976. if ($el !== null)
  8977. return;
  8978. $el = createGlobalNode();
  8979. };
  8980. const hideTeleport = () => {
  8981. isTeleportVisible.value = false;
  8982. if ($el !== null) {
  8983. removeGlobalNode($el);
  8984. $el = null;
  8985. }
  8986. };
  8987. const renderTeleport = () => {
  8988. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  8989. };
  8990. vue.onUnmounted(hideTeleport);
  8991. return {
  8992. isTeleportVisible,
  8993. showTeleport,
  8994. hideTeleport,
  8995. renderTeleport
  8996. };
  8997. };
  8998. const useThrottleRender = (loading, throttle = 0) => {
  8999. if (throttle === 0)
  9000. return loading;
  9001. const throttled = vue.ref(false);
  9002. let timeoutHandle = 0;
  9003. const dispatchThrottling = () => {
  9004. if (timeoutHandle) {
  9005. clearTimeout(timeoutHandle);
  9006. }
  9007. timeoutHandle = window.setTimeout(() => {
  9008. throttled.value = loading.value;
  9009. }, throttle);
  9010. };
  9011. vue.onMounted(dispatchThrottling);
  9012. vue.watch(() => loading.value, (val) => {
  9013. if (val) {
  9014. dispatchThrottling();
  9015. } else {
  9016. throttled.value = val;
  9017. }
  9018. });
  9019. return throttled;
  9020. };
  9021. function useTimeout() {
  9022. let timeoutHandle;
  9023. const registerTimeout = (fn, delay) => {
  9024. cancelTimeout();
  9025. timeoutHandle = window.setTimeout(fn, delay);
  9026. };
  9027. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  9028. tryOnScopeDispose(() => cancelTimeout());
  9029. return {
  9030. registerTimeout,
  9031. cancelTimeout
  9032. };
  9033. }
  9034. const AFTER_APPEAR = "after-appear";
  9035. const AFTER_ENTER = "after-enter";
  9036. const AFTER_LEAVE = "after-leave";
  9037. const APPEAR = "appear";
  9038. const APPEAR_CANCELLED = "appear-cancelled";
  9039. const BEFORE_ENTER = "before-enter";
  9040. const BEFORE_LEAVE = "before-leave";
  9041. const ENTER = "enter";
  9042. const ENTER_CANCELLED = "enter-cancelled";
  9043. const LEAVE = "leave";
  9044. const LEAVE_CANCELLED = "leave-cancelled";
  9045. const useTransitionFallthroughEmits = [
  9046. AFTER_APPEAR,
  9047. AFTER_ENTER,
  9048. AFTER_LEAVE,
  9049. APPEAR,
  9050. APPEAR_CANCELLED,
  9051. BEFORE_ENTER,
  9052. BEFORE_LEAVE,
  9053. ENTER,
  9054. ENTER_CANCELLED,
  9055. LEAVE,
  9056. LEAVE_CANCELLED
  9057. ];
  9058. const useTransitionFallthrough = () => {
  9059. const { emit } = vue.getCurrentInstance();
  9060. return {
  9061. onAfterAppear: () => {
  9062. emit(AFTER_APPEAR);
  9063. },
  9064. onAfterEnter: () => {
  9065. emit(AFTER_ENTER);
  9066. },
  9067. onAfterLeave: () => {
  9068. emit(AFTER_LEAVE);
  9069. },
  9070. onAppearCancelled: () => {
  9071. emit(APPEAR_CANCELLED);
  9072. },
  9073. onBeforeEnter: () => {
  9074. emit(BEFORE_ENTER);
  9075. },
  9076. onBeforeLeave: () => {
  9077. emit(BEFORE_LEAVE);
  9078. },
  9079. onEnter: () => {
  9080. emit(ENTER);
  9081. },
  9082. onEnterCancelled: () => {
  9083. emit(ENTER_CANCELLED);
  9084. },
  9085. onLeave: () => {
  9086. emit(LEAVE);
  9087. },
  9088. onLeaveCancelled: () => {
  9089. emit(LEAVE_CANCELLED);
  9090. }
  9091. };
  9092. };
  9093. const defaultIdInjection = {
  9094. prefix: Math.floor(Math.random() * 1e4),
  9095. current: 0
  9096. };
  9097. const ID_INJECTION_KEY = Symbol("elIdInjection");
  9098. const useIdInjection = () => {
  9099. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  9100. };
  9101. const useId = (deterministicId) => {
  9102. const idInjection = useIdInjection();
  9103. const namespace = useGetDerivedNamespace();
  9104. const idRef = vue.computed(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  9105. return idRef;
  9106. };
  9107. let registeredEscapeHandlers = [];
  9108. const cachedHandler = (e) => {
  9109. const event = e;
  9110. if (event.key === EVENT_CODE.esc) {
  9111. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  9112. }
  9113. };
  9114. const useEscapeKeydown = (handler) => {
  9115. vue.onMounted(() => {
  9116. if (registeredEscapeHandlers.length === 0) {
  9117. document.addEventListener("keydown", cachedHandler);
  9118. }
  9119. if (isClient)
  9120. registeredEscapeHandlers.push(handler);
  9121. });
  9122. vue.onBeforeUnmount(() => {
  9123. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9124. if (registeredEscapeHandlers.length === 0) {
  9125. if (isClient)
  9126. document.removeEventListener("keydown", cachedHandler);
  9127. }
  9128. });
  9129. };
  9130. let cachedContainer;
  9131. const usePopperContainerId = () => {
  9132. const namespace = useGetDerivedNamespace();
  9133. const idInjection = useIdInjection();
  9134. const id = vue.computed(() => {
  9135. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9136. });
  9137. const selector = vue.computed(() => `#${id.value}`);
  9138. return {
  9139. id,
  9140. selector
  9141. };
  9142. };
  9143. const createContainer = (id) => {
  9144. const container = document.createElement("div");
  9145. container.id = id;
  9146. document.body.appendChild(container);
  9147. return container;
  9148. };
  9149. const usePopperContainer = () => {
  9150. const { id, selector } = usePopperContainerId();
  9151. vue.onBeforeMount(() => {
  9152. if (!isClient)
  9153. return;
  9154. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  9155. cachedContainer = createContainer(id.value);
  9156. }
  9157. });
  9158. return {
  9159. id,
  9160. selector
  9161. };
  9162. };
  9163. const useDelayedRender = ({
  9164. indicator,
  9165. intermediateIndicator,
  9166. shouldSetIntermediate = () => true,
  9167. beforeShow,
  9168. afterShow,
  9169. afterHide,
  9170. beforeHide
  9171. }) => {
  9172. vue.watch(() => vue.unref(indicator), (val) => {
  9173. if (val) {
  9174. beforeShow == null ? void 0 : beforeShow();
  9175. vue.nextTick(() => {
  9176. if (!vue.unref(indicator))
  9177. return;
  9178. if (shouldSetIntermediate("show")) {
  9179. intermediateIndicator.value = true;
  9180. }
  9181. });
  9182. } else {
  9183. beforeHide == null ? void 0 : beforeHide();
  9184. vue.nextTick(() => {
  9185. if (vue.unref(indicator))
  9186. return;
  9187. if (shouldSetIntermediate("hide")) {
  9188. intermediateIndicator.value = false;
  9189. }
  9190. });
  9191. }
  9192. });
  9193. vue.watch(() => intermediateIndicator.value, (val) => {
  9194. if (val) {
  9195. afterShow == null ? void 0 : afterShow();
  9196. } else {
  9197. afterHide == null ? void 0 : afterHide();
  9198. }
  9199. });
  9200. };
  9201. const useDelayedToggleProps = buildProps({
  9202. showAfter: {
  9203. type: Number,
  9204. default: 0
  9205. },
  9206. hideAfter: {
  9207. type: Number,
  9208. default: 200
  9209. },
  9210. autoClose: {
  9211. type: Number,
  9212. default: 0
  9213. }
  9214. });
  9215. const useDelayedToggle = ({
  9216. showAfter,
  9217. hideAfter,
  9218. autoClose,
  9219. open,
  9220. close
  9221. }) => {
  9222. const { registerTimeout } = useTimeout();
  9223. const {
  9224. registerTimeout: registerTimeoutForAutoClose,
  9225. cancelTimeout: cancelTimeoutForAutoClose
  9226. } = useTimeout();
  9227. const onOpen = (event) => {
  9228. registerTimeout(() => {
  9229. open(event);
  9230. const _autoClose = vue.unref(autoClose);
  9231. if (isNumber$1(_autoClose) && _autoClose > 0) {
  9232. registerTimeoutForAutoClose(() => {
  9233. close(event);
  9234. }, _autoClose);
  9235. }
  9236. }, vue.unref(showAfter));
  9237. };
  9238. const onClose = (event) => {
  9239. cancelTimeoutForAutoClose();
  9240. registerTimeout(() => {
  9241. close(event);
  9242. }, vue.unref(hideAfter));
  9243. };
  9244. return {
  9245. onOpen,
  9246. onClose
  9247. };
  9248. };
  9249. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9250. const useForwardRef = (forwardRef) => {
  9251. const setForwardRef = (el) => {
  9252. forwardRef.value = el;
  9253. };
  9254. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9255. setForwardRef
  9256. });
  9257. };
  9258. const useForwardRefDirective = (setForwardRef) => {
  9259. return {
  9260. mounted(el) {
  9261. setForwardRef(el);
  9262. },
  9263. updated(el) {
  9264. setForwardRef(el);
  9265. },
  9266. unmounted() {
  9267. setForwardRef(null);
  9268. }
  9269. };
  9270. };
  9271. const zIndex = vue.ref(0);
  9272. const defaultInitialZIndex = 2e3;
  9273. const zIndexContextKey = Symbol("zIndexContextKey");
  9274. const useZIndex = (zIndexOverrides) => {
  9275. const zIndexInjection = zIndexOverrides || vue.inject(zIndexContextKey, void 0);
  9276. const initialZIndex = vue.computed(() => {
  9277. const zIndexFromInjection = vue.unref(zIndexInjection);
  9278. return isNumber$1(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9279. });
  9280. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9281. const nextZIndex = () => {
  9282. zIndex.value++;
  9283. return currentZIndex.value;
  9284. };
  9285. return {
  9286. initialZIndex,
  9287. currentZIndex,
  9288. nextZIndex
  9289. };
  9290. };
  9291. function getSide(placement) {
  9292. return placement.split('-')[0];
  9293. }
  9294. function getAlignment(placement) {
  9295. return placement.split('-')[1];
  9296. }
  9297. function getMainAxisFromPlacement(placement) {
  9298. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9299. }
  9300. function getLengthFromAxis(axis) {
  9301. return axis === 'y' ? 'height' : 'width';
  9302. }
  9303. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9304. let {
  9305. reference,
  9306. floating
  9307. } = _ref;
  9308. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9309. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9310. const mainAxis = getMainAxisFromPlacement(placement);
  9311. const length = getLengthFromAxis(mainAxis);
  9312. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9313. const side = getSide(placement);
  9314. const isVertical = mainAxis === 'x';
  9315. let coords;
  9316. switch (side) {
  9317. case 'top':
  9318. coords = {
  9319. x: commonX,
  9320. y: reference.y - floating.height
  9321. };
  9322. break;
  9323. case 'bottom':
  9324. coords = {
  9325. x: commonX,
  9326. y: reference.y + reference.height
  9327. };
  9328. break;
  9329. case 'right':
  9330. coords = {
  9331. x: reference.x + reference.width,
  9332. y: commonY
  9333. };
  9334. break;
  9335. case 'left':
  9336. coords = {
  9337. x: reference.x - floating.width,
  9338. y: commonY
  9339. };
  9340. break;
  9341. default:
  9342. coords = {
  9343. x: reference.x,
  9344. y: reference.y
  9345. };
  9346. }
  9347. switch (getAlignment(placement)) {
  9348. case 'start':
  9349. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9350. break;
  9351. case 'end':
  9352. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9353. break;
  9354. }
  9355. return coords;
  9356. }
  9357. /**
  9358. * Computes the `x` and `y` coordinates that will place the floating element
  9359. * next to a reference element when it is given a certain positioning strategy.
  9360. *
  9361. * This export does not have any `platform` interface logic. You will need to
  9362. * write one for the platform you are using Floating UI with.
  9363. */
  9364. const computePosition$1 = async (reference, floating, config) => {
  9365. const {
  9366. placement = 'bottom',
  9367. strategy = 'absolute',
  9368. middleware = [],
  9369. platform
  9370. } = config;
  9371. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9372. if (process.env.NODE_ENV !== "production") {
  9373. if (platform == null) {
  9374. console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
  9375. }
  9376. if (middleware.filter(_ref => {
  9377. let {
  9378. name
  9379. } = _ref;
  9380. return name === 'autoPlacement' || name === 'flip';
  9381. }).length > 1) {
  9382. throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));
  9383. }
  9384. }
  9385. let rects = await platform.getElementRects({
  9386. reference,
  9387. floating,
  9388. strategy
  9389. });
  9390. let {
  9391. x,
  9392. y
  9393. } = computeCoordsFromPlacement(rects, placement, rtl);
  9394. let statefulPlacement = placement;
  9395. let middlewareData = {};
  9396. let resetCount = 0;
  9397. for (let i = 0; i < middleware.length; i++) {
  9398. const {
  9399. name,
  9400. fn
  9401. } = middleware[i];
  9402. const {
  9403. x: nextX,
  9404. y: nextY,
  9405. data,
  9406. reset
  9407. } = await fn({
  9408. x,
  9409. y,
  9410. initialPlacement: placement,
  9411. placement: statefulPlacement,
  9412. strategy,
  9413. middlewareData,
  9414. rects,
  9415. platform,
  9416. elements: {
  9417. reference,
  9418. floating
  9419. }
  9420. });
  9421. x = nextX != null ? nextX : x;
  9422. y = nextY != null ? nextY : y;
  9423. middlewareData = { ...middlewareData,
  9424. [name]: { ...middlewareData[name],
  9425. ...data
  9426. }
  9427. };
  9428. if (process.env.NODE_ENV !== "production") {
  9429. if (resetCount > 50) {
  9430. console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
  9431. }
  9432. }
  9433. if (reset && resetCount <= 50) {
  9434. resetCount++;
  9435. if (typeof reset === 'object') {
  9436. if (reset.placement) {
  9437. statefulPlacement = reset.placement;
  9438. }
  9439. if (reset.rects) {
  9440. rects = reset.rects === true ? await platform.getElementRects({
  9441. reference,
  9442. floating,
  9443. strategy
  9444. }) : reset.rects;
  9445. }
  9446. ({
  9447. x,
  9448. y
  9449. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9450. }
  9451. i = -1;
  9452. continue;
  9453. }
  9454. }
  9455. return {
  9456. x,
  9457. y,
  9458. placement: statefulPlacement,
  9459. strategy,
  9460. middlewareData
  9461. };
  9462. };
  9463. function expandPaddingObject(padding) {
  9464. return {
  9465. top: 0,
  9466. right: 0,
  9467. bottom: 0,
  9468. left: 0,
  9469. ...padding
  9470. };
  9471. }
  9472. function getSideObjectFromPadding(padding) {
  9473. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9474. top: padding,
  9475. right: padding,
  9476. bottom: padding,
  9477. left: padding
  9478. };
  9479. }
  9480. function rectToClientRect(rect) {
  9481. return { ...rect,
  9482. top: rect.y,
  9483. left: rect.x,
  9484. right: rect.x + rect.width,
  9485. bottom: rect.y + rect.height
  9486. };
  9487. }
  9488. const min$2 = Math.min;
  9489. const max$2 = Math.max;
  9490. function within(min$1, value, max$1) {
  9491. return max$2(min$1, min$2(value, max$1));
  9492. }
  9493. /**
  9494. * Positions an inner element of the floating element such that it is centered
  9495. * to the reference element.
  9496. * @see https://floating-ui.com/docs/arrow
  9497. */
  9498. const arrow = options => ({
  9499. name: 'arrow',
  9500. options,
  9501. async fn(middlewareArguments) {
  9502. // Since `element` is required, we don't Partial<> the type
  9503. const {
  9504. element,
  9505. padding = 0
  9506. } = options != null ? options : {};
  9507. const {
  9508. x,
  9509. y,
  9510. placement,
  9511. rects,
  9512. platform
  9513. } = middlewareArguments;
  9514. if (element == null) {
  9515. if (process.env.NODE_ENV !== "production") {
  9516. console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
  9517. }
  9518. return {};
  9519. }
  9520. const paddingObject = getSideObjectFromPadding(padding);
  9521. const coords = {
  9522. x,
  9523. y
  9524. };
  9525. const axis = getMainAxisFromPlacement(placement);
  9526. const alignment = getAlignment(placement);
  9527. const length = getLengthFromAxis(axis);
  9528. const arrowDimensions = await platform.getDimensions(element);
  9529. const minProp = axis === 'y' ? 'top' : 'left';
  9530. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9531. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9532. const startDiff = coords[axis] - rects.reference[axis];
  9533. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9534. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9535. if (clientSize === 0) {
  9536. clientSize = rects.floating[length];
  9537. }
  9538. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9539. // point is outside the floating element's bounds
  9540. const min = paddingObject[minProp];
  9541. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9542. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9543. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9544. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9545. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9546. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9547. return {
  9548. [axis]: coords[axis] - alignmentOffset,
  9549. data: {
  9550. [axis]: offset,
  9551. centerOffset: center - offset
  9552. }
  9553. };
  9554. }
  9555. });
  9556. async function convertValueToCoords(middlewareArguments, value) {
  9557. const {
  9558. placement,
  9559. platform,
  9560. elements
  9561. } = middlewareArguments;
  9562. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9563. const side = getSide(placement);
  9564. const alignment = getAlignment(placement);
  9565. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9566. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9567. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9568. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9569. let {
  9570. mainAxis,
  9571. crossAxis,
  9572. alignmentAxis
  9573. } = typeof rawValue === 'number' ? {
  9574. mainAxis: rawValue,
  9575. crossAxis: 0,
  9576. alignmentAxis: null
  9577. } : {
  9578. mainAxis: 0,
  9579. crossAxis: 0,
  9580. alignmentAxis: null,
  9581. ...rawValue
  9582. };
  9583. if (alignment && typeof alignmentAxis === 'number') {
  9584. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9585. }
  9586. return isVertical ? {
  9587. x: crossAxis * crossAxisMulti,
  9588. y: mainAxis * mainAxisMulti
  9589. } : {
  9590. x: mainAxis * mainAxisMulti,
  9591. y: crossAxis * crossAxisMulti
  9592. };
  9593. }
  9594. /**
  9595. * Displaces the floating element from its reference element.
  9596. * @see https://floating-ui.com/docs/offset
  9597. */
  9598. const offset = function (value) {
  9599. if (value === void 0) {
  9600. value = 0;
  9601. }
  9602. return {
  9603. name: 'offset',
  9604. options: value,
  9605. async fn(middlewareArguments) {
  9606. const {
  9607. x,
  9608. y
  9609. } = middlewareArguments;
  9610. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9611. return {
  9612. x: x + diffCoords.x,
  9613. y: y + diffCoords.y,
  9614. data: diffCoords
  9615. };
  9616. }
  9617. };
  9618. };
  9619. function isWindow(value) {
  9620. return value && value.document && value.location && value.alert && value.setInterval;
  9621. }
  9622. function getWindow(node) {
  9623. if (node == null) {
  9624. return window;
  9625. }
  9626. if (!isWindow(node)) {
  9627. const ownerDocument = node.ownerDocument;
  9628. return ownerDocument ? ownerDocument.defaultView || window : window;
  9629. }
  9630. return node;
  9631. }
  9632. function getComputedStyle$1(element) {
  9633. return getWindow(element).getComputedStyle(element);
  9634. }
  9635. function getNodeName(node) {
  9636. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9637. }
  9638. function getUAString() {
  9639. const uaData = navigator.userAgentData;
  9640. if (uaData != null && uaData.brands) {
  9641. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9642. }
  9643. return navigator.userAgent;
  9644. }
  9645. function isHTMLElement(value) {
  9646. return value instanceof getWindow(value).HTMLElement;
  9647. }
  9648. function isElement(value) {
  9649. return value instanceof getWindow(value).Element;
  9650. }
  9651. function isNode(value) {
  9652. return value instanceof getWindow(value).Node;
  9653. }
  9654. function isShadowRoot(node) {
  9655. // Browsers without `ShadowRoot` support
  9656. if (typeof ShadowRoot === 'undefined') {
  9657. return false;
  9658. }
  9659. const OwnElement = getWindow(node).ShadowRoot;
  9660. return node instanceof OwnElement || node instanceof ShadowRoot;
  9661. }
  9662. function isOverflowElement(element) {
  9663. // Firefox wants us to check `-x` and `-y` variations as well
  9664. const {
  9665. overflow,
  9666. overflowX,
  9667. overflowY
  9668. } = getComputedStyle$1(element);
  9669. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9670. }
  9671. function isTableElement(element) {
  9672. return ['table', 'td', 'th'].includes(getNodeName(element));
  9673. }
  9674. function isContainingBlock(element) {
  9675. // TODO: Try and use feature detection here instead
  9676. const isFirefox = /firefox/i.test(getUAString());
  9677. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9678. // create a containing block.
  9679. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9680. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9681. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9682. }
  9683. function isLayoutViewport() {
  9684. // Not Safari
  9685. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9686. // • Always-visible scrollbar or not
  9687. // • Width of <html>, etc.
  9688. // const vV = win.visualViewport;
  9689. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9690. }
  9691. const min$1 = Math.min;
  9692. const max$1 = Math.max;
  9693. const round = Math.round;
  9694. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9695. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9696. if (includeScale === void 0) {
  9697. includeScale = false;
  9698. }
  9699. if (isFixedStrategy === void 0) {
  9700. isFixedStrategy = false;
  9701. }
  9702. const clientRect = element.getBoundingClientRect();
  9703. let scaleX = 1;
  9704. let scaleY = 1;
  9705. if (includeScale && isHTMLElement(element)) {
  9706. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9707. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9708. }
  9709. const win = isElement(element) ? getWindow(element) : window;
  9710. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9711. 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;
  9712. 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;
  9713. const width = clientRect.width / scaleX;
  9714. const height = clientRect.height / scaleY;
  9715. return {
  9716. width,
  9717. height,
  9718. top: y,
  9719. right: x + width,
  9720. bottom: y + height,
  9721. left: x,
  9722. x,
  9723. y
  9724. };
  9725. }
  9726. function getDocumentElement(node) {
  9727. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9728. }
  9729. function getNodeScroll(element) {
  9730. if (isElement(element)) {
  9731. return {
  9732. scrollLeft: element.scrollLeft,
  9733. scrollTop: element.scrollTop
  9734. };
  9735. }
  9736. return {
  9737. scrollLeft: element.pageXOffset,
  9738. scrollTop: element.pageYOffset
  9739. };
  9740. }
  9741. function getWindowScrollBarX(element) {
  9742. // If <html> has a CSS width greater than the viewport, then this will be
  9743. // incorrect for RTL.
  9744. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9745. }
  9746. function isScaled(element) {
  9747. const rect = getBoundingClientRect(element);
  9748. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9749. }
  9750. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9751. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9752. const documentElement = getDocumentElement(offsetParent);
  9753. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9754. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9755. let scroll = {
  9756. scrollLeft: 0,
  9757. scrollTop: 0
  9758. };
  9759. const offsets = {
  9760. x: 0,
  9761. y: 0
  9762. };
  9763. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9764. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9765. scroll = getNodeScroll(offsetParent);
  9766. }
  9767. if (isHTMLElement(offsetParent)) {
  9768. const offsetRect = getBoundingClientRect(offsetParent, true);
  9769. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9770. offsets.y = offsetRect.y + offsetParent.clientTop;
  9771. } else if (documentElement) {
  9772. offsets.x = getWindowScrollBarX(documentElement);
  9773. }
  9774. }
  9775. return {
  9776. x: rect.left + scroll.scrollLeft - offsets.x,
  9777. y: rect.top + scroll.scrollTop - offsets.y,
  9778. width: rect.width,
  9779. height: rect.height
  9780. };
  9781. }
  9782. function getParentNode(node) {
  9783. if (getNodeName(node) === 'html') {
  9784. return node;
  9785. }
  9786. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9787. // @ts-ignore
  9788. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9789. node.parentNode || ( // DOM Element detected
  9790. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9791. getDocumentElement(node) // fallback
  9792. );
  9793. }
  9794. function getTrueOffsetParent(element) {
  9795. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9796. return null;
  9797. }
  9798. return composedOffsetParent(element);
  9799. }
  9800. /**
  9801. * Polyfills the old offsetParent behavior from before the spec was changed:
  9802. * https://github.com/w3c/csswg-drafts/issues/159
  9803. */
  9804. function composedOffsetParent(element) {
  9805. let {
  9806. offsetParent
  9807. } = element;
  9808. let ancestor = element;
  9809. let foundInsideSlot = false;
  9810. while (ancestor && ancestor !== offsetParent) {
  9811. const {
  9812. assignedSlot
  9813. } = ancestor;
  9814. if (assignedSlot) {
  9815. let newOffsetParent = assignedSlot.offsetParent;
  9816. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9817. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9818. const oldDisplay = assignedSlot.style.display;
  9819. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9820. newOffsetParent = assignedSlot.offsetParent;
  9821. assignedSlot.style.display = oldDisplay;
  9822. if (!hadStyleAttribute) {
  9823. assignedSlot.removeAttribute('style');
  9824. }
  9825. }
  9826. ancestor = assignedSlot;
  9827. if (offsetParent !== newOffsetParent) {
  9828. offsetParent = newOffsetParent;
  9829. foundInsideSlot = true;
  9830. }
  9831. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9832. break;
  9833. }
  9834. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9835. }
  9836. return offsetParent;
  9837. }
  9838. function getContainingBlock(element) {
  9839. let currentNode = getParentNode(element);
  9840. if (isShadowRoot(currentNode)) {
  9841. currentNode = currentNode.host;
  9842. }
  9843. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9844. if (isContainingBlock(currentNode)) {
  9845. return currentNode;
  9846. } else {
  9847. const parent = currentNode.parentNode;
  9848. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9849. }
  9850. }
  9851. return null;
  9852. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9853. // such as table ancestors and cross browser bugs.
  9854. function getOffsetParent(element) {
  9855. const window = getWindow(element);
  9856. let offsetParent = getTrueOffsetParent(element);
  9857. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9858. offsetParent = getTrueOffsetParent(offsetParent);
  9859. }
  9860. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9861. return window;
  9862. }
  9863. return offsetParent || getContainingBlock(element) || window;
  9864. }
  9865. function getDimensions(element) {
  9866. if (isHTMLElement(element)) {
  9867. return {
  9868. width: element.offsetWidth,
  9869. height: element.offsetHeight
  9870. };
  9871. }
  9872. const rect = getBoundingClientRect(element);
  9873. return {
  9874. width: rect.width,
  9875. height: rect.height
  9876. };
  9877. }
  9878. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  9879. let {
  9880. rect,
  9881. offsetParent,
  9882. strategy
  9883. } = _ref;
  9884. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9885. const documentElement = getDocumentElement(offsetParent);
  9886. if (offsetParent === documentElement) {
  9887. return rect;
  9888. }
  9889. let scroll = {
  9890. scrollLeft: 0,
  9891. scrollTop: 0
  9892. };
  9893. const offsets = {
  9894. x: 0,
  9895. y: 0
  9896. };
  9897. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9898. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9899. scroll = getNodeScroll(offsetParent);
  9900. }
  9901. if (isHTMLElement(offsetParent)) {
  9902. const offsetRect = getBoundingClientRect(offsetParent, true);
  9903. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9904. offsets.y = offsetRect.y + offsetParent.clientTop;
  9905. } // This doesn't appear to be need to be negated.
  9906. // else if (documentElement) {
  9907. // offsets.x = getWindowScrollBarX(documentElement);
  9908. // }
  9909. }
  9910. return { ...rect,
  9911. x: rect.x - scroll.scrollLeft + offsets.x,
  9912. y: rect.y - scroll.scrollTop + offsets.y
  9913. };
  9914. }
  9915. function getViewportRect(element, strategy) {
  9916. const win = getWindow(element);
  9917. const html = getDocumentElement(element);
  9918. const visualViewport = win.visualViewport;
  9919. let width = html.clientWidth;
  9920. let height = html.clientHeight;
  9921. let x = 0;
  9922. let y = 0;
  9923. if (visualViewport) {
  9924. width = visualViewport.width;
  9925. height = visualViewport.height;
  9926. const layoutViewport = isLayoutViewport();
  9927. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  9928. x = visualViewport.offsetLeft;
  9929. y = visualViewport.offsetTop;
  9930. }
  9931. }
  9932. return {
  9933. width,
  9934. height,
  9935. x,
  9936. y
  9937. };
  9938. }
  9939. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  9940. function getDocumentRect(element) {
  9941. var _element$ownerDocumen;
  9942. const html = getDocumentElement(element);
  9943. const scroll = getNodeScroll(element);
  9944. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  9945. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  9946. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  9947. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  9948. const y = -scroll.scrollTop;
  9949. if (getComputedStyle$1(body || html).direction === 'rtl') {
  9950. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  9951. }
  9952. return {
  9953. width,
  9954. height,
  9955. x,
  9956. y
  9957. };
  9958. }
  9959. function getNearestOverflowAncestor(node) {
  9960. const parentNode = getParentNode(node);
  9961. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  9962. // @ts-ignore assume body is always available
  9963. return node.ownerDocument.body;
  9964. }
  9965. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  9966. return parentNode;
  9967. }
  9968. return getNearestOverflowAncestor(parentNode);
  9969. }
  9970. function getOverflowAncestors(node, list) {
  9971. var _node$ownerDocument;
  9972. if (list === void 0) {
  9973. list = [];
  9974. }
  9975. const scrollableAncestor = getNearestOverflowAncestor(node);
  9976. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  9977. const win = getWindow(scrollableAncestor);
  9978. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  9979. const updatedList = list.concat(target);
  9980. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  9981. updatedList.concat(getOverflowAncestors(target));
  9982. }
  9983. function contains(parent, child) {
  9984. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  9985. if (parent.contains(child)) {
  9986. return true;
  9987. } // then fallback to custom implementation with Shadow DOM support
  9988. else if (rootNode && isShadowRoot(rootNode)) {
  9989. let next = child;
  9990. do {
  9991. // use `===` replace node.isSameNode()
  9992. if (next && parent === next) {
  9993. return true;
  9994. } // @ts-ignore: need a better way to handle this...
  9995. next = next.parentNode || next.host;
  9996. } while (next);
  9997. }
  9998. return false;
  9999. }
  10000. function getInnerBoundingClientRect(element, strategy) {
  10001. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10002. const top = clientRect.top + element.clientTop;
  10003. const left = clientRect.left + element.clientLeft;
  10004. return {
  10005. top,
  10006. left,
  10007. x: left,
  10008. y: top,
  10009. right: left + element.clientWidth,
  10010. bottom: top + element.clientHeight,
  10011. width: element.clientWidth,
  10012. height: element.clientHeight
  10013. };
  10014. }
  10015. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10016. if (clippingParent === 'viewport') {
  10017. return rectToClientRect(getViewportRect(element, strategy));
  10018. }
  10019. if (isElement(clippingParent)) {
  10020. return getInnerBoundingClientRect(clippingParent, strategy);
  10021. }
  10022. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10023. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10024. // clipping (or hiding) overflowing elements with a position different from
  10025. // `initial`
  10026. function getClippingAncestors(element) {
  10027. const clippingAncestors = getOverflowAncestors(element);
  10028. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10029. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10030. if (!isElement(clipperElement)) {
  10031. return [];
  10032. } // @ts-ignore isElement check ensures we return Array<Element>
  10033. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10034. } // Gets the maximum area that the element is visible in due to any number of
  10035. // clipping ancestors
  10036. function getClippingRect(_ref) {
  10037. let {
  10038. element,
  10039. boundary,
  10040. rootBoundary,
  10041. strategy
  10042. } = _ref;
  10043. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10044. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10045. const firstClippingAncestor = clippingAncestors[0];
  10046. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10047. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10048. accRect.top = max$1(rect.top, accRect.top);
  10049. accRect.right = min$1(rect.right, accRect.right);
  10050. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10051. accRect.left = max$1(rect.left, accRect.left);
  10052. return accRect;
  10053. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10054. return {
  10055. width: clippingRect.right - clippingRect.left,
  10056. height: clippingRect.bottom - clippingRect.top,
  10057. x: clippingRect.left,
  10058. y: clippingRect.top
  10059. };
  10060. }
  10061. const platform = {
  10062. getClippingRect,
  10063. convertOffsetParentRelativeRectToViewportRelativeRect,
  10064. isElement,
  10065. getDimensions,
  10066. getOffsetParent,
  10067. getDocumentElement,
  10068. getElementRects: _ref => {
  10069. let {
  10070. reference,
  10071. floating,
  10072. strategy
  10073. } = _ref;
  10074. return {
  10075. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10076. floating: { ...getDimensions(floating),
  10077. x: 0,
  10078. y: 0
  10079. }
  10080. };
  10081. },
  10082. getClientRects: element => Array.from(element.getClientRects()),
  10083. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10084. };
  10085. /**
  10086. * Computes the `x` and `y` coordinates that will place the floating element
  10087. * next to a reference element when it is given a certain CSS positioning
  10088. * strategy.
  10089. */
  10090. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10091. platform,
  10092. ...options
  10093. });
  10094. const useFloatingProps = buildProps({});
  10095. const unrefReference = (elRef) => {
  10096. if (!isClient)
  10097. return;
  10098. if (!elRef)
  10099. return elRef;
  10100. const unrefEl = unrefElement(elRef);
  10101. if (unrefEl)
  10102. return unrefEl;
  10103. return vue.isRef(elRef) ? unrefEl : elRef;
  10104. };
  10105. const getPositionDataWithUnit = (record, key) => {
  10106. const value = record == null ? void 0 : record[key];
  10107. return isNil(value) ? "" : `${value}px`;
  10108. };
  10109. const useFloating = ({
  10110. middleware,
  10111. placement,
  10112. strategy
  10113. }) => {
  10114. const referenceRef = vue.ref();
  10115. const contentRef = vue.ref();
  10116. const x = vue.ref();
  10117. const y = vue.ref();
  10118. const middlewareData = vue.ref({});
  10119. const states = {
  10120. x,
  10121. y,
  10122. placement,
  10123. strategy,
  10124. middlewareData
  10125. };
  10126. const update = async () => {
  10127. if (!isClient)
  10128. return;
  10129. const referenceEl = unrefReference(referenceRef);
  10130. const contentEl = unrefElement(contentRef);
  10131. if (!referenceEl || !contentEl)
  10132. return;
  10133. const data = await computePosition(referenceEl, contentEl, {
  10134. placement: vue.unref(placement),
  10135. strategy: vue.unref(strategy),
  10136. middleware: vue.unref(middleware)
  10137. });
  10138. keysOf(states).forEach((key) => {
  10139. states[key].value = data[key];
  10140. });
  10141. };
  10142. vue.onMounted(() => {
  10143. vue.watchEffect(() => {
  10144. update();
  10145. });
  10146. });
  10147. return {
  10148. ...states,
  10149. update,
  10150. referenceRef,
  10151. contentRef
  10152. };
  10153. };
  10154. const arrowMiddleware = ({
  10155. arrowRef,
  10156. padding
  10157. }) => {
  10158. return {
  10159. name: "arrow",
  10160. options: {
  10161. element: arrowRef,
  10162. padding
  10163. },
  10164. fn(args) {
  10165. const arrowEl = vue.unref(arrowRef);
  10166. if (!arrowEl)
  10167. return {};
  10168. return arrow({
  10169. element: arrowEl,
  10170. padding
  10171. }).fn(args);
  10172. }
  10173. };
  10174. };
  10175. function useCursor(input) {
  10176. const selectionRef = vue.ref();
  10177. function recordCursor() {
  10178. if (input.value == void 0)
  10179. return;
  10180. const { selectionStart, selectionEnd, value } = input.value;
  10181. if (selectionStart == null || selectionEnd == null)
  10182. return;
  10183. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10184. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10185. selectionRef.value = {
  10186. selectionStart,
  10187. selectionEnd,
  10188. value,
  10189. beforeTxt,
  10190. afterTxt
  10191. };
  10192. }
  10193. function setCursor() {
  10194. if (input.value == void 0 || selectionRef.value == void 0)
  10195. return;
  10196. const { value } = input.value;
  10197. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  10198. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10199. return;
  10200. let startPos = value.length;
  10201. if (value.endsWith(afterTxt)) {
  10202. startPos = value.length - afterTxt.length;
  10203. } else if (value.startsWith(beforeTxt)) {
  10204. startPos = beforeTxt.length;
  10205. } else {
  10206. const beforeLastChar = beforeTxt[selectionStart - 1];
  10207. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10208. if (newIndex !== -1) {
  10209. startPos = newIndex + 1;
  10210. }
  10211. }
  10212. input.value.setSelectionRange(startPos, startPos);
  10213. }
  10214. return [recordCursor, setCursor];
  10215. }
  10216. const getOrderedChildren = (vm, childComponentName, children) => {
  10217. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10218. var _a;
  10219. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10220. });
  10221. const uids = nodes.map((n) => n.component.uid);
  10222. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10223. };
  10224. const useOrderedChildren = (vm, childComponentName) => {
  10225. const children = {};
  10226. const orderedChildren = vue.shallowRef([]);
  10227. const addChild = (child) => {
  10228. children[child.uid] = child;
  10229. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10230. };
  10231. const removeChild = (uid) => {
  10232. delete children[uid];
  10233. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10234. };
  10235. return {
  10236. children: orderedChildren,
  10237. addChild,
  10238. removeChild
  10239. };
  10240. };
  10241. const useSizeProp = buildProp({
  10242. type: String,
  10243. values: componentSizes,
  10244. required: false
  10245. });
  10246. const useSizeProps = {
  10247. size: useSizeProp
  10248. };
  10249. const SIZE_INJECTION_KEY = Symbol("size");
  10250. const useGlobalSize = () => {
  10251. const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
  10252. return vue.computed(() => {
  10253. return vue.unref(injectedSize.size) || "";
  10254. });
  10255. };
  10256. const configProviderContextKey = Symbol();
  10257. const globalConfig = vue.ref();
  10258. function useGlobalConfig(key, defaultValue = void 0) {
  10259. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  10260. if (key) {
  10261. return vue.computed(() => {
  10262. var _a, _b;
  10263. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  10264. });
  10265. } else {
  10266. return config;
  10267. }
  10268. }
  10269. function useGlobalComponentSettings(block, sizeFallback) {
  10270. const config = useGlobalConfig();
  10271. const ns = useNamespace(block, vue.computed(() => {
  10272. var _a;
  10273. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  10274. }));
  10275. const locale = useLocale(vue.computed(() => {
  10276. var _a;
  10277. return (_a = config.value) == null ? void 0 : _a.locale;
  10278. }));
  10279. const zIndex = useZIndex(vue.computed(() => {
  10280. var _a;
  10281. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  10282. }));
  10283. const size = vue.computed(() => {
  10284. var _a;
  10285. return vue.unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  10286. });
  10287. provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
  10288. return {
  10289. ns,
  10290. locale,
  10291. zIndex,
  10292. size
  10293. };
  10294. }
  10295. const provideGlobalConfig = (config, app, global = false) => {
  10296. var _a;
  10297. const inSetup = !!vue.getCurrentInstance();
  10298. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10299. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  10300. if (!provideFn) {
  10301. return;
  10302. }
  10303. const context = vue.computed(() => {
  10304. const cfg = vue.unref(config);
  10305. if (!(oldConfig == null ? void 0 : oldConfig.value))
  10306. return cfg;
  10307. return mergeConfig(oldConfig.value, cfg);
  10308. });
  10309. provideFn(configProviderContextKey, context);
  10310. provideFn(localeContextKey, vue.computed(() => context.value.locale));
  10311. provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
  10312. provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
  10313. provideFn(SIZE_INJECTION_KEY, {
  10314. size: vue.computed(() => context.value.size || "")
  10315. });
  10316. if (global || !globalConfig.value) {
  10317. globalConfig.value = context.value;
  10318. }
  10319. return context;
  10320. };
  10321. const mergeConfig = (a, b) => {
  10322. var _a;
  10323. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  10324. const obj = {};
  10325. for (const key of keys) {
  10326. obj[key] = (_a = b[key]) != null ? _a : a[key];
  10327. }
  10328. return obj;
  10329. };
  10330. const configProviderProps = buildProps({
  10331. a11y: {
  10332. type: Boolean,
  10333. default: true
  10334. },
  10335. locale: {
  10336. type: definePropType(Object)
  10337. },
  10338. size: useSizeProp,
  10339. button: {
  10340. type: definePropType(Object)
  10341. },
  10342. experimentalFeatures: {
  10343. type: definePropType(Object)
  10344. },
  10345. keyboardNavigation: {
  10346. type: Boolean,
  10347. default: true
  10348. },
  10349. message: {
  10350. type: definePropType(Object)
  10351. },
  10352. zIndex: Number,
  10353. namespace: {
  10354. type: String,
  10355. default: "el"
  10356. }
  10357. });
  10358. const messageConfig = {};
  10359. const ConfigProvider = vue.defineComponent({
  10360. name: "ElConfigProvider",
  10361. props: configProviderProps,
  10362. setup(props, { slots }) {
  10363. vue.watch(() => props.message, (val) => {
  10364. Object.assign(messageConfig, val != null ? val : {});
  10365. }, { immediate: true, deep: true });
  10366. const config = provideGlobalConfig(props);
  10367. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  10368. }
  10369. });
  10370. const ElConfigProvider = withInstall(ConfigProvider);
  10371. const version$1 = "2.3.3";
  10372. const makeInstaller = (components = []) => {
  10373. const install = (app, options) => {
  10374. if (app[INSTALLED_KEY])
  10375. return;
  10376. app[INSTALLED_KEY] = true;
  10377. components.forEach((c) => app.use(c));
  10378. if (options)
  10379. provideGlobalConfig(options, app, true);
  10380. };
  10381. return {
  10382. version: version$1,
  10383. install
  10384. };
  10385. };
  10386. const affixProps = buildProps({
  10387. zIndex: {
  10388. type: definePropType([Number, String]),
  10389. default: 100
  10390. },
  10391. target: {
  10392. type: String,
  10393. default: ""
  10394. },
  10395. offset: {
  10396. type: Number,
  10397. default: 0
  10398. },
  10399. position: {
  10400. type: String,
  10401. values: ["top", "bottom"],
  10402. default: "top"
  10403. }
  10404. });
  10405. const affixEmits = {
  10406. scroll: ({ scrollTop, fixed }) => isNumber$1(scrollTop) && isBoolean$1(fixed),
  10407. [CHANGE_EVENT]: (fixed) => isBoolean$1(fixed)
  10408. };
  10409. var _export_sfc = (sfc, props) => {
  10410. const target = sfc.__vccOpts || sfc;
  10411. for (const [key, val] of props) {
  10412. target[key] = val;
  10413. }
  10414. return target;
  10415. };
  10416. const COMPONENT_NAME$n = "ElAffix";
  10417. const __default__$1C = vue.defineComponent({
  10418. name: COMPONENT_NAME$n
  10419. });
  10420. const _sfc_main$2i = /* @__PURE__ */ vue.defineComponent({
  10421. ...__default__$1C,
  10422. props: affixProps,
  10423. emits: affixEmits,
  10424. setup(__props, { expose, emit }) {
  10425. const props = __props;
  10426. const ns = useNamespace("affix");
  10427. const target = vue.shallowRef();
  10428. const root = vue.shallowRef();
  10429. const scrollContainer = vue.shallowRef();
  10430. const { height: windowHeight } = useWindowSize();
  10431. const {
  10432. height: rootHeight,
  10433. width: rootWidth,
  10434. top: rootTop,
  10435. bottom: rootBottom,
  10436. update: updateRoot
  10437. } = useElementBounding(root, { windowScroll: false });
  10438. const targetRect = useElementBounding(target);
  10439. const fixed = vue.ref(false);
  10440. const scrollTop = vue.ref(0);
  10441. const transform = vue.ref(0);
  10442. const rootStyle = vue.computed(() => {
  10443. return {
  10444. height: fixed.value ? `${rootHeight.value}px` : "",
  10445. width: fixed.value ? `${rootWidth.value}px` : ""
  10446. };
  10447. });
  10448. const affixStyle = vue.computed(() => {
  10449. if (!fixed.value)
  10450. return {};
  10451. const offset = props.offset ? addUnit(props.offset) : 0;
  10452. return {
  10453. height: `${rootHeight.value}px`,
  10454. width: `${rootWidth.value}px`,
  10455. top: props.position === "top" ? offset : "",
  10456. bottom: props.position === "bottom" ? offset : "",
  10457. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10458. zIndex: props.zIndex
  10459. };
  10460. });
  10461. const update = () => {
  10462. if (!scrollContainer.value)
  10463. return;
  10464. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10465. if (props.position === "top") {
  10466. if (props.target) {
  10467. const difference = targetRect.bottom.value - props.offset - rootHeight.value;
  10468. fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
  10469. transform.value = difference < 0 ? difference : 0;
  10470. } else {
  10471. fixed.value = props.offset > rootTop.value;
  10472. }
  10473. } else if (props.target) {
  10474. const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
  10475. fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10476. transform.value = difference < 0 ? -difference : 0;
  10477. } else {
  10478. fixed.value = windowHeight.value - props.offset < rootBottom.value;
  10479. }
  10480. };
  10481. const handleScroll = () => {
  10482. updateRoot();
  10483. emit("scroll", {
  10484. scrollTop: scrollTop.value,
  10485. fixed: fixed.value
  10486. });
  10487. };
  10488. vue.watch(fixed, (val) => emit("change", val));
  10489. vue.onMounted(() => {
  10490. var _a;
  10491. if (props.target) {
  10492. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10493. if (!target.value)
  10494. throwError(COMPONENT_NAME$n, `Target is not existed: ${props.target}`);
  10495. } else {
  10496. target.value = document.documentElement;
  10497. }
  10498. scrollContainer.value = getScrollContainer(root.value, true);
  10499. updateRoot();
  10500. });
  10501. useEventListener(scrollContainer, "scroll", handleScroll);
  10502. vue.watchEffect(update);
  10503. expose({
  10504. update,
  10505. updateRoot
  10506. });
  10507. return (_ctx, _cache) => {
  10508. return vue.openBlock(), vue.createElementBlock("div", {
  10509. ref_key: "root",
  10510. ref: root,
  10511. class: vue.normalizeClass(vue.unref(ns).b()),
  10512. style: vue.normalizeStyle(vue.unref(rootStyle))
  10513. }, [
  10514. vue.createElementVNode("div", {
  10515. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  10516. style: vue.normalizeStyle(vue.unref(affixStyle))
  10517. }, [
  10518. vue.renderSlot(_ctx.$slots, "default")
  10519. ], 6)
  10520. ], 6);
  10521. };
  10522. }
  10523. });
  10524. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "affix.vue"]]);
  10525. const ElAffix = withInstall(Affix);
  10526. const iconProps = buildProps({
  10527. size: {
  10528. type: definePropType([Number, String])
  10529. },
  10530. color: {
  10531. type: String
  10532. }
  10533. });
  10534. const __default__$1B = vue.defineComponent({
  10535. name: "ElIcon",
  10536. inheritAttrs: false
  10537. });
  10538. const _sfc_main$2h = /* @__PURE__ */ vue.defineComponent({
  10539. ...__default__$1B,
  10540. props: iconProps,
  10541. setup(__props) {
  10542. const props = __props;
  10543. const ns = useNamespace("icon");
  10544. const style = vue.computed(() => {
  10545. const { size, color } = props;
  10546. if (!size && !color)
  10547. return {};
  10548. return {
  10549. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10550. "--color": color
  10551. };
  10552. });
  10553. return (_ctx, _cache) => {
  10554. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  10555. class: vue.unref(ns).b(),
  10556. style: vue.unref(style)
  10557. }, _ctx.$attrs), [
  10558. vue.renderSlot(_ctx.$slots, "default")
  10559. ], 16);
  10560. };
  10561. }
  10562. });
  10563. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "icon.vue"]]);
  10564. const ElIcon = withInstall(Icon);
  10565. const alertEffects = ["light", "dark"];
  10566. const alertProps = buildProps({
  10567. title: {
  10568. type: String,
  10569. default: ""
  10570. },
  10571. description: {
  10572. type: String,
  10573. default: ""
  10574. },
  10575. type: {
  10576. type: String,
  10577. values: keysOf(TypeComponentsMap),
  10578. default: "info"
  10579. },
  10580. closable: {
  10581. type: Boolean,
  10582. default: true
  10583. },
  10584. closeText: {
  10585. type: String,
  10586. default: ""
  10587. },
  10588. showIcon: Boolean,
  10589. center: Boolean,
  10590. effect: {
  10591. type: String,
  10592. values: alertEffects,
  10593. default: "light"
  10594. }
  10595. });
  10596. const alertEmits = {
  10597. close: (evt) => evt instanceof MouseEvent
  10598. };
  10599. const __default__$1A = vue.defineComponent({
  10600. name: "ElAlert"
  10601. });
  10602. const _sfc_main$2g = /* @__PURE__ */ vue.defineComponent({
  10603. ...__default__$1A,
  10604. props: alertProps,
  10605. emits: alertEmits,
  10606. setup(__props, { emit }) {
  10607. const props = __props;
  10608. const { Close } = TypeComponents;
  10609. const slots = vue.useSlots();
  10610. const ns = useNamespace("alert");
  10611. const visible = vue.ref(true);
  10612. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  10613. const iconClass = vue.computed(() => [
  10614. ns.e("icon"),
  10615. { [ns.is("big")]: !!props.description || !!slots.default }
  10616. ]);
  10617. const isBoldTitle = vue.computed(() => {
  10618. return { [ns.is("bold")]: props.description || slots.default };
  10619. });
  10620. const close = (evt) => {
  10621. visible.value = false;
  10622. emit("close", evt);
  10623. };
  10624. return (_ctx, _cache) => {
  10625. return vue.openBlock(), vue.createBlock(vue.Transition, {
  10626. name: vue.unref(ns).b("fade"),
  10627. persisted: ""
  10628. }, {
  10629. default: vue.withCtx(() => [
  10630. vue.withDirectives(vue.createElementVNode("div", {
  10631. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.type), vue.unref(ns).is("center", _ctx.center), vue.unref(ns).is(_ctx.effect)]),
  10632. role: "alert"
  10633. }, [
  10634. _ctx.showIcon && vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10635. key: 0,
  10636. class: vue.normalizeClass(vue.unref(iconClass))
  10637. }, {
  10638. default: vue.withCtx(() => [
  10639. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  10640. ]),
  10641. _: 1
  10642. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  10643. vue.createElementVNode("div", {
  10644. class: vue.normalizeClass(vue.unref(ns).e("content"))
  10645. }, [
  10646. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  10647. key: 0,
  10648. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(isBoldTitle)])
  10649. }, [
  10650. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  10651. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  10652. ])
  10653. ], 2)) : vue.createCommentVNode("v-if", true),
  10654. _ctx.$slots.default || _ctx.description ? (vue.openBlock(), vue.createElementBlock("p", {
  10655. key: 1,
  10656. class: vue.normalizeClass(vue.unref(ns).e("description"))
  10657. }, [
  10658. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  10659. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  10660. ])
  10661. ], 2)) : vue.createCommentVNode("v-if", true),
  10662. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  10663. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  10664. key: 0,
  10665. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  10666. onClick: close
  10667. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10668. key: 1,
  10669. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  10670. onClick: close
  10671. }, {
  10672. default: vue.withCtx(() => [
  10673. vue.createVNode(vue.unref(Close))
  10674. ]),
  10675. _: 1
  10676. }, 8, ["class"]))
  10677. ], 64)) : vue.createCommentVNode("v-if", true)
  10678. ], 2)
  10679. ], 2), [
  10680. [vue.vShow, visible.value]
  10681. ])
  10682. ]),
  10683. _: 3
  10684. }, 8, ["name"]);
  10685. };
  10686. }
  10687. });
  10688. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "alert.vue"]]);
  10689. const ElAlert = withInstall(Alert);
  10690. const formContextKey = Symbol("formContextKey");
  10691. const formItemContextKey = Symbol("formItemContextKey");
  10692. const useFormSize = (fallback, ignore = {}) => {
  10693. const emptyRef = vue.ref(void 0);
  10694. const size = ignore.prop ? emptyRef : useProp("size");
  10695. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  10696. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  10697. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  10698. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  10699. };
  10700. const useFormDisabled = (fallback) => {
  10701. const disabled = useProp("disabled");
  10702. const form = vue.inject(formContextKey, void 0);
  10703. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  10704. };
  10705. const useSize = useFormSize;
  10706. const useDisabled = useFormDisabled;
  10707. const useFormItem = () => {
  10708. const form = vue.inject(formContextKey, void 0);
  10709. const formItem = vue.inject(formItemContextKey, void 0);
  10710. return {
  10711. form,
  10712. formItem
  10713. };
  10714. };
  10715. const useFormItemInputId = (props, {
  10716. formItemContext,
  10717. disableIdGeneration,
  10718. disableIdManagement
  10719. }) => {
  10720. if (!disableIdGeneration) {
  10721. disableIdGeneration = vue.ref(false);
  10722. }
  10723. if (!disableIdManagement) {
  10724. disableIdManagement = vue.ref(false);
  10725. }
  10726. const inputId = vue.ref();
  10727. let idUnwatch = void 0;
  10728. const isLabeledByFormItem = vue.computed(() => {
  10729. var _a;
  10730. return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  10731. });
  10732. vue.onMounted(() => {
  10733. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  10734. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  10735. if (newId !== inputId.value) {
  10736. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  10737. inputId.value && formItemContext.removeInputId(inputId.value);
  10738. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  10739. formItemContext.addInputId(newId);
  10740. }
  10741. }
  10742. inputId.value = newId;
  10743. }
  10744. }, { immediate: true });
  10745. });
  10746. vue.onUnmounted(() => {
  10747. idUnwatch && idUnwatch();
  10748. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  10749. inputId.value && formItemContext.removeInputId(inputId.value);
  10750. }
  10751. });
  10752. return {
  10753. isLabeledByFormItem,
  10754. inputId
  10755. };
  10756. };
  10757. const formMetaProps = buildProps({
  10758. size: {
  10759. type: String,
  10760. values: componentSizes
  10761. },
  10762. disabled: Boolean
  10763. });
  10764. const formProps = buildProps({
  10765. ...formMetaProps,
  10766. model: Object,
  10767. rules: {
  10768. type: definePropType(Object)
  10769. },
  10770. labelPosition: {
  10771. type: String,
  10772. values: ["left", "right", "top"],
  10773. default: "right"
  10774. },
  10775. requireAsteriskPosition: {
  10776. type: String,
  10777. values: ["left", "right"],
  10778. default: "left"
  10779. },
  10780. labelWidth: {
  10781. type: [String, Number],
  10782. default: ""
  10783. },
  10784. labelSuffix: {
  10785. type: String,
  10786. default: ""
  10787. },
  10788. inline: Boolean,
  10789. inlineMessage: Boolean,
  10790. statusIcon: Boolean,
  10791. showMessage: {
  10792. type: Boolean,
  10793. default: true
  10794. },
  10795. validateOnRuleChange: {
  10796. type: Boolean,
  10797. default: true
  10798. },
  10799. hideRequiredAsterisk: {
  10800. type: Boolean,
  10801. default: false
  10802. },
  10803. scrollToError: Boolean,
  10804. scrollIntoViewOptions: {
  10805. type: [Object, Boolean]
  10806. }
  10807. });
  10808. const formEmits = {
  10809. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean$1(isValid) && isString$1(message)
  10810. };
  10811. function useFormLabelWidth() {
  10812. const potentialLabelWidthArr = vue.ref([]);
  10813. const autoLabelWidth = vue.computed(() => {
  10814. if (!potentialLabelWidthArr.value.length)
  10815. return "0";
  10816. const max = Math.max(...potentialLabelWidthArr.value);
  10817. return max ? `${max}px` : "";
  10818. });
  10819. function getLabelWidthIndex(width) {
  10820. const index = potentialLabelWidthArr.value.indexOf(width);
  10821. if (index === -1 && autoLabelWidth.value === "0") ;
  10822. return index;
  10823. }
  10824. function registerLabelWidth(val, oldVal) {
  10825. if (val && oldVal) {
  10826. const index = getLabelWidthIndex(oldVal);
  10827. potentialLabelWidthArr.value.splice(index, 1, val);
  10828. } else if (val) {
  10829. potentialLabelWidthArr.value.push(val);
  10830. }
  10831. }
  10832. function deregisterLabelWidth(val) {
  10833. const index = getLabelWidthIndex(val);
  10834. if (index > -1) {
  10835. potentialLabelWidthArr.value.splice(index, 1);
  10836. }
  10837. }
  10838. return {
  10839. autoLabelWidth,
  10840. registerLabelWidth,
  10841. deregisterLabelWidth
  10842. };
  10843. }
  10844. const filterFields = (fields, props) => {
  10845. const normalized = castArray$1(props);
  10846. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  10847. };
  10848. const COMPONENT_NAME$m = "ElForm";
  10849. const __default__$1z = vue.defineComponent({
  10850. name: COMPONENT_NAME$m
  10851. });
  10852. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  10853. ...__default__$1z,
  10854. props: formProps,
  10855. emits: formEmits,
  10856. setup(__props, { expose, emit }) {
  10857. const props = __props;
  10858. const fields = [];
  10859. const formSize = useFormSize();
  10860. const ns = useNamespace("form");
  10861. const formClasses = vue.computed(() => {
  10862. const { labelPosition, inline } = props;
  10863. return [
  10864. ns.b(),
  10865. ns.m(formSize.value || "default"),
  10866. {
  10867. [ns.m(`label-${labelPosition}`)]: labelPosition,
  10868. [ns.m("inline")]: inline
  10869. }
  10870. ];
  10871. });
  10872. const addField = (field) => {
  10873. fields.push(field);
  10874. };
  10875. const removeField = (field) => {
  10876. if (field.prop) {
  10877. fields.splice(fields.indexOf(field), 1);
  10878. }
  10879. };
  10880. const resetFields = (properties = []) => {
  10881. if (!props.model) {
  10882. return;
  10883. }
  10884. filterFields(fields, properties).forEach((field) => field.resetField());
  10885. };
  10886. const clearValidate = (props2 = []) => {
  10887. filterFields(fields, props2).forEach((field) => field.clearValidate());
  10888. };
  10889. const isValidatable = vue.computed(() => {
  10890. const hasModel = !!props.model;
  10891. return hasModel;
  10892. });
  10893. const obtainValidateFields = (props2) => {
  10894. if (fields.length === 0)
  10895. return [];
  10896. const filteredFields = filterFields(fields, props2);
  10897. if (!filteredFields.length) {
  10898. return [];
  10899. }
  10900. return filteredFields;
  10901. };
  10902. const validate = async (callback) => validateField(void 0, callback);
  10903. const doValidateField = async (props2 = []) => {
  10904. if (!isValidatable.value)
  10905. return false;
  10906. const fields2 = obtainValidateFields(props2);
  10907. if (fields2.length === 0)
  10908. return true;
  10909. let validationErrors = {};
  10910. for (const field of fields2) {
  10911. try {
  10912. await field.validate("");
  10913. } catch (fields3) {
  10914. validationErrors = {
  10915. ...validationErrors,
  10916. ...fields3
  10917. };
  10918. }
  10919. }
  10920. if (Object.keys(validationErrors).length === 0)
  10921. return true;
  10922. return Promise.reject(validationErrors);
  10923. };
  10924. const validateField = async (modelProps = [], callback) => {
  10925. const shouldThrow = !isFunction$1(callback);
  10926. try {
  10927. const result = await doValidateField(modelProps);
  10928. if (result === true) {
  10929. callback == null ? void 0 : callback(result);
  10930. }
  10931. return result;
  10932. } catch (e) {
  10933. if (e instanceof Error)
  10934. throw e;
  10935. const invalidFields = e;
  10936. if (props.scrollToError) {
  10937. scrollToField(Object.keys(invalidFields)[0]);
  10938. }
  10939. callback == null ? void 0 : callback(false, invalidFields);
  10940. return shouldThrow && Promise.reject(invalidFields);
  10941. }
  10942. };
  10943. const scrollToField = (prop) => {
  10944. var _a;
  10945. const field = filterFields(fields, prop)[0];
  10946. if (field) {
  10947. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  10948. }
  10949. };
  10950. vue.watch(() => props.rules, () => {
  10951. if (props.validateOnRuleChange) {
  10952. validate().catch((err) => debugWarn());
  10953. }
  10954. }, { deep: true });
  10955. vue.provide(formContextKey, vue.reactive({
  10956. ...vue.toRefs(props),
  10957. emit,
  10958. resetFields,
  10959. clearValidate,
  10960. validateField,
  10961. addField,
  10962. removeField,
  10963. ...useFormLabelWidth()
  10964. }));
  10965. expose({
  10966. validate,
  10967. validateField,
  10968. resetFields,
  10969. clearValidate,
  10970. scrollToField
  10971. });
  10972. return (_ctx, _cache) => {
  10973. return vue.openBlock(), vue.createElementBlock("form", {
  10974. class: vue.normalizeClass(vue.unref(formClasses))
  10975. }, [
  10976. vue.renderSlot(_ctx.$slots, "default")
  10977. ], 2);
  10978. };
  10979. }
  10980. });
  10981. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "form.vue"]]);
  10982. function _extends() {
  10983. _extends = Object.assign ? Object.assign.bind() : function(target) {
  10984. for (var i = 1; i < arguments.length; i++) {
  10985. var source = arguments[i];
  10986. for (var key in source) {
  10987. if (Object.prototype.hasOwnProperty.call(source, key)) {
  10988. target[key] = source[key];
  10989. }
  10990. }
  10991. }
  10992. return target;
  10993. };
  10994. return _extends.apply(this, arguments);
  10995. }
  10996. function _inheritsLoose(subClass, superClass) {
  10997. subClass.prototype = Object.create(superClass.prototype);
  10998. subClass.prototype.constructor = subClass;
  10999. _setPrototypeOf(subClass, superClass);
  11000. }
  11001. function _getPrototypeOf(o) {
  11002. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  11003. return o2.__proto__ || Object.getPrototypeOf(o2);
  11004. };
  11005. return _getPrototypeOf(o);
  11006. }
  11007. function _setPrototypeOf(o, p) {
  11008. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  11009. o2.__proto__ = p2;
  11010. return o2;
  11011. };
  11012. return _setPrototypeOf(o, p);
  11013. }
  11014. function _isNativeReflectConstruct() {
  11015. if (typeof Reflect === "undefined" || !Reflect.construct)
  11016. return false;
  11017. if (Reflect.construct.sham)
  11018. return false;
  11019. if (typeof Proxy === "function")
  11020. return true;
  11021. try {
  11022. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  11023. }));
  11024. return true;
  11025. } catch (e) {
  11026. return false;
  11027. }
  11028. }
  11029. function _construct(Parent, args, Class) {
  11030. if (_isNativeReflectConstruct()) {
  11031. _construct = Reflect.construct.bind();
  11032. } else {
  11033. _construct = function _construct2(Parent2, args2, Class2) {
  11034. var a = [null];
  11035. a.push.apply(a, args2);
  11036. var Constructor = Function.bind.apply(Parent2, a);
  11037. var instance = new Constructor();
  11038. if (Class2)
  11039. _setPrototypeOf(instance, Class2.prototype);
  11040. return instance;
  11041. };
  11042. }
  11043. return _construct.apply(null, arguments);
  11044. }
  11045. function _isNativeFunction(fn) {
  11046. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11047. }
  11048. function _wrapNativeSuper(Class) {
  11049. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11050. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  11051. if (Class2 === null || !_isNativeFunction(Class2))
  11052. return Class2;
  11053. if (typeof Class2 !== "function") {
  11054. throw new TypeError("Super expression must either be null or a function");
  11055. }
  11056. if (typeof _cache !== "undefined") {
  11057. if (_cache.has(Class2))
  11058. return _cache.get(Class2);
  11059. _cache.set(Class2, Wrapper);
  11060. }
  11061. function Wrapper() {
  11062. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  11063. }
  11064. Wrapper.prototype = Object.create(Class2.prototype, {
  11065. constructor: {
  11066. value: Wrapper,
  11067. enumerable: false,
  11068. writable: true,
  11069. configurable: true
  11070. }
  11071. });
  11072. return _setPrototypeOf(Wrapper, Class2);
  11073. };
  11074. return _wrapNativeSuper(Class);
  11075. }
  11076. var formatRegExp = /%[sdj%]/g;
  11077. var warning = function warning2() {
  11078. };
  11079. if (typeof process !== "undefined" && process.env && false) {
  11080. warning = function warning3(type4, errors) {
  11081. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  11082. if (errors.every(function(e) {
  11083. return typeof e === "string";
  11084. })) {
  11085. console.warn(type4, errors);
  11086. }
  11087. }
  11088. };
  11089. }
  11090. function convertFieldsError(errors) {
  11091. if (!errors || !errors.length)
  11092. return null;
  11093. var fields = {};
  11094. errors.forEach(function(error) {
  11095. var field = error.field;
  11096. fields[field] = fields[field] || [];
  11097. fields[field].push(error);
  11098. });
  11099. return fields;
  11100. }
  11101. function format(template) {
  11102. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11103. args[_key - 1] = arguments[_key];
  11104. }
  11105. var i = 0;
  11106. var len = args.length;
  11107. if (typeof template === "function") {
  11108. return template.apply(null, args);
  11109. }
  11110. if (typeof template === "string") {
  11111. var str = template.replace(formatRegExp, function(x) {
  11112. if (x === "%%") {
  11113. return "%";
  11114. }
  11115. if (i >= len) {
  11116. return x;
  11117. }
  11118. switch (x) {
  11119. case "%s":
  11120. return String(args[i++]);
  11121. case "%d":
  11122. return Number(args[i++]);
  11123. case "%j":
  11124. try {
  11125. return JSON.stringify(args[i++]);
  11126. } catch (_) {
  11127. return "[Circular]";
  11128. }
  11129. break;
  11130. default:
  11131. return x;
  11132. }
  11133. });
  11134. return str;
  11135. }
  11136. return template;
  11137. }
  11138. function isNativeStringType(type4) {
  11139. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  11140. }
  11141. function isEmptyValue(value, type4) {
  11142. if (value === void 0 || value === null) {
  11143. return true;
  11144. }
  11145. if (type4 === "array" && Array.isArray(value) && !value.length) {
  11146. return true;
  11147. }
  11148. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  11149. return true;
  11150. }
  11151. return false;
  11152. }
  11153. function asyncParallelArray(arr, func, callback) {
  11154. var results = [];
  11155. var total = 0;
  11156. var arrLength = arr.length;
  11157. function count(errors) {
  11158. results.push.apply(results, errors || []);
  11159. total++;
  11160. if (total === arrLength) {
  11161. callback(results);
  11162. }
  11163. }
  11164. arr.forEach(function(a) {
  11165. func(a, count);
  11166. });
  11167. }
  11168. function asyncSerialArray(arr, func, callback) {
  11169. var index = 0;
  11170. var arrLength = arr.length;
  11171. function next(errors) {
  11172. if (errors && errors.length) {
  11173. callback(errors);
  11174. return;
  11175. }
  11176. var original = index;
  11177. index = index + 1;
  11178. if (original < arrLength) {
  11179. func(arr[original], next);
  11180. } else {
  11181. callback([]);
  11182. }
  11183. }
  11184. next([]);
  11185. }
  11186. function flattenObjArr(objArr) {
  11187. var ret = [];
  11188. Object.keys(objArr).forEach(function(k) {
  11189. ret.push.apply(ret, objArr[k] || []);
  11190. });
  11191. return ret;
  11192. }
  11193. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11194. _inheritsLoose(AsyncValidationError2, _Error);
  11195. function AsyncValidationError2(errors, fields) {
  11196. var _this;
  11197. _this = _Error.call(this, "Async Validation Error") || this;
  11198. _this.errors = errors;
  11199. _this.fields = fields;
  11200. return _this;
  11201. }
  11202. return AsyncValidationError2;
  11203. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11204. function asyncMap(objArr, option, func, callback, source) {
  11205. if (option.first) {
  11206. var _pending = new Promise(function(resolve, reject) {
  11207. var next = function next2(errors) {
  11208. callback(errors);
  11209. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11210. };
  11211. var flattenArr = flattenObjArr(objArr);
  11212. asyncSerialArray(flattenArr, func, next);
  11213. });
  11214. _pending["catch"](function(e) {
  11215. return e;
  11216. });
  11217. return _pending;
  11218. }
  11219. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11220. var objArrKeys = Object.keys(objArr);
  11221. var objArrLength = objArrKeys.length;
  11222. var total = 0;
  11223. var results = [];
  11224. var pending = new Promise(function(resolve, reject) {
  11225. var next = function next2(errors) {
  11226. results.push.apply(results, errors);
  11227. total++;
  11228. if (total === objArrLength) {
  11229. callback(results);
  11230. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11231. }
  11232. };
  11233. if (!objArrKeys.length) {
  11234. callback(results);
  11235. resolve(source);
  11236. }
  11237. objArrKeys.forEach(function(key) {
  11238. var arr = objArr[key];
  11239. if (firstFields.indexOf(key) !== -1) {
  11240. asyncSerialArray(arr, func, next);
  11241. } else {
  11242. asyncParallelArray(arr, func, next);
  11243. }
  11244. });
  11245. });
  11246. pending["catch"](function(e) {
  11247. return e;
  11248. });
  11249. return pending;
  11250. }
  11251. function isErrorObj(obj) {
  11252. return !!(obj && obj.message !== void 0);
  11253. }
  11254. function getValue(value, path) {
  11255. var v = value;
  11256. for (var i = 0; i < path.length; i++) {
  11257. if (v == void 0) {
  11258. return v;
  11259. }
  11260. v = v[path[i]];
  11261. }
  11262. return v;
  11263. }
  11264. function complementError(rule, source) {
  11265. return function(oe) {
  11266. var fieldValue;
  11267. if (rule.fullFields) {
  11268. fieldValue = getValue(source, rule.fullFields);
  11269. } else {
  11270. fieldValue = source[oe.field || rule.fullField];
  11271. }
  11272. if (isErrorObj(oe)) {
  11273. oe.field = oe.field || rule.fullField;
  11274. oe.fieldValue = fieldValue;
  11275. return oe;
  11276. }
  11277. return {
  11278. message: typeof oe === "function" ? oe() : oe,
  11279. fieldValue,
  11280. field: oe.field || rule.fullField
  11281. };
  11282. };
  11283. }
  11284. function deepMerge(target, source) {
  11285. if (source) {
  11286. for (var s in source) {
  11287. if (source.hasOwnProperty(s)) {
  11288. var value = source[s];
  11289. if (typeof value === "object" && typeof target[s] === "object") {
  11290. target[s] = _extends({}, target[s], value);
  11291. } else {
  11292. target[s] = value;
  11293. }
  11294. }
  11295. }
  11296. }
  11297. return target;
  11298. }
  11299. var required$1 = function required(rule, value, source, errors, options, type4) {
  11300. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  11301. errors.push(format(options.messages.required, rule.fullField));
  11302. }
  11303. };
  11304. var whitespace = function whitespace2(rule, value, source, errors, options) {
  11305. if (/^\s+$/.test(value) || value === "") {
  11306. errors.push(format(options.messages.whitespace, rule.fullField));
  11307. }
  11308. };
  11309. var urlReg;
  11310. var getUrlRegex = function() {
  11311. if (urlReg) {
  11312. return urlReg;
  11313. }
  11314. var word = "[a-fA-F\\d:]";
  11315. var b = function b2(options) {
  11316. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11317. };
  11318. 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}";
  11319. var v6seg = "[a-fA-F\\d]{1,4}";
  11320. 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();
  11321. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11322. var v4exact = new RegExp("^" + v4 + "$");
  11323. var v6exact = new RegExp("^" + v6 + "$");
  11324. var ip = function ip2(options) {
  11325. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11326. };
  11327. ip.v4 = function(options) {
  11328. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11329. };
  11330. ip.v6 = function(options) {
  11331. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11332. };
  11333. var protocol = "(?:(?:[a-z]+:)?//)";
  11334. var auth = "(?:\\S+(?::\\S*)?@)?";
  11335. var ipv4 = ip.v4().source;
  11336. var ipv6 = ip.v6().source;
  11337. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  11338. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  11339. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  11340. var port = "(?::\\d{2,5})?";
  11341. var path = '(?:[/?#][^\\s"]*)?';
  11342. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  11343. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11344. return urlReg;
  11345. };
  11346. var pattern$2 = {
  11347. 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,}))$/,
  11348. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11349. };
  11350. var types = {
  11351. integer: function integer(value) {
  11352. return types.number(value) && parseInt(value, 10) === value;
  11353. },
  11354. "float": function float(value) {
  11355. return types.number(value) && !types.integer(value);
  11356. },
  11357. array: function array(value) {
  11358. return Array.isArray(value);
  11359. },
  11360. regexp: function regexp(value) {
  11361. if (value instanceof RegExp) {
  11362. return true;
  11363. }
  11364. try {
  11365. return !!new RegExp(value);
  11366. } catch (e) {
  11367. return false;
  11368. }
  11369. },
  11370. date: function date(value) {
  11371. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11372. },
  11373. number: function number(value) {
  11374. if (isNaN(value)) {
  11375. return false;
  11376. }
  11377. return typeof value === "number";
  11378. },
  11379. object: function object(value) {
  11380. return typeof value === "object" && !types.array(value);
  11381. },
  11382. method: function method(value) {
  11383. return typeof value === "function";
  11384. },
  11385. email: function email(value) {
  11386. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11387. },
  11388. url: function url(value) {
  11389. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11390. },
  11391. hex: function hex(value) {
  11392. return typeof value === "string" && !!value.match(pattern$2.hex);
  11393. }
  11394. };
  11395. var type$1 = function type(rule, value, source, errors, options) {
  11396. if (rule.required && value === void 0) {
  11397. required$1(rule, value, source, errors, options);
  11398. return;
  11399. }
  11400. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  11401. var ruleType = rule.type;
  11402. if (custom.indexOf(ruleType) > -1) {
  11403. if (!types[ruleType](value)) {
  11404. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11405. }
  11406. } else if (ruleType && typeof value !== rule.type) {
  11407. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11408. }
  11409. };
  11410. var range = function range2(rule, value, source, errors, options) {
  11411. var len = typeof rule.len === "number";
  11412. var min = typeof rule.min === "number";
  11413. var max = typeof rule.max === "number";
  11414. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  11415. var val = value;
  11416. var key = null;
  11417. var num = typeof value === "number";
  11418. var str = typeof value === "string";
  11419. var arr = Array.isArray(value);
  11420. if (num) {
  11421. key = "number";
  11422. } else if (str) {
  11423. key = "string";
  11424. } else if (arr) {
  11425. key = "array";
  11426. }
  11427. if (!key) {
  11428. return false;
  11429. }
  11430. if (arr) {
  11431. val = value.length;
  11432. }
  11433. if (str) {
  11434. val = value.replace(spRegexp, "_").length;
  11435. }
  11436. if (len) {
  11437. if (val !== rule.len) {
  11438. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  11439. }
  11440. } else if (min && !max && val < rule.min) {
  11441. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  11442. } else if (max && !min && val > rule.max) {
  11443. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  11444. } else if (min && max && (val < rule.min || val > rule.max)) {
  11445. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  11446. }
  11447. };
  11448. var ENUM$1 = "enum";
  11449. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  11450. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  11451. if (rule[ENUM$1].indexOf(value) === -1) {
  11452. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  11453. }
  11454. };
  11455. var pattern$1 = function pattern(rule, value, source, errors, options) {
  11456. if (rule.pattern) {
  11457. if (rule.pattern instanceof RegExp) {
  11458. rule.pattern.lastIndex = 0;
  11459. if (!rule.pattern.test(value)) {
  11460. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11461. }
  11462. } else if (typeof rule.pattern === "string") {
  11463. var _pattern = new RegExp(rule.pattern);
  11464. if (!_pattern.test(value)) {
  11465. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11466. }
  11467. }
  11468. }
  11469. };
  11470. var rules = {
  11471. required: required$1,
  11472. whitespace,
  11473. type: type$1,
  11474. range,
  11475. "enum": enumerable$1,
  11476. pattern: pattern$1
  11477. };
  11478. var string = function string2(rule, value, callback, source, options) {
  11479. var errors = [];
  11480. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11481. if (validate) {
  11482. if (isEmptyValue(value, "string") && !rule.required) {
  11483. return callback();
  11484. }
  11485. rules.required(rule, value, source, errors, options, "string");
  11486. if (!isEmptyValue(value, "string")) {
  11487. rules.type(rule, value, source, errors, options);
  11488. rules.range(rule, value, source, errors, options);
  11489. rules.pattern(rule, value, source, errors, options);
  11490. if (rule.whitespace === true) {
  11491. rules.whitespace(rule, value, source, errors, options);
  11492. }
  11493. }
  11494. }
  11495. callback(errors);
  11496. };
  11497. var method2 = function method3(rule, value, callback, source, options) {
  11498. var errors = [];
  11499. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11500. if (validate) {
  11501. if (isEmptyValue(value) && !rule.required) {
  11502. return callback();
  11503. }
  11504. rules.required(rule, value, source, errors, options);
  11505. if (value !== void 0) {
  11506. rules.type(rule, value, source, errors, options);
  11507. }
  11508. }
  11509. callback(errors);
  11510. };
  11511. var number2 = function number3(rule, value, callback, source, options) {
  11512. var errors = [];
  11513. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11514. if (validate) {
  11515. if (value === "") {
  11516. value = void 0;
  11517. }
  11518. if (isEmptyValue(value) && !rule.required) {
  11519. return callback();
  11520. }
  11521. rules.required(rule, value, source, errors, options);
  11522. if (value !== void 0) {
  11523. rules.type(rule, value, source, errors, options);
  11524. rules.range(rule, value, source, errors, options);
  11525. }
  11526. }
  11527. callback(errors);
  11528. };
  11529. var _boolean = function _boolean2(rule, value, callback, source, options) {
  11530. var errors = [];
  11531. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11532. if (validate) {
  11533. if (isEmptyValue(value) && !rule.required) {
  11534. return callback();
  11535. }
  11536. rules.required(rule, value, source, errors, options);
  11537. if (value !== void 0) {
  11538. rules.type(rule, value, source, errors, options);
  11539. }
  11540. }
  11541. callback(errors);
  11542. };
  11543. var regexp2 = function regexp3(rule, value, callback, source, options) {
  11544. var errors = [];
  11545. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11546. if (validate) {
  11547. if (isEmptyValue(value) && !rule.required) {
  11548. return callback();
  11549. }
  11550. rules.required(rule, value, source, errors, options);
  11551. if (!isEmptyValue(value)) {
  11552. rules.type(rule, value, source, errors, options);
  11553. }
  11554. }
  11555. callback(errors);
  11556. };
  11557. var integer2 = function integer3(rule, value, callback, source, options) {
  11558. var errors = [];
  11559. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11560. if (validate) {
  11561. if (isEmptyValue(value) && !rule.required) {
  11562. return callback();
  11563. }
  11564. rules.required(rule, value, source, errors, options);
  11565. if (value !== void 0) {
  11566. rules.type(rule, value, source, errors, options);
  11567. rules.range(rule, value, source, errors, options);
  11568. }
  11569. }
  11570. callback(errors);
  11571. };
  11572. var floatFn = function floatFn2(rule, value, callback, source, options) {
  11573. var errors = [];
  11574. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11575. if (validate) {
  11576. if (isEmptyValue(value) && !rule.required) {
  11577. return callback();
  11578. }
  11579. rules.required(rule, value, source, errors, options);
  11580. if (value !== void 0) {
  11581. rules.type(rule, value, source, errors, options);
  11582. rules.range(rule, value, source, errors, options);
  11583. }
  11584. }
  11585. callback(errors);
  11586. };
  11587. var array2 = function array3(rule, value, callback, source, options) {
  11588. var errors = [];
  11589. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11590. if (validate) {
  11591. if ((value === void 0 || value === null) && !rule.required) {
  11592. return callback();
  11593. }
  11594. rules.required(rule, value, source, errors, options, "array");
  11595. if (value !== void 0 && value !== null) {
  11596. rules.type(rule, value, source, errors, options);
  11597. rules.range(rule, value, source, errors, options);
  11598. }
  11599. }
  11600. callback(errors);
  11601. };
  11602. var object2 = function object3(rule, value, callback, source, options) {
  11603. var errors = [];
  11604. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11605. if (validate) {
  11606. if (isEmptyValue(value) && !rule.required) {
  11607. return callback();
  11608. }
  11609. rules.required(rule, value, source, errors, options);
  11610. if (value !== void 0) {
  11611. rules.type(rule, value, source, errors, options);
  11612. }
  11613. }
  11614. callback(errors);
  11615. };
  11616. var ENUM = "enum";
  11617. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  11618. var errors = [];
  11619. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11620. if (validate) {
  11621. if (isEmptyValue(value) && !rule.required) {
  11622. return callback();
  11623. }
  11624. rules.required(rule, value, source, errors, options);
  11625. if (value !== void 0) {
  11626. rules[ENUM](rule, value, source, errors, options);
  11627. }
  11628. }
  11629. callback(errors);
  11630. };
  11631. var pattern2 = function pattern3(rule, value, callback, source, options) {
  11632. var errors = [];
  11633. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11634. if (validate) {
  11635. if (isEmptyValue(value, "string") && !rule.required) {
  11636. return callback();
  11637. }
  11638. rules.required(rule, value, source, errors, options);
  11639. if (!isEmptyValue(value, "string")) {
  11640. rules.pattern(rule, value, source, errors, options);
  11641. }
  11642. }
  11643. callback(errors);
  11644. };
  11645. var date2 = function date3(rule, value, callback, source, options) {
  11646. var errors = [];
  11647. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11648. if (validate) {
  11649. if (isEmptyValue(value, "date") && !rule.required) {
  11650. return callback();
  11651. }
  11652. rules.required(rule, value, source, errors, options);
  11653. if (!isEmptyValue(value, "date")) {
  11654. var dateObject;
  11655. if (value instanceof Date) {
  11656. dateObject = value;
  11657. } else {
  11658. dateObject = new Date(value);
  11659. }
  11660. rules.type(rule, dateObject, source, errors, options);
  11661. if (dateObject) {
  11662. rules.range(rule, dateObject.getTime(), source, errors, options);
  11663. }
  11664. }
  11665. }
  11666. callback(errors);
  11667. };
  11668. var required2 = function required3(rule, value, callback, source, options) {
  11669. var errors = [];
  11670. var type4 = Array.isArray(value) ? "array" : typeof value;
  11671. rules.required(rule, value, source, errors, options, type4);
  11672. callback(errors);
  11673. };
  11674. var type2 = function type3(rule, value, callback, source, options) {
  11675. var ruleType = rule.type;
  11676. var errors = [];
  11677. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11678. if (validate) {
  11679. if (isEmptyValue(value, ruleType) && !rule.required) {
  11680. return callback();
  11681. }
  11682. rules.required(rule, value, source, errors, options, ruleType);
  11683. if (!isEmptyValue(value, ruleType)) {
  11684. rules.type(rule, value, source, errors, options);
  11685. }
  11686. }
  11687. callback(errors);
  11688. };
  11689. var any = function any2(rule, value, callback, source, options) {
  11690. var errors = [];
  11691. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11692. if (validate) {
  11693. if (isEmptyValue(value) && !rule.required) {
  11694. return callback();
  11695. }
  11696. rules.required(rule, value, source, errors, options);
  11697. }
  11698. callback(errors);
  11699. };
  11700. var validators = {
  11701. string,
  11702. method: method2,
  11703. number: number2,
  11704. "boolean": _boolean,
  11705. regexp: regexp2,
  11706. integer: integer2,
  11707. "float": floatFn,
  11708. array: array2,
  11709. object: object2,
  11710. "enum": enumerable2,
  11711. pattern: pattern2,
  11712. date: date2,
  11713. url: type2,
  11714. hex: type2,
  11715. email: type2,
  11716. required: required2,
  11717. any
  11718. };
  11719. function newMessages() {
  11720. return {
  11721. "default": "Validation error on field %s",
  11722. required: "%s is required",
  11723. "enum": "%s must be one of %s",
  11724. whitespace: "%s cannot be empty",
  11725. date: {
  11726. format: "%s date %s is invalid for format %s",
  11727. parse: "%s date could not be parsed, %s is invalid ",
  11728. invalid: "%s date %s is invalid"
  11729. },
  11730. types: {
  11731. string: "%s is not a %s",
  11732. method: "%s is not a %s (function)",
  11733. array: "%s is not an %s",
  11734. object: "%s is not an %s",
  11735. number: "%s is not a %s",
  11736. date: "%s is not a %s",
  11737. "boolean": "%s is not a %s",
  11738. integer: "%s is not an %s",
  11739. "float": "%s is not a %s",
  11740. regexp: "%s is not a valid %s",
  11741. email: "%s is not a valid %s",
  11742. url: "%s is not a valid %s",
  11743. hex: "%s is not a valid %s"
  11744. },
  11745. string: {
  11746. len: "%s must be exactly %s characters",
  11747. min: "%s must be at least %s characters",
  11748. max: "%s cannot be longer than %s characters",
  11749. range: "%s must be between %s and %s characters"
  11750. },
  11751. number: {
  11752. len: "%s must equal %s",
  11753. min: "%s cannot be less than %s",
  11754. max: "%s cannot be greater than %s",
  11755. range: "%s must be between %s and %s"
  11756. },
  11757. array: {
  11758. len: "%s must be exactly %s in length",
  11759. min: "%s cannot be less than %s in length",
  11760. max: "%s cannot be greater than %s in length",
  11761. range: "%s must be between %s and %s in length"
  11762. },
  11763. pattern: {
  11764. mismatch: "%s value %s does not match pattern %s"
  11765. },
  11766. clone: function clone() {
  11767. var cloned = JSON.parse(JSON.stringify(this));
  11768. cloned.clone = this.clone;
  11769. return cloned;
  11770. }
  11771. };
  11772. }
  11773. var messages = newMessages();
  11774. var Schema = /* @__PURE__ */ function() {
  11775. function Schema2(descriptor) {
  11776. this.rules = null;
  11777. this._messages = messages;
  11778. this.define(descriptor);
  11779. }
  11780. var _proto = Schema2.prototype;
  11781. _proto.define = function define(rules2) {
  11782. var _this = this;
  11783. if (!rules2) {
  11784. throw new Error("Cannot configure a schema with no rules");
  11785. }
  11786. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  11787. throw new Error("Rules must be an object");
  11788. }
  11789. this.rules = {};
  11790. Object.keys(rules2).forEach(function(name) {
  11791. var item = rules2[name];
  11792. _this.rules[name] = Array.isArray(item) ? item : [item];
  11793. });
  11794. };
  11795. _proto.messages = function messages2(_messages) {
  11796. if (_messages) {
  11797. this._messages = deepMerge(newMessages(), _messages);
  11798. }
  11799. return this._messages;
  11800. };
  11801. _proto.validate = function validate(source_, o, oc) {
  11802. var _this2 = this;
  11803. if (o === void 0) {
  11804. o = {};
  11805. }
  11806. if (oc === void 0) {
  11807. oc = function oc2() {
  11808. };
  11809. }
  11810. var source = source_;
  11811. var options = o;
  11812. var callback = oc;
  11813. if (typeof options === "function") {
  11814. callback = options;
  11815. options = {};
  11816. }
  11817. if (!this.rules || Object.keys(this.rules).length === 0) {
  11818. if (callback) {
  11819. callback(null, source);
  11820. }
  11821. return Promise.resolve(source);
  11822. }
  11823. function complete(results) {
  11824. var errors = [];
  11825. var fields = {};
  11826. function add(e) {
  11827. if (Array.isArray(e)) {
  11828. var _errors;
  11829. errors = (_errors = errors).concat.apply(_errors, e);
  11830. } else {
  11831. errors.push(e);
  11832. }
  11833. }
  11834. for (var i = 0; i < results.length; i++) {
  11835. add(results[i]);
  11836. }
  11837. if (!errors.length) {
  11838. callback(null, source);
  11839. } else {
  11840. fields = convertFieldsError(errors);
  11841. callback(errors, fields);
  11842. }
  11843. }
  11844. if (options.messages) {
  11845. var messages$1 = this.messages();
  11846. if (messages$1 === messages) {
  11847. messages$1 = newMessages();
  11848. }
  11849. deepMerge(messages$1, options.messages);
  11850. options.messages = messages$1;
  11851. } else {
  11852. options.messages = this.messages();
  11853. }
  11854. var series = {};
  11855. var keys = options.keys || Object.keys(this.rules);
  11856. keys.forEach(function(z) {
  11857. var arr = _this2.rules[z];
  11858. var value = source[z];
  11859. arr.forEach(function(r) {
  11860. var rule = r;
  11861. if (typeof rule.transform === "function") {
  11862. if (source === source_) {
  11863. source = _extends({}, source);
  11864. }
  11865. value = source[z] = rule.transform(value);
  11866. }
  11867. if (typeof rule === "function") {
  11868. rule = {
  11869. validator: rule
  11870. };
  11871. } else {
  11872. rule = _extends({}, rule);
  11873. }
  11874. rule.validator = _this2.getValidationMethod(rule);
  11875. if (!rule.validator) {
  11876. return;
  11877. }
  11878. rule.field = z;
  11879. rule.fullField = rule.fullField || z;
  11880. rule.type = _this2.getType(rule);
  11881. series[z] = series[z] || [];
  11882. series[z].push({
  11883. rule,
  11884. value,
  11885. source,
  11886. field: z
  11887. });
  11888. });
  11889. });
  11890. var errorFields = {};
  11891. return asyncMap(series, options, function(data, doIt) {
  11892. var rule = data.rule;
  11893. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  11894. deep = deep && (rule.required || !rule.required && data.value);
  11895. rule.field = data.field;
  11896. function addFullField(key, schema) {
  11897. return _extends({}, schema, {
  11898. fullField: rule.fullField + "." + key,
  11899. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  11900. });
  11901. }
  11902. function cb(e) {
  11903. if (e === void 0) {
  11904. e = [];
  11905. }
  11906. var errorList = Array.isArray(e) ? e : [e];
  11907. if (!options.suppressWarning && errorList.length) {
  11908. Schema2.warning("async-validator:", errorList);
  11909. }
  11910. if (errorList.length && rule.message !== void 0) {
  11911. errorList = [].concat(rule.message);
  11912. }
  11913. var filledErrors = errorList.map(complementError(rule, source));
  11914. if (options.first && filledErrors.length) {
  11915. errorFields[rule.field] = 1;
  11916. return doIt(filledErrors);
  11917. }
  11918. if (!deep) {
  11919. doIt(filledErrors);
  11920. } else {
  11921. if (rule.required && !data.value) {
  11922. if (rule.message !== void 0) {
  11923. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  11924. } else if (options.error) {
  11925. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  11926. }
  11927. return doIt(filledErrors);
  11928. }
  11929. var fieldsSchema = {};
  11930. if (rule.defaultField) {
  11931. Object.keys(data.value).map(function(key) {
  11932. fieldsSchema[key] = rule.defaultField;
  11933. });
  11934. }
  11935. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  11936. var paredFieldsSchema = {};
  11937. Object.keys(fieldsSchema).forEach(function(field) {
  11938. var fieldSchema = fieldsSchema[field];
  11939. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  11940. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  11941. });
  11942. var schema = new Schema2(paredFieldsSchema);
  11943. schema.messages(options.messages);
  11944. if (data.rule.options) {
  11945. data.rule.options.messages = options.messages;
  11946. data.rule.options.error = options.error;
  11947. }
  11948. schema.validate(data.value, data.rule.options || options, function(errs) {
  11949. var finalErrors = [];
  11950. if (filledErrors && filledErrors.length) {
  11951. finalErrors.push.apply(finalErrors, filledErrors);
  11952. }
  11953. if (errs && errs.length) {
  11954. finalErrors.push.apply(finalErrors, errs);
  11955. }
  11956. doIt(finalErrors.length ? finalErrors : null);
  11957. });
  11958. }
  11959. }
  11960. var res;
  11961. if (rule.asyncValidator) {
  11962. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  11963. } else if (rule.validator) {
  11964. try {
  11965. res = rule.validator(rule, data.value, cb, data.source, options);
  11966. } catch (error) {
  11967. console.error == null ? void 0 : console.error(error);
  11968. if (!options.suppressValidatorError) {
  11969. setTimeout(function() {
  11970. throw error;
  11971. }, 0);
  11972. }
  11973. cb(error.message);
  11974. }
  11975. if (res === true) {
  11976. cb();
  11977. } else if (res === false) {
  11978. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  11979. } else if (res instanceof Array) {
  11980. cb(res);
  11981. } else if (res instanceof Error) {
  11982. cb(res.message);
  11983. }
  11984. }
  11985. if (res && res.then) {
  11986. res.then(function() {
  11987. return cb();
  11988. }, function(e) {
  11989. return cb(e);
  11990. });
  11991. }
  11992. }, function(results) {
  11993. complete(results);
  11994. }, source);
  11995. };
  11996. _proto.getType = function getType(rule) {
  11997. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  11998. rule.type = "pattern";
  11999. }
  12000. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  12001. throw new Error(format("Unknown rule type %s", rule.type));
  12002. }
  12003. return rule.type || "string";
  12004. };
  12005. _proto.getValidationMethod = function getValidationMethod(rule) {
  12006. if (typeof rule.validator === "function") {
  12007. return rule.validator;
  12008. }
  12009. var keys = Object.keys(rule);
  12010. var messageIndex = keys.indexOf("message");
  12011. if (messageIndex !== -1) {
  12012. keys.splice(messageIndex, 1);
  12013. }
  12014. if (keys.length === 1 && keys[0] === "required") {
  12015. return validators.required;
  12016. }
  12017. return validators[this.getType(rule)] || void 0;
  12018. };
  12019. return Schema2;
  12020. }();
  12021. Schema.register = function register(type4, validator) {
  12022. if (typeof validator !== "function") {
  12023. throw new Error("Cannot register a validator by type, validator is not a function");
  12024. }
  12025. validators[type4] = validator;
  12026. };
  12027. Schema.warning = warning;
  12028. Schema.messages = messages;
  12029. Schema.validators = validators;
  12030. const formItemValidateStates = [
  12031. "",
  12032. "error",
  12033. "validating",
  12034. "success"
  12035. ];
  12036. const formItemProps = buildProps({
  12037. label: String,
  12038. labelWidth: {
  12039. type: [String, Number],
  12040. default: ""
  12041. },
  12042. prop: {
  12043. type: definePropType([String, Array])
  12044. },
  12045. required: {
  12046. type: Boolean,
  12047. default: void 0
  12048. },
  12049. rules: {
  12050. type: definePropType([Object, Array])
  12051. },
  12052. error: String,
  12053. validateStatus: {
  12054. type: String,
  12055. values: formItemValidateStates
  12056. },
  12057. for: String,
  12058. inlineMessage: {
  12059. type: [String, Boolean],
  12060. default: ""
  12061. },
  12062. showMessage: {
  12063. type: Boolean,
  12064. default: true
  12065. },
  12066. size: {
  12067. type: String,
  12068. values: componentSizes
  12069. }
  12070. });
  12071. const COMPONENT_NAME$l = "ElLabelWrap";
  12072. var FormLabelWrap = vue.defineComponent({
  12073. name: COMPONENT_NAME$l,
  12074. props: {
  12075. isAutoWidth: Boolean,
  12076. updateAll: Boolean
  12077. },
  12078. setup(props, {
  12079. slots
  12080. }) {
  12081. const formContext = vue.inject(formContextKey, void 0);
  12082. const formItemContext = vue.inject(formItemContextKey);
  12083. if (!formItemContext)
  12084. throwError(COMPONENT_NAME$l, "usage: <el-form-item><label-wrap /></el-form-item>");
  12085. const ns = useNamespace("form");
  12086. const el = vue.ref();
  12087. const computedWidth = vue.ref(0);
  12088. const getLabelWidth = () => {
  12089. var _a;
  12090. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  12091. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12092. return Math.ceil(Number.parseFloat(width));
  12093. } else {
  12094. return 0;
  12095. }
  12096. };
  12097. const updateLabelWidth = (action = "update") => {
  12098. vue.nextTick(() => {
  12099. if (slots.default && props.isAutoWidth) {
  12100. if (action === "update") {
  12101. computedWidth.value = getLabelWidth();
  12102. } else if (action === "remove") {
  12103. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  12104. }
  12105. }
  12106. });
  12107. };
  12108. const updateLabelWidthFn = () => updateLabelWidth("update");
  12109. vue.onMounted(() => {
  12110. updateLabelWidthFn();
  12111. });
  12112. vue.onBeforeUnmount(() => {
  12113. updateLabelWidth("remove");
  12114. });
  12115. vue.onUpdated(() => updateLabelWidthFn());
  12116. vue.watch(computedWidth, (val, oldVal) => {
  12117. if (props.updateAll) {
  12118. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  12119. }
  12120. });
  12121. useResizeObserver(vue.computed(() => {
  12122. var _a, _b;
  12123. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  12124. }), updateLabelWidthFn);
  12125. return () => {
  12126. var _a, _b;
  12127. if (!slots)
  12128. return null;
  12129. const {
  12130. isAutoWidth
  12131. } = props;
  12132. if (isAutoWidth) {
  12133. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  12134. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  12135. const style = {};
  12136. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12137. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12138. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  12139. if (marginWidth) {
  12140. style[marginPosition] = `${marginWidth}px`;
  12141. }
  12142. }
  12143. return vue.createVNode("div", {
  12144. "ref": el,
  12145. "class": [ns.be("item", "label-wrap")],
  12146. "style": style
  12147. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  12148. } else {
  12149. return vue.createVNode(vue.Fragment, {
  12150. "ref": el
  12151. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  12152. }
  12153. };
  12154. }
  12155. });
  12156. const _hoisted_1$13 = ["role", "aria-labelledby"];
  12157. const __default__$1y = vue.defineComponent({
  12158. name: "ElFormItem"
  12159. });
  12160. const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({
  12161. ...__default__$1y,
  12162. props: formItemProps,
  12163. setup(__props, { expose }) {
  12164. const props = __props;
  12165. const slots = vue.useSlots();
  12166. const formContext = vue.inject(formContextKey, void 0);
  12167. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  12168. const _size = useFormSize(void 0, { formItem: false });
  12169. const ns = useNamespace("form-item");
  12170. const labelId = useId().value;
  12171. const inputIds = vue.ref([]);
  12172. const validateState = vue.ref("");
  12173. const validateStateDebounced = refDebounced(validateState, 100);
  12174. const validateMessage = vue.ref("");
  12175. const formItemRef = vue.ref();
  12176. let initialValue = void 0;
  12177. let isResettingField = false;
  12178. const labelStyle = vue.computed(() => {
  12179. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  12180. return {};
  12181. }
  12182. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12183. if (labelWidth)
  12184. return { width: labelWidth };
  12185. return {};
  12186. });
  12187. const contentStyle = vue.computed(() => {
  12188. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  12189. return {};
  12190. }
  12191. if (!props.label && !props.labelWidth && isNested) {
  12192. return {};
  12193. }
  12194. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12195. if (!props.label && !slots.label) {
  12196. return { marginLeft: labelWidth };
  12197. }
  12198. return {};
  12199. });
  12200. const formItemClasses = vue.computed(() => [
  12201. ns.b(),
  12202. ns.m(_size.value),
  12203. ns.is("error", validateState.value === "error"),
  12204. ns.is("validating", validateState.value === "validating"),
  12205. ns.is("success", validateState.value === "success"),
  12206. ns.is("required", isRequired.value || props.required),
  12207. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  12208. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  12209. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  12210. ]);
  12211. const _inlineMessage = vue.computed(() => isBoolean$1(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  12212. const validateClasses = vue.computed(() => [
  12213. ns.e("error"),
  12214. { [ns.em("error", "inline")]: _inlineMessage.value }
  12215. ]);
  12216. const propString = vue.computed(() => {
  12217. if (!props.prop)
  12218. return "";
  12219. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  12220. });
  12221. const hasLabel = vue.computed(() => {
  12222. return !!(props.label || slots.label);
  12223. });
  12224. const labelFor = vue.computed(() => {
  12225. return props.for || inputIds.value.length === 1 ? inputIds.value[0] : void 0;
  12226. });
  12227. const isGroup = vue.computed(() => {
  12228. return !labelFor.value && hasLabel.value;
  12229. });
  12230. const isNested = !!parentFormItemContext;
  12231. const fieldValue = vue.computed(() => {
  12232. const model = formContext == null ? void 0 : formContext.model;
  12233. if (!model || !props.prop) {
  12234. return;
  12235. }
  12236. return getProp(model, props.prop).value;
  12237. });
  12238. const normalizedRules = vue.computed(() => {
  12239. const { required } = props;
  12240. const rules = [];
  12241. if (props.rules) {
  12242. rules.push(...castArray$1(props.rules));
  12243. }
  12244. const formRules = formContext == null ? void 0 : formContext.rules;
  12245. if (formRules && props.prop) {
  12246. const _rules = getProp(formRules, props.prop).value;
  12247. if (_rules) {
  12248. rules.push(...castArray$1(_rules));
  12249. }
  12250. }
  12251. if (required !== void 0) {
  12252. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  12253. if (requiredRules.length > 0) {
  12254. for (const [rule, i] of requiredRules) {
  12255. if (rule.required === required)
  12256. continue;
  12257. rules[i] = { ...rule, required };
  12258. }
  12259. } else {
  12260. rules.push({ required });
  12261. }
  12262. }
  12263. return rules;
  12264. });
  12265. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  12266. const getFilteredRule = (trigger) => {
  12267. const rules = normalizedRules.value;
  12268. return rules.filter((rule) => {
  12269. if (!rule.trigger || !trigger)
  12270. return true;
  12271. if (Array.isArray(rule.trigger)) {
  12272. return rule.trigger.includes(trigger);
  12273. } else {
  12274. return rule.trigger === trigger;
  12275. }
  12276. }).map(({ trigger: trigger2, ...rule }) => rule);
  12277. };
  12278. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  12279. const shouldShowError = vue.computed(() => {
  12280. var _a;
  12281. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  12282. });
  12283. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  12284. const setValidationState = (state) => {
  12285. validateState.value = state;
  12286. };
  12287. const onValidationFailed = (error) => {
  12288. var _a, _b;
  12289. const { errors, fields } = error;
  12290. if (!errors || !fields) {
  12291. console.error(error);
  12292. }
  12293. setValidationState("error");
  12294. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  12295. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  12296. };
  12297. const onValidationSucceeded = () => {
  12298. setValidationState("success");
  12299. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  12300. };
  12301. const doValidate = async (rules) => {
  12302. const modelName = propString.value;
  12303. const validator = new Schema({
  12304. [modelName]: rules
  12305. });
  12306. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12307. onValidationSucceeded();
  12308. return true;
  12309. }).catch((err) => {
  12310. onValidationFailed(err);
  12311. return Promise.reject(err);
  12312. });
  12313. };
  12314. const validate = async (trigger, callback) => {
  12315. if (isResettingField || !props.prop) {
  12316. return false;
  12317. }
  12318. const hasCallback = isFunction$1(callback);
  12319. if (!validateEnabled.value) {
  12320. callback == null ? void 0 : callback(false);
  12321. return false;
  12322. }
  12323. const rules = getFilteredRule(trigger);
  12324. if (rules.length === 0) {
  12325. callback == null ? void 0 : callback(true);
  12326. return true;
  12327. }
  12328. setValidationState("validating");
  12329. return doValidate(rules).then(() => {
  12330. callback == null ? void 0 : callback(true);
  12331. return true;
  12332. }).catch((err) => {
  12333. const { fields } = err;
  12334. callback == null ? void 0 : callback(false, fields);
  12335. return hasCallback ? false : Promise.reject(fields);
  12336. });
  12337. };
  12338. const clearValidate = () => {
  12339. setValidationState("");
  12340. validateMessage.value = "";
  12341. isResettingField = false;
  12342. };
  12343. const resetField = async () => {
  12344. const model = formContext == null ? void 0 : formContext.model;
  12345. if (!model || !props.prop)
  12346. return;
  12347. const computedValue = getProp(model, props.prop);
  12348. isResettingField = true;
  12349. computedValue.value = clone(initialValue);
  12350. await vue.nextTick();
  12351. clearValidate();
  12352. isResettingField = false;
  12353. };
  12354. const addInputId = (id) => {
  12355. if (!inputIds.value.includes(id)) {
  12356. inputIds.value.push(id);
  12357. }
  12358. };
  12359. const removeInputId = (id) => {
  12360. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12361. };
  12362. vue.watch(() => props.error, (val) => {
  12363. validateMessage.value = val || "";
  12364. setValidationState(val ? "error" : "");
  12365. }, { immediate: true });
  12366. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12367. const context = vue.reactive({
  12368. ...vue.toRefs(props),
  12369. $el: formItemRef,
  12370. size: _size,
  12371. validateState,
  12372. labelId,
  12373. inputIds,
  12374. isGroup,
  12375. hasLabel,
  12376. addInputId,
  12377. removeInputId,
  12378. resetField,
  12379. clearValidate,
  12380. validate
  12381. });
  12382. vue.provide(formItemContextKey, context);
  12383. vue.onMounted(() => {
  12384. if (props.prop) {
  12385. formContext == null ? void 0 : formContext.addField(context);
  12386. initialValue = clone(fieldValue.value);
  12387. }
  12388. });
  12389. vue.onBeforeUnmount(() => {
  12390. formContext == null ? void 0 : formContext.removeField(context);
  12391. });
  12392. expose({
  12393. size: _size,
  12394. validateMessage,
  12395. validateState,
  12396. validate,
  12397. clearValidate,
  12398. resetField
  12399. });
  12400. return (_ctx, _cache) => {
  12401. var _a;
  12402. return vue.openBlock(), vue.createElementBlock("div", {
  12403. ref_key: "formItemRef",
  12404. ref: formItemRef,
  12405. class: vue.normalizeClass(vue.unref(formItemClasses)),
  12406. role: vue.unref(isGroup) ? "group" : void 0,
  12407. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  12408. }, [
  12409. vue.createVNode(vue.unref(FormLabelWrap), {
  12410. "is-auto-width": vue.unref(labelStyle).width === "auto",
  12411. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  12412. }, {
  12413. default: vue.withCtx(() => [
  12414. vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  12415. key: 0,
  12416. id: vue.unref(labelId),
  12417. for: vue.unref(labelFor),
  12418. class: vue.normalizeClass(vue.unref(ns).e("label")),
  12419. style: vue.normalizeStyle(vue.unref(labelStyle))
  12420. }, {
  12421. default: vue.withCtx(() => [
  12422. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  12423. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  12424. ])
  12425. ]),
  12426. _: 3
  12427. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  12428. ]),
  12429. _: 3
  12430. }, 8, ["is-auto-width", "update-all"]),
  12431. vue.createElementVNode("div", {
  12432. class: vue.normalizeClass(vue.unref(ns).e("content")),
  12433. style: vue.normalizeStyle(vue.unref(contentStyle))
  12434. }, [
  12435. vue.renderSlot(_ctx.$slots, "default"),
  12436. vue.createVNode(vue.TransitionGroup, {
  12437. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  12438. }, {
  12439. default: vue.withCtx(() => [
  12440. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  12441. key: 0,
  12442. error: validateMessage.value
  12443. }, () => [
  12444. vue.createElementVNode("div", {
  12445. class: vue.normalizeClass(vue.unref(validateClasses))
  12446. }, vue.toDisplayString(validateMessage.value), 3)
  12447. ]) : vue.createCommentVNode("v-if", true)
  12448. ]),
  12449. _: 3
  12450. }, 8, ["name"])
  12451. ], 6)
  12452. ], 10, _hoisted_1$13);
  12453. };
  12454. }
  12455. });
  12456. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "form-item.vue"]]);
  12457. const ElForm = withInstall(Form, {
  12458. FormItem
  12459. });
  12460. const ElFormItem = withNoopInstall(FormItem);
  12461. let hiddenTextarea = void 0;
  12462. const HIDDEN_STYLE = `
  12463. height:0 !important;
  12464. visibility:hidden !important;
  12465. ${isFirefox() ? "" : "overflow:hidden !important;"}
  12466. position:absolute !important;
  12467. z-index:-1000 !important;
  12468. top:0 !important;
  12469. right:0 !important;
  12470. `;
  12471. const CONTEXT_STYLE = [
  12472. "letter-spacing",
  12473. "line-height",
  12474. "padding-top",
  12475. "padding-bottom",
  12476. "font-family",
  12477. "font-weight",
  12478. "font-size",
  12479. "text-rendering",
  12480. "text-transform",
  12481. "width",
  12482. "text-indent",
  12483. "padding-left",
  12484. "padding-right",
  12485. "border-width",
  12486. "box-sizing"
  12487. ];
  12488. function calculateNodeStyling(targetElement) {
  12489. const style = window.getComputedStyle(targetElement);
  12490. const boxSizing = style.getPropertyValue("box-sizing");
  12491. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  12492. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  12493. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  12494. return { contextStyle, paddingSize, borderSize, boxSizing };
  12495. }
  12496. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  12497. var _a;
  12498. if (!hiddenTextarea) {
  12499. hiddenTextarea = document.createElement("textarea");
  12500. document.body.appendChild(hiddenTextarea);
  12501. }
  12502. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  12503. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  12504. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  12505. let height = hiddenTextarea.scrollHeight;
  12506. const result = {};
  12507. if (boxSizing === "border-box") {
  12508. height = height + borderSize;
  12509. } else if (boxSizing === "content-box") {
  12510. height = height - paddingSize;
  12511. }
  12512. hiddenTextarea.value = "";
  12513. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  12514. if (isNumber$1(minRows)) {
  12515. let minHeight = singleRowHeight * minRows;
  12516. if (boxSizing === "border-box") {
  12517. minHeight = minHeight + paddingSize + borderSize;
  12518. }
  12519. height = Math.max(minHeight, height);
  12520. result.minHeight = `${minHeight}px`;
  12521. }
  12522. if (isNumber$1(maxRows)) {
  12523. let maxHeight = singleRowHeight * maxRows;
  12524. if (boxSizing === "border-box") {
  12525. maxHeight = maxHeight + paddingSize + borderSize;
  12526. }
  12527. height = Math.min(maxHeight, height);
  12528. }
  12529. result.height = `${height}px`;
  12530. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  12531. hiddenTextarea = void 0;
  12532. return result;
  12533. }
  12534. const inputProps = buildProps({
  12535. id: {
  12536. type: String,
  12537. default: void 0
  12538. },
  12539. size: useSizeProp,
  12540. disabled: Boolean,
  12541. modelValue: {
  12542. type: definePropType([
  12543. String,
  12544. Number,
  12545. Object
  12546. ]),
  12547. default: ""
  12548. },
  12549. type: {
  12550. type: String,
  12551. default: "text"
  12552. },
  12553. resize: {
  12554. type: String,
  12555. values: ["none", "both", "horizontal", "vertical"]
  12556. },
  12557. autosize: {
  12558. type: definePropType([Boolean, Object]),
  12559. default: false
  12560. },
  12561. autocomplete: {
  12562. type: String,
  12563. default: "off"
  12564. },
  12565. formatter: {
  12566. type: Function
  12567. },
  12568. parser: {
  12569. type: Function
  12570. },
  12571. placeholder: {
  12572. type: String
  12573. },
  12574. form: {
  12575. type: String
  12576. },
  12577. readonly: {
  12578. type: Boolean,
  12579. default: false
  12580. },
  12581. clearable: {
  12582. type: Boolean,
  12583. default: false
  12584. },
  12585. showPassword: {
  12586. type: Boolean,
  12587. default: false
  12588. },
  12589. showWordLimit: {
  12590. type: Boolean,
  12591. default: false
  12592. },
  12593. suffixIcon: {
  12594. type: iconPropType
  12595. },
  12596. prefixIcon: {
  12597. type: iconPropType
  12598. },
  12599. containerRole: {
  12600. type: String,
  12601. default: void 0
  12602. },
  12603. label: {
  12604. type: String,
  12605. default: void 0
  12606. },
  12607. tabindex: {
  12608. type: [String, Number],
  12609. default: 0
  12610. },
  12611. validateEvent: {
  12612. type: Boolean,
  12613. default: true
  12614. },
  12615. inputStyle: {
  12616. type: definePropType([Object, Array, String]),
  12617. default: () => mutable({})
  12618. }
  12619. });
  12620. const inputEmits = {
  12621. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  12622. input: (value) => isString$1(value),
  12623. change: (value) => isString$1(value),
  12624. focus: (evt) => evt instanceof FocusEvent,
  12625. blur: (evt) => evt instanceof FocusEvent,
  12626. clear: () => true,
  12627. mouseleave: (evt) => evt instanceof MouseEvent,
  12628. mouseenter: (evt) => evt instanceof MouseEvent,
  12629. keydown: (evt) => evt instanceof Event,
  12630. compositionstart: (evt) => evt instanceof CompositionEvent,
  12631. compositionupdate: (evt) => evt instanceof CompositionEvent,
  12632. compositionend: (evt) => evt instanceof CompositionEvent
  12633. };
  12634. const _hoisted_1$12 = ["role"];
  12635. const _hoisted_2$G = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
  12636. const _hoisted_3$l = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
  12637. const __default__$1x = vue.defineComponent({
  12638. name: "ElInput",
  12639. inheritAttrs: false
  12640. });
  12641. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  12642. ...__default__$1x,
  12643. props: inputProps,
  12644. emits: inputEmits,
  12645. setup(__props, { expose, emit }) {
  12646. const props = __props;
  12647. const rawAttrs = vue.useAttrs();
  12648. const slots = vue.useSlots();
  12649. const containerAttrs = vue.computed(() => {
  12650. const comboBoxAttrs = {};
  12651. if (props.containerRole === "combobox") {
  12652. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  12653. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  12654. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  12655. }
  12656. return comboBoxAttrs;
  12657. });
  12658. const containerKls = vue.computed(() => [
  12659. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  12660. nsInput.m(inputSize.value),
  12661. nsInput.is("disabled", inputDisabled.value),
  12662. nsInput.is("exceed", inputExceed.value),
  12663. {
  12664. [nsInput.b("group")]: slots.prepend || slots.append,
  12665. [nsInput.bm("group", "append")]: slots.append,
  12666. [nsInput.bm("group", "prepend")]: slots.prepend,
  12667. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  12668. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  12669. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value
  12670. },
  12671. rawAttrs.class
  12672. ]);
  12673. const wrapperKls = vue.computed(() => [
  12674. nsInput.e("wrapper"),
  12675. nsInput.is("focus", focused.value)
  12676. ]);
  12677. const attrs = useAttrs({
  12678. excludeKeys: vue.computed(() => {
  12679. return Object.keys(containerAttrs.value);
  12680. })
  12681. });
  12682. const { form, formItem } = useFormItem();
  12683. const { inputId } = useFormItemInputId(props, {
  12684. formItemContext: formItem
  12685. });
  12686. const inputSize = useFormSize();
  12687. const inputDisabled = useFormDisabled();
  12688. const nsInput = useNamespace("input");
  12689. const nsTextarea = useNamespace("textarea");
  12690. const input = vue.shallowRef();
  12691. const textarea = vue.shallowRef();
  12692. const focused = vue.ref(false);
  12693. const hovering = vue.ref(false);
  12694. const isComposing = vue.ref(false);
  12695. const passwordVisible = vue.ref(false);
  12696. const countStyle = vue.ref();
  12697. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  12698. const _ref = vue.computed(() => input.value || textarea.value);
  12699. const needStatusIcon = vue.computed(() => {
  12700. var _a;
  12701. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  12702. });
  12703. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  12704. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  12705. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  12706. const containerStyle = vue.computed(() => [
  12707. rawAttrs.style,
  12708. props.inputStyle
  12709. ]);
  12710. const textareaStyle = vue.computed(() => [
  12711. props.inputStyle,
  12712. textareaCalcStyle.value,
  12713. { resize: props.resize }
  12714. ]);
  12715. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  12716. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  12717. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value));
  12718. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  12719. const textLength = vue.computed(() => nativeInputValue.value.length);
  12720. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  12721. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  12722. const [recordCursor, setCursor] = useCursor(input);
  12723. useResizeObserver(textarea, (entries) => {
  12724. onceInitSizeTextarea();
  12725. if (!isWordLimitVisible.value || props.resize !== "both")
  12726. return;
  12727. const entry = entries[0];
  12728. const { width } = entry.contentRect;
  12729. countStyle.value = {
  12730. right: `calc(100% - ${width + 15 + 6}px)`
  12731. };
  12732. });
  12733. const resizeTextarea = () => {
  12734. const { type, autosize } = props;
  12735. if (!isClient || type !== "textarea" || !textarea.value)
  12736. return;
  12737. if (autosize) {
  12738. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  12739. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  12740. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  12741. textareaCalcStyle.value = {
  12742. overflowY: "hidden",
  12743. ...textareaStyle2
  12744. };
  12745. vue.nextTick(() => {
  12746. textarea.value.offsetHeight;
  12747. textareaCalcStyle.value = textareaStyle2;
  12748. });
  12749. } else {
  12750. textareaCalcStyle.value = {
  12751. minHeight: calcTextareaHeight(textarea.value).minHeight
  12752. };
  12753. }
  12754. };
  12755. const createOnceInitResize = (resizeTextarea2) => {
  12756. let isInit = false;
  12757. return () => {
  12758. var _a;
  12759. if (isInit || !props.autosize)
  12760. return;
  12761. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  12762. if (!isElHidden) {
  12763. resizeTextarea2();
  12764. isInit = true;
  12765. }
  12766. };
  12767. };
  12768. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  12769. const setNativeInputValue = () => {
  12770. const input2 = _ref.value;
  12771. if (!input2 || input2.value === nativeInputValue.value)
  12772. return;
  12773. input2.value = nativeInputValue.value;
  12774. };
  12775. const handleInput = async (event) => {
  12776. recordCursor();
  12777. let { value } = event.target;
  12778. if (props.formatter) {
  12779. value = props.parser ? props.parser(value) : value;
  12780. value = props.formatter(value);
  12781. }
  12782. if (isComposing.value)
  12783. return;
  12784. if (value === nativeInputValue.value) {
  12785. setNativeInputValue();
  12786. return;
  12787. }
  12788. emit(UPDATE_MODEL_EVENT, value);
  12789. emit("input", value);
  12790. await vue.nextTick();
  12791. setNativeInputValue();
  12792. setCursor();
  12793. };
  12794. const handleChange = (event) => {
  12795. emit("change", event.target.value);
  12796. };
  12797. const handleCompositionStart = (event) => {
  12798. emit("compositionstart", event);
  12799. isComposing.value = true;
  12800. };
  12801. const handleCompositionUpdate = (event) => {
  12802. var _a;
  12803. emit("compositionupdate", event);
  12804. const text = (_a = event.target) == null ? void 0 : _a.value;
  12805. const lastCharacter = text[text.length - 1] || "";
  12806. isComposing.value = !isKorean(lastCharacter);
  12807. };
  12808. const handleCompositionEnd = (event) => {
  12809. emit("compositionend", event);
  12810. if (isComposing.value) {
  12811. isComposing.value = false;
  12812. handleInput(event);
  12813. }
  12814. };
  12815. const handlePasswordVisible = () => {
  12816. passwordVisible.value = !passwordVisible.value;
  12817. focus();
  12818. };
  12819. const focus = async () => {
  12820. var _a;
  12821. await vue.nextTick();
  12822. (_a = _ref.value) == null ? void 0 : _a.focus();
  12823. };
  12824. const blur = () => {
  12825. var _a;
  12826. return (_a = _ref.value) == null ? void 0 : _a.blur();
  12827. };
  12828. const handleFocus = (event) => {
  12829. focused.value = true;
  12830. emit("focus", event);
  12831. };
  12832. const handleBlur = (event) => {
  12833. var _a;
  12834. focused.value = false;
  12835. emit("blur", event);
  12836. if (props.validateEvent) {
  12837. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  12838. }
  12839. };
  12840. const handleMouseLeave = (evt) => {
  12841. hovering.value = false;
  12842. emit("mouseleave", evt);
  12843. };
  12844. const handleMouseEnter = (evt) => {
  12845. hovering.value = true;
  12846. emit("mouseenter", evt);
  12847. };
  12848. const handleKeydown = (evt) => {
  12849. emit("keydown", evt);
  12850. };
  12851. const select = () => {
  12852. var _a;
  12853. (_a = _ref.value) == null ? void 0 : _a.select();
  12854. };
  12855. const clear = () => {
  12856. emit(UPDATE_MODEL_EVENT, "");
  12857. emit("change", "");
  12858. emit("clear");
  12859. emit("input", "");
  12860. };
  12861. vue.watch(() => props.modelValue, () => {
  12862. var _a;
  12863. vue.nextTick(() => resizeTextarea());
  12864. if (props.validateEvent) {
  12865. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  12866. }
  12867. });
  12868. vue.watch(nativeInputValue, () => setNativeInputValue());
  12869. vue.watch(() => props.type, async () => {
  12870. await vue.nextTick();
  12871. setNativeInputValue();
  12872. resizeTextarea();
  12873. });
  12874. vue.onMounted(() => {
  12875. if (!props.formatter && props.parser) ;
  12876. setNativeInputValue();
  12877. vue.nextTick(resizeTextarea);
  12878. });
  12879. expose({
  12880. input,
  12881. textarea,
  12882. ref: _ref,
  12883. textareaStyle,
  12884. autosize: vue.toRef(props, "autosize"),
  12885. focus,
  12886. blur,
  12887. select,
  12888. clear,
  12889. resizeTextarea
  12890. });
  12891. return (_ctx, _cache) => {
  12892. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(vue.unref(containerAttrs), {
  12893. class: vue.unref(containerKls),
  12894. style: vue.unref(containerStyle),
  12895. role: _ctx.containerRole,
  12896. onMouseenter: handleMouseEnter,
  12897. onMouseleave: handleMouseLeave
  12898. }), [
  12899. vue.createCommentVNode(" input "),
  12900. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  12901. vue.createCommentVNode(" prepend slot "),
  12902. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  12903. key: 0,
  12904. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  12905. }, [
  12906. vue.renderSlot(_ctx.$slots, "prepend")
  12907. ], 2)) : vue.createCommentVNode("v-if", true),
  12908. vue.createElementVNode("div", {
  12909. class: vue.normalizeClass(vue.unref(wrapperKls))
  12910. }, [
  12911. vue.createCommentVNode(" prefix slot "),
  12912. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  12913. key: 0,
  12914. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  12915. }, [
  12916. vue.createElementVNode("span", {
  12917. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner")),
  12918. onClick: focus
  12919. }, [
  12920. vue.renderSlot(_ctx.$slots, "prefix"),
  12921. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12922. key: 0,
  12923. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  12924. }, {
  12925. default: vue.withCtx(() => [
  12926. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  12927. ]),
  12928. _: 1
  12929. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  12930. ], 2)
  12931. ], 2)) : vue.createCommentVNode("v-if", true),
  12932. vue.createElementVNode("input", vue.mergeProps({
  12933. id: vue.unref(inputId),
  12934. ref_key: "input",
  12935. ref: input,
  12936. class: vue.unref(nsInput).e("inner")
  12937. }, vue.unref(attrs), {
  12938. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  12939. disabled: vue.unref(inputDisabled),
  12940. formatter: _ctx.formatter,
  12941. parser: _ctx.parser,
  12942. readonly: _ctx.readonly,
  12943. autocomplete: _ctx.autocomplete,
  12944. tabindex: _ctx.tabindex,
  12945. "aria-label": _ctx.label,
  12946. placeholder: _ctx.placeholder,
  12947. style: _ctx.inputStyle,
  12948. form: props.form,
  12949. onCompositionstart: handleCompositionStart,
  12950. onCompositionupdate: handleCompositionUpdate,
  12951. onCompositionend: handleCompositionEnd,
  12952. onInput: handleInput,
  12953. onFocus: handleFocus,
  12954. onBlur: handleBlur,
  12955. onChange: handleChange,
  12956. onKeydown: handleKeydown
  12957. }), null, 16, _hoisted_2$G),
  12958. vue.createCommentVNode(" suffix slot "),
  12959. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  12960. key: 1,
  12961. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  12962. }, [
  12963. vue.createElementVNode("span", {
  12964. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner")),
  12965. onClick: focus
  12966. }, [
  12967. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  12968. vue.renderSlot(_ctx.$slots, "suffix"),
  12969. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12970. key: 0,
  12971. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  12972. }, {
  12973. default: vue.withCtx(() => [
  12974. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  12975. ]),
  12976. _: 1
  12977. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  12978. ], 64)) : vue.createCommentVNode("v-if", true),
  12979. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12980. key: 1,
  12981. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  12982. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  12983. onClick: clear
  12984. }, {
  12985. default: vue.withCtx(() => [
  12986. vue.createVNode(vue.unref(circle_close_default))
  12987. ]),
  12988. _: 1
  12989. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  12990. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12991. key: 2,
  12992. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  12993. onClick: handlePasswordVisible
  12994. }, {
  12995. default: vue.withCtx(() => [
  12996. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  12997. ]),
  12998. _: 1
  12999. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  13000. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13001. key: 3,
  13002. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13003. }, [
  13004. vue.createElementVNode("span", {
  13005. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  13006. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 3)
  13007. ], 2)) : vue.createCommentVNode("v-if", true),
  13008. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13009. key: 4,
  13010. class: vue.normalizeClass([
  13011. vue.unref(nsInput).e("icon"),
  13012. vue.unref(nsInput).e("validateIcon"),
  13013. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  13014. ])
  13015. }, {
  13016. default: vue.withCtx(() => [
  13017. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  13018. ]),
  13019. _: 1
  13020. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13021. ], 2)
  13022. ], 2)) : vue.createCommentVNode("v-if", true)
  13023. ], 2),
  13024. vue.createCommentVNode(" append slot "),
  13025. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  13026. key: 1,
  13027. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  13028. }, [
  13029. vue.renderSlot(_ctx.$slots, "append")
  13030. ], 2)) : vue.createCommentVNode("v-if", true)
  13031. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  13032. vue.createCommentVNode(" textarea "),
  13033. vue.createElementVNode("textarea", vue.mergeProps({
  13034. id: vue.unref(inputId),
  13035. ref_key: "textarea",
  13036. ref: textarea,
  13037. class: vue.unref(nsTextarea).e("inner")
  13038. }, vue.unref(attrs), {
  13039. tabindex: _ctx.tabindex,
  13040. disabled: vue.unref(inputDisabled),
  13041. readonly: _ctx.readonly,
  13042. autocomplete: _ctx.autocomplete,
  13043. style: vue.unref(textareaStyle),
  13044. "aria-label": _ctx.label,
  13045. placeholder: _ctx.placeholder,
  13046. form: props.form,
  13047. onCompositionstart: handleCompositionStart,
  13048. onCompositionupdate: handleCompositionUpdate,
  13049. onCompositionend: handleCompositionEnd,
  13050. onInput: handleInput,
  13051. onFocus: handleFocus,
  13052. onBlur: handleBlur,
  13053. onChange: handleChange,
  13054. onKeydown: handleKeydown
  13055. }), null, 16, _hoisted_3$l),
  13056. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13057. key: 0,
  13058. style: vue.normalizeStyle(countStyle.value),
  13059. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13060. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 7)) : vue.createCommentVNode("v-if", true)
  13061. ], 64))
  13062. ], 16, _hoisted_1$12)), [
  13063. [vue.vShow, _ctx.type !== "hidden"]
  13064. ]);
  13065. };
  13066. }
  13067. });
  13068. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "input.vue"]]);
  13069. const ElInput = withInstall(Input);
  13070. const GAP = 4;
  13071. const BAR_MAP = {
  13072. vertical: {
  13073. offset: "offsetHeight",
  13074. scroll: "scrollTop",
  13075. scrollSize: "scrollHeight",
  13076. size: "height",
  13077. key: "vertical",
  13078. axis: "Y",
  13079. client: "clientY",
  13080. direction: "top"
  13081. },
  13082. horizontal: {
  13083. offset: "offsetWidth",
  13084. scroll: "scrollLeft",
  13085. scrollSize: "scrollWidth",
  13086. size: "width",
  13087. key: "horizontal",
  13088. axis: "X",
  13089. client: "clientX",
  13090. direction: "left"
  13091. }
  13092. };
  13093. const renderThumbStyle$1 = ({
  13094. move,
  13095. size,
  13096. bar
  13097. }) => ({
  13098. [bar.size]: size,
  13099. transform: `translate${bar.axis}(${move}%)`
  13100. });
  13101. const scrollbarContextKey = Symbol("scrollbarContextKey");
  13102. const thumbProps = buildProps({
  13103. vertical: Boolean,
  13104. size: String,
  13105. move: Number,
  13106. ratio: {
  13107. type: Number,
  13108. required: true
  13109. },
  13110. always: Boolean
  13111. });
  13112. const COMPONENT_NAME$k = "Thumb";
  13113. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  13114. __name: "thumb",
  13115. props: thumbProps,
  13116. setup(__props) {
  13117. const props = __props;
  13118. const scrollbar = vue.inject(scrollbarContextKey);
  13119. const ns = useNamespace("scrollbar");
  13120. if (!scrollbar)
  13121. throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
  13122. const instance = vue.ref();
  13123. const thumb = vue.ref();
  13124. const thumbState = vue.ref({});
  13125. const visible = vue.ref(false);
  13126. let cursorDown = false;
  13127. let cursorLeave = false;
  13128. let originalOnSelectStart = isClient ? document.onselectstart : null;
  13129. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  13130. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  13131. size: props.size,
  13132. move: props.move,
  13133. bar: bar.value
  13134. }));
  13135. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  13136. const clickThumbHandler = (e) => {
  13137. var _a;
  13138. e.stopPropagation();
  13139. if (e.ctrlKey || [1, 2].includes(e.button))
  13140. return;
  13141. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  13142. startDrag(e);
  13143. const el = e.currentTarget;
  13144. if (!el)
  13145. return;
  13146. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  13147. };
  13148. const clickTrackHandler = (e) => {
  13149. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  13150. return;
  13151. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  13152. const thumbHalf = thumb.value[bar.value.offset] / 2;
  13153. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13154. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13155. };
  13156. const startDrag = (e) => {
  13157. e.stopImmediatePropagation();
  13158. cursorDown = true;
  13159. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  13160. document.addEventListener("mouseup", mouseUpDocumentHandler);
  13161. originalOnSelectStart = document.onselectstart;
  13162. document.onselectstart = () => false;
  13163. };
  13164. const mouseMoveDocumentHandler = (e) => {
  13165. if (!instance.value || !thumb.value)
  13166. return;
  13167. if (cursorDown === false)
  13168. return;
  13169. const prevPage = thumbState.value[bar.value.axis];
  13170. if (!prevPage)
  13171. return;
  13172. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  13173. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  13174. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13175. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13176. };
  13177. const mouseUpDocumentHandler = () => {
  13178. cursorDown = false;
  13179. thumbState.value[bar.value.axis] = 0;
  13180. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  13181. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13182. restoreOnselectstart();
  13183. if (cursorLeave)
  13184. visible.value = false;
  13185. };
  13186. const mouseMoveScrollbarHandler = () => {
  13187. cursorLeave = false;
  13188. visible.value = !!props.size;
  13189. };
  13190. const mouseLeaveScrollbarHandler = () => {
  13191. cursorLeave = true;
  13192. visible.value = cursorDown;
  13193. };
  13194. vue.onBeforeUnmount(() => {
  13195. restoreOnselectstart();
  13196. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13197. });
  13198. const restoreOnselectstart = () => {
  13199. if (document.onselectstart !== originalOnSelectStart)
  13200. document.onselectstart = originalOnSelectStart;
  13201. };
  13202. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  13203. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  13204. return (_ctx, _cache) => {
  13205. return vue.openBlock(), vue.createBlock(vue.Transition, {
  13206. name: vue.unref(ns).b("fade"),
  13207. persisted: ""
  13208. }, {
  13209. default: vue.withCtx(() => [
  13210. vue.withDirectives(vue.createElementVNode("div", {
  13211. ref_key: "instance",
  13212. ref: instance,
  13213. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  13214. onMousedown: clickTrackHandler
  13215. }, [
  13216. vue.createElementVNode("div", {
  13217. ref_key: "thumb",
  13218. ref: thumb,
  13219. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  13220. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  13221. onMousedown: clickThumbHandler
  13222. }, null, 38)
  13223. ], 34), [
  13224. [vue.vShow, _ctx.always || visible.value]
  13225. ])
  13226. ]),
  13227. _: 1
  13228. }, 8, ["name"]);
  13229. };
  13230. }
  13231. });
  13232. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "thumb.vue"]]);
  13233. const barProps = buildProps({
  13234. always: {
  13235. type: Boolean,
  13236. default: true
  13237. },
  13238. width: String,
  13239. height: String,
  13240. ratioX: {
  13241. type: Number,
  13242. default: 1
  13243. },
  13244. ratioY: {
  13245. type: Number,
  13246. default: 1
  13247. }
  13248. });
  13249. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  13250. __name: "bar",
  13251. props: barProps,
  13252. setup(__props, { expose }) {
  13253. const props = __props;
  13254. const moveX = vue.ref(0);
  13255. const moveY = vue.ref(0);
  13256. const handleScroll = (wrap) => {
  13257. if (wrap) {
  13258. const offsetHeight = wrap.offsetHeight - GAP;
  13259. const offsetWidth = wrap.offsetWidth - GAP;
  13260. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  13261. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  13262. }
  13263. };
  13264. expose({
  13265. handleScroll
  13266. });
  13267. return (_ctx, _cache) => {
  13268. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  13269. vue.createVNode(Thumb, {
  13270. move: moveX.value,
  13271. ratio: _ctx.ratioX,
  13272. size: _ctx.width,
  13273. always: _ctx.always
  13274. }, null, 8, ["move", "ratio", "size", "always"]),
  13275. vue.createVNode(Thumb, {
  13276. move: moveY.value,
  13277. ratio: _ctx.ratioY,
  13278. size: _ctx.height,
  13279. vertical: "",
  13280. always: _ctx.always
  13281. }, null, 8, ["move", "ratio", "size", "always"])
  13282. ], 64);
  13283. };
  13284. }
  13285. });
  13286. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "bar.vue"]]);
  13287. const scrollbarProps = buildProps({
  13288. height: {
  13289. type: [String, Number],
  13290. default: ""
  13291. },
  13292. maxHeight: {
  13293. type: [String, Number],
  13294. default: ""
  13295. },
  13296. native: {
  13297. type: Boolean,
  13298. default: false
  13299. },
  13300. wrapStyle: {
  13301. type: definePropType([String, Object, Array]),
  13302. default: ""
  13303. },
  13304. wrapClass: {
  13305. type: [String, Array],
  13306. default: ""
  13307. },
  13308. viewClass: {
  13309. type: [String, Array],
  13310. default: ""
  13311. },
  13312. viewStyle: {
  13313. type: [String, Array, Object],
  13314. default: ""
  13315. },
  13316. noresize: Boolean,
  13317. tag: {
  13318. type: String,
  13319. default: "div"
  13320. },
  13321. always: Boolean,
  13322. minSize: {
  13323. type: Number,
  13324. default: 20
  13325. }
  13326. });
  13327. const scrollbarEmits = {
  13328. scroll: ({
  13329. scrollTop,
  13330. scrollLeft
  13331. }) => [scrollTop, scrollLeft].every(isNumber$1)
  13332. };
  13333. const COMPONENT_NAME$j = "ElScrollbar";
  13334. const __default__$1w = vue.defineComponent({
  13335. name: COMPONENT_NAME$j
  13336. });
  13337. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  13338. ...__default__$1w,
  13339. props: scrollbarProps,
  13340. emits: scrollbarEmits,
  13341. setup(__props, { expose, emit }) {
  13342. const props = __props;
  13343. const ns = useNamespace("scrollbar");
  13344. let stopResizeObserver = void 0;
  13345. let stopResizeListener = void 0;
  13346. const scrollbarRef = vue.ref();
  13347. const wrapRef = vue.ref();
  13348. const resizeRef = vue.ref();
  13349. const sizeWidth = vue.ref("0");
  13350. const sizeHeight = vue.ref("0");
  13351. const barRef = vue.ref();
  13352. const ratioY = vue.ref(1);
  13353. const ratioX = vue.ref(1);
  13354. const style = vue.computed(() => {
  13355. const style2 = {};
  13356. if (props.height)
  13357. style2.height = addUnit(props.height);
  13358. if (props.maxHeight)
  13359. style2.maxHeight = addUnit(props.maxHeight);
  13360. return [props.wrapStyle, style2];
  13361. });
  13362. const wrapKls = vue.computed(() => {
  13363. return [
  13364. props.wrapClass,
  13365. ns.e("wrap"),
  13366. { [ns.em("wrap", "hidden-default")]: !props.native }
  13367. ];
  13368. });
  13369. const resizeKls = vue.computed(() => {
  13370. return [ns.e("view"), props.viewClass];
  13371. });
  13372. const handleScroll = () => {
  13373. var _a;
  13374. if (wrapRef.value) {
  13375. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13376. emit("scroll", {
  13377. scrollTop: wrapRef.value.scrollTop,
  13378. scrollLeft: wrapRef.value.scrollLeft
  13379. });
  13380. }
  13381. };
  13382. function scrollTo(arg1, arg2) {
  13383. if (isObject$1(arg1)) {
  13384. wrapRef.value.scrollTo(arg1);
  13385. } else if (isNumber$1(arg1) && isNumber$1(arg2)) {
  13386. wrapRef.value.scrollTo(arg1, arg2);
  13387. }
  13388. }
  13389. const setScrollTop = (value) => {
  13390. if (!isNumber$1(value)) {
  13391. return;
  13392. }
  13393. wrapRef.value.scrollTop = value;
  13394. };
  13395. const setScrollLeft = (value) => {
  13396. if (!isNumber$1(value)) {
  13397. return;
  13398. }
  13399. wrapRef.value.scrollLeft = value;
  13400. };
  13401. const update = () => {
  13402. if (!wrapRef.value)
  13403. return;
  13404. const offsetHeight = wrapRef.value.offsetHeight - GAP;
  13405. const offsetWidth = wrapRef.value.offsetWidth - GAP;
  13406. const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
  13407. const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
  13408. const height = Math.max(originalHeight, props.minSize);
  13409. const width = Math.max(originalWidth, props.minSize);
  13410. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  13411. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  13412. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  13413. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  13414. };
  13415. vue.watch(() => props.noresize, (noresize) => {
  13416. if (noresize) {
  13417. stopResizeObserver == null ? void 0 : stopResizeObserver();
  13418. stopResizeListener == null ? void 0 : stopResizeListener();
  13419. } else {
  13420. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  13421. stopResizeListener = useEventListener("resize", update);
  13422. }
  13423. }, { immediate: true });
  13424. vue.watch(() => [props.maxHeight, props.height], () => {
  13425. if (!props.native)
  13426. vue.nextTick(() => {
  13427. var _a;
  13428. update();
  13429. if (wrapRef.value) {
  13430. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13431. }
  13432. });
  13433. });
  13434. vue.provide(scrollbarContextKey, vue.reactive({
  13435. scrollbarElement: scrollbarRef,
  13436. wrapElement: wrapRef
  13437. }));
  13438. vue.onMounted(() => {
  13439. if (!props.native)
  13440. vue.nextTick(() => {
  13441. update();
  13442. });
  13443. });
  13444. vue.onUpdated(() => update());
  13445. expose({
  13446. wrapRef,
  13447. update,
  13448. scrollTo,
  13449. setScrollTop,
  13450. setScrollLeft,
  13451. handleScroll
  13452. });
  13453. return (_ctx, _cache) => {
  13454. return vue.openBlock(), vue.createElementBlock("div", {
  13455. ref_key: "scrollbarRef",
  13456. ref: scrollbarRef,
  13457. class: vue.normalizeClass(vue.unref(ns).b())
  13458. }, [
  13459. vue.createElementVNode("div", {
  13460. ref_key: "wrapRef",
  13461. ref: wrapRef,
  13462. class: vue.normalizeClass(vue.unref(wrapKls)),
  13463. style: vue.normalizeStyle(vue.unref(style)),
  13464. onScroll: handleScroll
  13465. }, [
  13466. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  13467. ref_key: "resizeRef",
  13468. ref: resizeRef,
  13469. class: vue.normalizeClass(vue.unref(resizeKls)),
  13470. style: vue.normalizeStyle(_ctx.viewStyle)
  13471. }, {
  13472. default: vue.withCtx(() => [
  13473. vue.renderSlot(_ctx.$slots, "default")
  13474. ]),
  13475. _: 3
  13476. }, 8, ["class", "style"]))
  13477. ], 38),
  13478. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  13479. key: 0,
  13480. ref_key: "barRef",
  13481. ref: barRef,
  13482. height: sizeHeight.value,
  13483. width: sizeWidth.value,
  13484. always: _ctx.always,
  13485. "ratio-x": ratioX.value,
  13486. "ratio-y": ratioY.value
  13487. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : vue.createCommentVNode("v-if", true)
  13488. ], 2);
  13489. };
  13490. }
  13491. });
  13492. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "scrollbar.vue"]]);
  13493. const ElScrollbar = withInstall(Scrollbar$1);
  13494. const POPPER_INJECTION_KEY = Symbol("popper");
  13495. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  13496. const Effect = {
  13497. LIGHT: "light",
  13498. DARK: "dark"
  13499. };
  13500. const roleTypes = [
  13501. "dialog",
  13502. "grid",
  13503. "group",
  13504. "listbox",
  13505. "menu",
  13506. "navigation",
  13507. "tooltip",
  13508. "tree"
  13509. ];
  13510. const popperProps = buildProps({
  13511. role: {
  13512. type: String,
  13513. values: roleTypes,
  13514. default: "tooltip"
  13515. }
  13516. });
  13517. const usePopperProps = popperProps;
  13518. const __default__$1v = vue.defineComponent({
  13519. name: "ElPopper",
  13520. inheritAttrs: false
  13521. });
  13522. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  13523. ...__default__$1v,
  13524. props: popperProps,
  13525. setup(__props, { expose }) {
  13526. const props = __props;
  13527. const triggerRef = vue.ref();
  13528. const popperInstanceRef = vue.ref();
  13529. const contentRef = vue.ref();
  13530. const referenceRef = vue.ref();
  13531. const role = vue.computed(() => props.role);
  13532. const popperProvides = {
  13533. triggerRef,
  13534. popperInstanceRef,
  13535. contentRef,
  13536. referenceRef,
  13537. role
  13538. };
  13539. expose(popperProvides);
  13540. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  13541. return (_ctx, _cache) => {
  13542. return vue.renderSlot(_ctx.$slots, "default");
  13543. };
  13544. }
  13545. });
  13546. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "popper.vue"]]);
  13547. const popperArrowProps = buildProps({
  13548. arrowOffset: {
  13549. type: Number,
  13550. default: 5
  13551. }
  13552. });
  13553. const usePopperArrowProps = popperArrowProps;
  13554. const __default__$1u = vue.defineComponent({
  13555. name: "ElPopperArrow",
  13556. inheritAttrs: false
  13557. });
  13558. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  13559. ...__default__$1u,
  13560. props: popperArrowProps,
  13561. setup(__props, { expose }) {
  13562. const props = __props;
  13563. const ns = useNamespace("popper");
  13564. const { arrowOffset, arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  13565. vue.watch(() => props.arrowOffset, (val) => {
  13566. arrowOffset.value = val;
  13567. });
  13568. vue.onBeforeUnmount(() => {
  13569. arrowRef.value = void 0;
  13570. });
  13571. expose({
  13572. arrowRef
  13573. });
  13574. return (_ctx, _cache) => {
  13575. return vue.openBlock(), vue.createElementBlock("span", {
  13576. ref_key: "arrowRef",
  13577. ref: arrowRef,
  13578. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  13579. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  13580. "data-popper-arrow": ""
  13581. }, null, 6);
  13582. };
  13583. }
  13584. });
  13585. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "arrow.vue"]]);
  13586. const NAME = "ElOnlyChild";
  13587. const OnlyChild = vue.defineComponent({
  13588. name: NAME,
  13589. setup(_, {
  13590. slots,
  13591. attrs
  13592. }) {
  13593. var _a;
  13594. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  13595. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  13596. return () => {
  13597. var _a2;
  13598. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  13599. if (!defaultSlot)
  13600. return null;
  13601. if (defaultSlot.length > 1) {
  13602. return null;
  13603. }
  13604. const firstLegitNode = findFirstLegitChild(defaultSlot);
  13605. if (!firstLegitNode) {
  13606. return null;
  13607. }
  13608. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  13609. };
  13610. }
  13611. });
  13612. function findFirstLegitChild(node) {
  13613. if (!node)
  13614. return null;
  13615. const children = node;
  13616. for (const child of children) {
  13617. if (isObject$1(child)) {
  13618. switch (child.type) {
  13619. case vue.Comment:
  13620. continue;
  13621. case vue.Text:
  13622. case "svg":
  13623. return wrapTextContent(child);
  13624. case vue.Fragment:
  13625. return findFirstLegitChild(child.children);
  13626. default:
  13627. return child;
  13628. }
  13629. }
  13630. return wrapTextContent(child);
  13631. }
  13632. return null;
  13633. }
  13634. function wrapTextContent(s) {
  13635. const ns = useNamespace("only-child");
  13636. return vue.createVNode("span", {
  13637. "class": ns.e("content")
  13638. }, [s]);
  13639. }
  13640. const popperTriggerProps = buildProps({
  13641. virtualRef: {
  13642. type: definePropType(Object)
  13643. },
  13644. virtualTriggering: Boolean,
  13645. onMouseenter: {
  13646. type: definePropType(Function)
  13647. },
  13648. onMouseleave: {
  13649. type: definePropType(Function)
  13650. },
  13651. onClick: {
  13652. type: definePropType(Function)
  13653. },
  13654. onKeydown: {
  13655. type: definePropType(Function)
  13656. },
  13657. onFocus: {
  13658. type: definePropType(Function)
  13659. },
  13660. onBlur: {
  13661. type: definePropType(Function)
  13662. },
  13663. onContextmenu: {
  13664. type: definePropType(Function)
  13665. },
  13666. id: String,
  13667. open: Boolean
  13668. });
  13669. const usePopperTriggerProps = popperTriggerProps;
  13670. const __default__$1t = vue.defineComponent({
  13671. name: "ElPopperTrigger",
  13672. inheritAttrs: false
  13673. });
  13674. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  13675. ...__default__$1t,
  13676. props: popperTriggerProps,
  13677. setup(__props, { expose }) {
  13678. const props = __props;
  13679. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  13680. useForwardRef(triggerRef);
  13681. const ariaControls = vue.computed(() => {
  13682. return ariaHaspopup.value ? props.id : void 0;
  13683. });
  13684. const ariaDescribedby = vue.computed(() => {
  13685. if (role && role.value === "tooltip") {
  13686. return props.open && props.id ? props.id : void 0;
  13687. }
  13688. return void 0;
  13689. });
  13690. const ariaHaspopup = vue.computed(() => {
  13691. if (role && role.value !== "tooltip") {
  13692. return role.value;
  13693. }
  13694. return void 0;
  13695. });
  13696. const ariaExpanded = vue.computed(() => {
  13697. return ariaHaspopup.value ? `${props.open}` : void 0;
  13698. });
  13699. let virtualTriggerAriaStopWatch = void 0;
  13700. vue.onMounted(() => {
  13701. vue.watch(() => props.virtualRef, (virtualEl) => {
  13702. if (virtualEl) {
  13703. triggerRef.value = unrefElement(virtualEl);
  13704. }
  13705. }, {
  13706. immediate: true
  13707. });
  13708. vue.watch(triggerRef, (el, prevEl) => {
  13709. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  13710. virtualTriggerAriaStopWatch = void 0;
  13711. if (isElement$1(el)) {
  13712. [
  13713. "onMouseenter",
  13714. "onMouseleave",
  13715. "onClick",
  13716. "onKeydown",
  13717. "onFocus",
  13718. "onBlur",
  13719. "onContextmenu"
  13720. ].forEach((eventName) => {
  13721. var _a;
  13722. const handler = props[eventName];
  13723. if (handler) {
  13724. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  13725. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  13726. }
  13727. });
  13728. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  13729. [
  13730. "aria-controls",
  13731. "aria-describedby",
  13732. "aria-haspopup",
  13733. "aria-expanded"
  13734. ].forEach((key, idx) => {
  13735. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  13736. });
  13737. }, { immediate: true });
  13738. }
  13739. if (isElement$1(prevEl)) {
  13740. [
  13741. "aria-controls",
  13742. "aria-describedby",
  13743. "aria-haspopup",
  13744. "aria-expanded"
  13745. ].forEach((key) => prevEl.removeAttribute(key));
  13746. }
  13747. }, {
  13748. immediate: true
  13749. });
  13750. });
  13751. vue.onBeforeUnmount(() => {
  13752. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  13753. virtualTriggerAriaStopWatch = void 0;
  13754. });
  13755. expose({
  13756. triggerRef
  13757. });
  13758. return (_ctx, _cache) => {
  13759. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  13760. "aria-controls": vue.unref(ariaControls),
  13761. "aria-describedby": vue.unref(ariaDescribedby),
  13762. "aria-expanded": vue.unref(ariaExpanded),
  13763. "aria-haspopup": vue.unref(ariaHaspopup)
  13764. }), {
  13765. default: vue.withCtx(() => [
  13766. vue.renderSlot(_ctx.$slots, "default")
  13767. ]),
  13768. _: 3
  13769. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  13770. };
  13771. }
  13772. });
  13773. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "trigger.vue"]]);
  13774. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  13775. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  13776. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  13777. const FOCUS_AFTER_TRAPPED_OPTS = {
  13778. cancelable: true,
  13779. bubbles: false
  13780. };
  13781. const FOCUSOUT_PREVENTED_OPTS = {
  13782. cancelable: true,
  13783. bubbles: false
  13784. };
  13785. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  13786. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  13787. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  13788. const focusReason = vue.ref();
  13789. const lastUserFocusTimestamp = vue.ref(0);
  13790. const lastAutomatedFocusTimestamp = vue.ref(0);
  13791. let focusReasonUserCount = 0;
  13792. const obtainAllFocusableElements = (element) => {
  13793. const nodes = [];
  13794. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  13795. acceptNode: (node) => {
  13796. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  13797. if (node.disabled || node.hidden || isHiddenInput)
  13798. return NodeFilter.FILTER_SKIP;
  13799. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  13800. }
  13801. });
  13802. while (walker.nextNode())
  13803. nodes.push(walker.currentNode);
  13804. return nodes;
  13805. };
  13806. const getVisibleElement = (elements, container) => {
  13807. for (const element of elements) {
  13808. if (!isHidden(element, container))
  13809. return element;
  13810. }
  13811. };
  13812. const isHidden = (element, container) => {
  13813. if (getComputedStyle(element).visibility === "hidden")
  13814. return true;
  13815. while (element) {
  13816. if (container && element === container)
  13817. return false;
  13818. if (getComputedStyle(element).display === "none")
  13819. return true;
  13820. element = element.parentElement;
  13821. }
  13822. return false;
  13823. };
  13824. const getEdges = (container) => {
  13825. const focusable = obtainAllFocusableElements(container);
  13826. const first = getVisibleElement(focusable, container);
  13827. const last = getVisibleElement(focusable.reverse(), container);
  13828. return [first, last];
  13829. };
  13830. const isSelectable = (element) => {
  13831. return element instanceof HTMLInputElement && "select" in element;
  13832. };
  13833. const tryFocus = (element, shouldSelect) => {
  13834. if (element && element.focus) {
  13835. const prevFocusedElement = document.activeElement;
  13836. element.focus({ preventScroll: true });
  13837. lastAutomatedFocusTimestamp.value = window.performance.now();
  13838. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  13839. element.select();
  13840. }
  13841. }
  13842. };
  13843. function removeFromStack(list, item) {
  13844. const copy = [...list];
  13845. const idx = list.indexOf(item);
  13846. if (idx !== -1) {
  13847. copy.splice(idx, 1);
  13848. }
  13849. return copy;
  13850. }
  13851. const createFocusableStack = () => {
  13852. let stack = [];
  13853. const push = (layer) => {
  13854. const currentLayer = stack[0];
  13855. if (currentLayer && layer !== currentLayer) {
  13856. currentLayer.pause();
  13857. }
  13858. stack = removeFromStack(stack, layer);
  13859. stack.unshift(layer);
  13860. };
  13861. const remove = (layer) => {
  13862. var _a, _b;
  13863. stack = removeFromStack(stack, layer);
  13864. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  13865. };
  13866. return {
  13867. push,
  13868. remove
  13869. };
  13870. };
  13871. const focusFirstDescendant = (elements, shouldSelect = false) => {
  13872. const prevFocusedElement = document.activeElement;
  13873. for (const element of elements) {
  13874. tryFocus(element, shouldSelect);
  13875. if (document.activeElement !== prevFocusedElement)
  13876. return;
  13877. }
  13878. };
  13879. const focusableStack = createFocusableStack();
  13880. const isFocusCausedByUserEvent = () => {
  13881. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  13882. };
  13883. const notifyFocusReasonPointer = () => {
  13884. focusReason.value = "pointer";
  13885. lastUserFocusTimestamp.value = window.performance.now();
  13886. };
  13887. const notifyFocusReasonKeydown = () => {
  13888. focusReason.value = "keyboard";
  13889. lastUserFocusTimestamp.value = window.performance.now();
  13890. };
  13891. const useFocusReason = () => {
  13892. vue.onMounted(() => {
  13893. if (focusReasonUserCount === 0) {
  13894. document.addEventListener("mousedown", notifyFocusReasonPointer);
  13895. document.addEventListener("touchstart", notifyFocusReasonPointer);
  13896. document.addEventListener("keydown", notifyFocusReasonKeydown);
  13897. }
  13898. focusReasonUserCount++;
  13899. });
  13900. vue.onBeforeUnmount(() => {
  13901. focusReasonUserCount--;
  13902. if (focusReasonUserCount <= 0) {
  13903. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  13904. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  13905. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  13906. }
  13907. });
  13908. return {
  13909. focusReason,
  13910. lastUserFocusTimestamp,
  13911. lastAutomatedFocusTimestamp
  13912. };
  13913. };
  13914. const createFocusOutPreventedEvent = (detail) => {
  13915. return new CustomEvent(FOCUSOUT_PREVENTED, {
  13916. ...FOCUSOUT_PREVENTED_OPTS,
  13917. detail
  13918. });
  13919. };
  13920. const _sfc_main$26 = vue.defineComponent({
  13921. name: "ElFocusTrap",
  13922. inheritAttrs: false,
  13923. props: {
  13924. loop: Boolean,
  13925. trapped: Boolean,
  13926. focusTrapEl: Object,
  13927. focusStartEl: {
  13928. type: [Object, String],
  13929. default: "first"
  13930. }
  13931. },
  13932. emits: [
  13933. ON_TRAP_FOCUS_EVT,
  13934. ON_RELEASE_FOCUS_EVT,
  13935. "focusin",
  13936. "focusout",
  13937. "focusout-prevented",
  13938. "release-requested"
  13939. ],
  13940. setup(props, { emit }) {
  13941. const forwardRef = vue.ref();
  13942. let lastFocusBeforeTrapped;
  13943. let lastFocusAfterTrapped;
  13944. const { focusReason } = useFocusReason();
  13945. useEscapeKeydown((event) => {
  13946. if (props.trapped && !focusLayer.paused) {
  13947. emit("release-requested", event);
  13948. }
  13949. });
  13950. const focusLayer = {
  13951. paused: false,
  13952. pause() {
  13953. this.paused = true;
  13954. },
  13955. resume() {
  13956. this.paused = false;
  13957. }
  13958. };
  13959. const onKeydown = (e) => {
  13960. if (!props.loop && !props.trapped)
  13961. return;
  13962. if (focusLayer.paused)
  13963. return;
  13964. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  13965. const { loop } = props;
  13966. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  13967. const currentFocusingEl = document.activeElement;
  13968. if (isTabbing && currentFocusingEl) {
  13969. const container = currentTarget;
  13970. const [first, last] = getEdges(container);
  13971. const isTabbable = first && last;
  13972. if (!isTabbable) {
  13973. if (currentFocusingEl === container) {
  13974. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  13975. focusReason: focusReason.value
  13976. });
  13977. emit("focusout-prevented", focusoutPreventedEvent);
  13978. if (!focusoutPreventedEvent.defaultPrevented) {
  13979. e.preventDefault();
  13980. }
  13981. }
  13982. } else {
  13983. if (!shiftKey && currentFocusingEl === last) {
  13984. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  13985. focusReason: focusReason.value
  13986. });
  13987. emit("focusout-prevented", focusoutPreventedEvent);
  13988. if (!focusoutPreventedEvent.defaultPrevented) {
  13989. e.preventDefault();
  13990. if (loop)
  13991. tryFocus(first, true);
  13992. }
  13993. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  13994. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  13995. focusReason: focusReason.value
  13996. });
  13997. emit("focusout-prevented", focusoutPreventedEvent);
  13998. if (!focusoutPreventedEvent.defaultPrevented) {
  13999. e.preventDefault();
  14000. if (loop)
  14001. tryFocus(last, true);
  14002. }
  14003. }
  14004. }
  14005. }
  14006. };
  14007. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  14008. focusTrapRef: forwardRef,
  14009. onKeydown
  14010. });
  14011. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  14012. if (focusTrapEl) {
  14013. forwardRef.value = focusTrapEl;
  14014. }
  14015. }, { immediate: true });
  14016. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  14017. if (forwardRef2) {
  14018. forwardRef2.addEventListener("keydown", onKeydown);
  14019. forwardRef2.addEventListener("focusin", onFocusIn);
  14020. forwardRef2.addEventListener("focusout", onFocusOut);
  14021. }
  14022. if (oldForwardRef) {
  14023. oldForwardRef.removeEventListener("keydown", onKeydown);
  14024. oldForwardRef.removeEventListener("focusin", onFocusIn);
  14025. oldForwardRef.removeEventListener("focusout", onFocusOut);
  14026. }
  14027. });
  14028. const trapOnFocus = (e) => {
  14029. emit(ON_TRAP_FOCUS_EVT, e);
  14030. };
  14031. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  14032. const onFocusIn = (e) => {
  14033. const trapContainer = vue.unref(forwardRef);
  14034. if (!trapContainer)
  14035. return;
  14036. const target = e.target;
  14037. const relatedTarget = e.relatedTarget;
  14038. const isFocusedInTrap = target && trapContainer.contains(target);
  14039. if (!props.trapped) {
  14040. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  14041. if (!isPrevFocusedInTrap) {
  14042. lastFocusBeforeTrapped = relatedTarget;
  14043. }
  14044. }
  14045. if (isFocusedInTrap)
  14046. emit("focusin", e);
  14047. if (focusLayer.paused)
  14048. return;
  14049. if (props.trapped) {
  14050. if (isFocusedInTrap) {
  14051. lastFocusAfterTrapped = target;
  14052. } else {
  14053. tryFocus(lastFocusAfterTrapped, true);
  14054. }
  14055. }
  14056. };
  14057. const onFocusOut = (e) => {
  14058. const trapContainer = vue.unref(forwardRef);
  14059. if (focusLayer.paused || !trapContainer)
  14060. return;
  14061. if (props.trapped) {
  14062. const relatedTarget = e.relatedTarget;
  14063. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  14064. setTimeout(() => {
  14065. if (!focusLayer.paused && props.trapped) {
  14066. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14067. focusReason: focusReason.value
  14068. });
  14069. emit("focusout-prevented", focusoutPreventedEvent);
  14070. if (!focusoutPreventedEvent.defaultPrevented) {
  14071. tryFocus(lastFocusAfterTrapped, true);
  14072. }
  14073. }
  14074. }, 0);
  14075. }
  14076. } else {
  14077. const target = e.target;
  14078. const isFocusedInTrap = target && trapContainer.contains(target);
  14079. if (!isFocusedInTrap)
  14080. emit("focusout", e);
  14081. }
  14082. };
  14083. async function startTrap() {
  14084. await vue.nextTick();
  14085. const trapContainer = vue.unref(forwardRef);
  14086. if (trapContainer) {
  14087. focusableStack.push(focusLayer);
  14088. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  14089. lastFocusBeforeTrapped = prevFocusedElement;
  14090. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  14091. if (!isPrevFocusContained) {
  14092. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  14093. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14094. trapContainer.dispatchEvent(focusEvent);
  14095. if (!focusEvent.defaultPrevented) {
  14096. vue.nextTick(() => {
  14097. let focusStartEl = props.focusStartEl;
  14098. if (!isString$1(focusStartEl)) {
  14099. tryFocus(focusStartEl);
  14100. if (document.activeElement !== focusStartEl) {
  14101. focusStartEl = "first";
  14102. }
  14103. }
  14104. if (focusStartEl === "first") {
  14105. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  14106. }
  14107. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  14108. tryFocus(trapContainer);
  14109. }
  14110. });
  14111. }
  14112. }
  14113. }
  14114. }
  14115. function stopTrap() {
  14116. const trapContainer = vue.unref(forwardRef);
  14117. if (trapContainer) {
  14118. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14119. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  14120. ...FOCUS_AFTER_TRAPPED_OPTS,
  14121. detail: {
  14122. focusReason: focusReason.value
  14123. }
  14124. });
  14125. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14126. trapContainer.dispatchEvent(releasedEvent);
  14127. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  14128. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  14129. }
  14130. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus);
  14131. focusableStack.remove(focusLayer);
  14132. }
  14133. }
  14134. vue.onMounted(() => {
  14135. if (props.trapped) {
  14136. startTrap();
  14137. }
  14138. vue.watch(() => props.trapped, (trapped) => {
  14139. if (trapped) {
  14140. startTrap();
  14141. } else {
  14142. stopTrap();
  14143. }
  14144. });
  14145. });
  14146. vue.onBeforeUnmount(() => {
  14147. if (props.trapped) {
  14148. stopTrap();
  14149. }
  14150. });
  14151. return {
  14152. onKeydown
  14153. };
  14154. }
  14155. });
  14156. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  14157. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  14158. }
  14159. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["render", _sfc_render$v], ["__file", "focus-trap.vue"]]);
  14160. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  14161. const popperCoreConfigProps = buildProps({
  14162. boundariesPadding: {
  14163. type: Number,
  14164. default: 0
  14165. },
  14166. fallbackPlacements: {
  14167. type: definePropType(Array),
  14168. default: void 0
  14169. },
  14170. gpuAcceleration: {
  14171. type: Boolean,
  14172. default: true
  14173. },
  14174. offset: {
  14175. type: Number,
  14176. default: 12
  14177. },
  14178. placement: {
  14179. type: String,
  14180. values: Ee,
  14181. default: "bottom"
  14182. },
  14183. popperOptions: {
  14184. type: definePropType(Object),
  14185. default: () => ({})
  14186. },
  14187. strategy: {
  14188. type: String,
  14189. values: POSITIONING_STRATEGIES,
  14190. default: "absolute"
  14191. }
  14192. });
  14193. const popperContentProps = buildProps({
  14194. ...popperCoreConfigProps,
  14195. id: String,
  14196. style: {
  14197. type: definePropType([String, Array, Object])
  14198. },
  14199. className: {
  14200. type: definePropType([String, Array, Object])
  14201. },
  14202. effect: {
  14203. type: String,
  14204. default: "dark"
  14205. },
  14206. visible: Boolean,
  14207. enterable: {
  14208. type: Boolean,
  14209. default: true
  14210. },
  14211. pure: Boolean,
  14212. focusOnShow: {
  14213. type: Boolean,
  14214. default: false
  14215. },
  14216. trapping: {
  14217. type: Boolean,
  14218. default: false
  14219. },
  14220. popperClass: {
  14221. type: definePropType([String, Array, Object])
  14222. },
  14223. popperStyle: {
  14224. type: definePropType([String, Array, Object])
  14225. },
  14226. referenceEl: {
  14227. type: definePropType(Object)
  14228. },
  14229. triggerTargetEl: {
  14230. type: definePropType(Object)
  14231. },
  14232. stopPopperMouseEvent: {
  14233. type: Boolean,
  14234. default: true
  14235. },
  14236. ariaLabel: {
  14237. type: String,
  14238. default: void 0
  14239. },
  14240. virtualTriggering: Boolean,
  14241. zIndex: Number
  14242. });
  14243. const popperContentEmits = {
  14244. mouseenter: (evt) => evt instanceof MouseEvent,
  14245. mouseleave: (evt) => evt instanceof MouseEvent,
  14246. focus: () => true,
  14247. blur: () => true,
  14248. close: () => true
  14249. };
  14250. const usePopperCoreConfigProps = popperCoreConfigProps;
  14251. const usePopperContentProps = popperContentProps;
  14252. const usePopperContentEmits = popperContentEmits;
  14253. const buildPopperOptions = (props, modifiers = []) => {
  14254. const { placement, strategy, popperOptions } = props;
  14255. const options = {
  14256. placement,
  14257. strategy,
  14258. ...popperOptions,
  14259. modifiers: [...genModifiers(props), ...modifiers]
  14260. };
  14261. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  14262. return options;
  14263. };
  14264. const unwrapMeasurableEl = ($el) => {
  14265. if (!isClient)
  14266. return;
  14267. return unrefElement($el);
  14268. };
  14269. function genModifiers(options) {
  14270. const { offset, gpuAcceleration, fallbackPlacements } = options;
  14271. return [
  14272. {
  14273. name: "offset",
  14274. options: {
  14275. offset: [0, offset != null ? offset : 12]
  14276. }
  14277. },
  14278. {
  14279. name: "preventOverflow",
  14280. options: {
  14281. padding: {
  14282. top: 2,
  14283. bottom: 2,
  14284. left: 5,
  14285. right: 5
  14286. }
  14287. }
  14288. },
  14289. {
  14290. name: "flip",
  14291. options: {
  14292. padding: 5,
  14293. fallbackPlacements
  14294. }
  14295. },
  14296. {
  14297. name: "computeStyles",
  14298. options: {
  14299. gpuAcceleration
  14300. }
  14301. }
  14302. ];
  14303. }
  14304. function deriveExtraModifiers(options, modifiers) {
  14305. if (modifiers) {
  14306. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  14307. }
  14308. }
  14309. const DEFAULT_ARROW_OFFSET = 0;
  14310. const usePopperContent = (props) => {
  14311. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  14312. const arrowRef = vue.ref();
  14313. const arrowOffset = vue.ref();
  14314. const eventListenerModifier = vue.computed(() => {
  14315. return {
  14316. name: "eventListeners",
  14317. enabled: !!props.visible
  14318. };
  14319. });
  14320. const arrowModifier = vue.computed(() => {
  14321. var _a;
  14322. const arrowEl = vue.unref(arrowRef);
  14323. const offset = (_a = vue.unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  14324. return {
  14325. name: "arrow",
  14326. enabled: !isUndefined$1(arrowEl),
  14327. options: {
  14328. element: arrowEl,
  14329. padding: offset
  14330. }
  14331. };
  14332. });
  14333. const options = vue.computed(() => {
  14334. return {
  14335. onFirstUpdate: () => {
  14336. update();
  14337. },
  14338. ...buildPopperOptions(props, [
  14339. vue.unref(arrowModifier),
  14340. vue.unref(eventListenerModifier)
  14341. ])
  14342. };
  14343. });
  14344. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  14345. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  14346. vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  14347. vue.onMounted(() => {
  14348. vue.watch(() => {
  14349. var _a;
  14350. return (_a = vue.unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
  14351. }, () => {
  14352. update();
  14353. });
  14354. });
  14355. return {
  14356. attributes,
  14357. arrowRef,
  14358. contentRef,
  14359. instanceRef,
  14360. state,
  14361. styles,
  14362. role,
  14363. forceUpdate,
  14364. update
  14365. };
  14366. };
  14367. const usePopperContentDOM = (props, {
  14368. attributes,
  14369. styles,
  14370. role
  14371. }) => {
  14372. const { nextZIndex } = useZIndex();
  14373. const ns = useNamespace("popper");
  14374. const contentAttrs = vue.computed(() => vue.unref(attributes).popper);
  14375. const contentZIndex = vue.ref(props.zIndex || nextZIndex());
  14376. const contentClass = vue.computed(() => [
  14377. ns.b(),
  14378. ns.is("pure", props.pure),
  14379. ns.is(props.effect),
  14380. props.popperClass
  14381. ]);
  14382. const contentStyle = vue.computed(() => {
  14383. return [
  14384. { zIndex: vue.unref(contentZIndex) },
  14385. props.popperStyle || {},
  14386. vue.unref(styles).popper
  14387. ];
  14388. });
  14389. const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0);
  14390. const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {});
  14391. const updateZIndex = () => {
  14392. contentZIndex.value = props.zIndex || nextZIndex();
  14393. };
  14394. return {
  14395. ariaModal,
  14396. arrowStyle,
  14397. contentAttrs,
  14398. contentClass,
  14399. contentStyle,
  14400. contentZIndex,
  14401. updateZIndex
  14402. };
  14403. };
  14404. const usePopperContentFocusTrap = (props, emit) => {
  14405. const trapped = vue.ref(false);
  14406. const focusStartRef = vue.ref();
  14407. const onFocusAfterTrapped = () => {
  14408. emit("focus");
  14409. };
  14410. const onFocusAfterReleased = (event) => {
  14411. var _a;
  14412. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  14413. focusStartRef.value = "first";
  14414. emit("blur");
  14415. }
  14416. };
  14417. const onFocusInTrap = (event) => {
  14418. if (props.visible && !trapped.value) {
  14419. if (event.target) {
  14420. focusStartRef.value = event.target;
  14421. }
  14422. trapped.value = true;
  14423. }
  14424. };
  14425. const onFocusoutPrevented = (event) => {
  14426. if (!props.trapping) {
  14427. if (event.detail.focusReason === "pointer") {
  14428. event.preventDefault();
  14429. }
  14430. trapped.value = false;
  14431. }
  14432. };
  14433. const onReleaseRequested = () => {
  14434. trapped.value = false;
  14435. emit("close");
  14436. };
  14437. return {
  14438. focusStartRef,
  14439. trapped,
  14440. onFocusAfterReleased,
  14441. onFocusAfterTrapped,
  14442. onFocusInTrap,
  14443. onFocusoutPrevented,
  14444. onReleaseRequested
  14445. };
  14446. };
  14447. const __default__$1s = vue.defineComponent({
  14448. name: "ElPopperContent"
  14449. });
  14450. const _sfc_main$25 = /* @__PURE__ */ vue.defineComponent({
  14451. ...__default__$1s,
  14452. props: popperContentProps,
  14453. emits: popperContentEmits,
  14454. setup(__props, { expose, emit }) {
  14455. const props = __props;
  14456. const {
  14457. focusStartRef,
  14458. trapped,
  14459. onFocusAfterReleased,
  14460. onFocusAfterTrapped,
  14461. onFocusInTrap,
  14462. onFocusoutPrevented,
  14463. onReleaseRequested
  14464. } = usePopperContentFocusTrap(props, emit);
  14465. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  14466. const {
  14467. ariaModal,
  14468. arrowStyle,
  14469. contentAttrs,
  14470. contentClass,
  14471. contentStyle,
  14472. updateZIndex
  14473. } = usePopperContentDOM(props, {
  14474. styles,
  14475. attributes,
  14476. role
  14477. });
  14478. const formItemContext = vue.inject(formItemContextKey, void 0);
  14479. const arrowOffset = vue.ref();
  14480. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  14481. arrowStyle,
  14482. arrowRef,
  14483. arrowOffset
  14484. });
  14485. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  14486. vue.provide(formItemContextKey, {
  14487. ...formItemContext,
  14488. addInputId: NOOP,
  14489. removeInputId: NOOP
  14490. });
  14491. }
  14492. let triggerTargetAriaStopWatch = void 0;
  14493. const updatePopper = (shouldUpdateZIndex = true) => {
  14494. update();
  14495. shouldUpdateZIndex && updateZIndex();
  14496. };
  14497. const togglePopperAlive = () => {
  14498. updatePopper(false);
  14499. if (props.visible && props.focusOnShow) {
  14500. trapped.value = true;
  14501. } else if (props.visible === false) {
  14502. trapped.value = false;
  14503. }
  14504. };
  14505. vue.onMounted(() => {
  14506. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  14507. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14508. triggerTargetAriaStopWatch = void 0;
  14509. const el = vue.unref(triggerTargetEl || contentRef.value);
  14510. const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value);
  14511. if (isElement$1(el)) {
  14512. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  14513. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  14514. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14515. });
  14516. }, { immediate: true });
  14517. }
  14518. if (prevEl !== el && isElement$1(prevEl)) {
  14519. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  14520. prevEl.removeAttribute(key);
  14521. });
  14522. }
  14523. }, { immediate: true });
  14524. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  14525. });
  14526. vue.onBeforeUnmount(() => {
  14527. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14528. triggerTargetAriaStopWatch = void 0;
  14529. });
  14530. expose({
  14531. popperContentRef: contentRef,
  14532. popperInstanceRef: instanceRef,
  14533. updatePopper,
  14534. contentStyle
  14535. });
  14536. return (_ctx, _cache) => {
  14537. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  14538. ref_key: "contentRef",
  14539. ref: contentRef
  14540. }, vue.unref(contentAttrs), {
  14541. style: vue.unref(contentStyle),
  14542. class: vue.unref(contentClass),
  14543. tabindex: "-1",
  14544. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  14545. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  14546. }), [
  14547. vue.createVNode(vue.unref(ElFocusTrap), {
  14548. trapped: vue.unref(trapped),
  14549. "trap-on-focus-in": true,
  14550. "focus-trap-el": vue.unref(contentRef),
  14551. "focus-start-el": vue.unref(focusStartRef),
  14552. onFocusAfterTrapped: vue.unref(onFocusAfterTrapped),
  14553. onFocusAfterReleased: vue.unref(onFocusAfterReleased),
  14554. onFocusin: vue.unref(onFocusInTrap),
  14555. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  14556. onReleaseRequested: vue.unref(onReleaseRequested)
  14557. }, {
  14558. default: vue.withCtx(() => [
  14559. vue.renderSlot(_ctx.$slots, "default")
  14560. ]),
  14561. _: 3
  14562. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  14563. ], 16);
  14564. };
  14565. }
  14566. });
  14567. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "content.vue"]]);
  14568. const ElPopper = withInstall(Popper);
  14569. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  14570. const useTooltipContentProps = buildProps({
  14571. ...useDelayedToggleProps,
  14572. ...popperContentProps,
  14573. appendTo: {
  14574. type: definePropType([String, Object])
  14575. },
  14576. content: {
  14577. type: String,
  14578. default: ""
  14579. },
  14580. rawContent: {
  14581. type: Boolean,
  14582. default: false
  14583. },
  14584. persistent: Boolean,
  14585. ariaLabel: String,
  14586. visible: {
  14587. type: definePropType(Boolean),
  14588. default: null
  14589. },
  14590. transition: String,
  14591. teleported: {
  14592. type: Boolean,
  14593. default: true
  14594. },
  14595. disabled: Boolean
  14596. });
  14597. const useTooltipTriggerProps = buildProps({
  14598. ...popperTriggerProps,
  14599. disabled: Boolean,
  14600. trigger: {
  14601. type: definePropType([String, Array]),
  14602. default: "hover"
  14603. },
  14604. triggerKeys: {
  14605. type: definePropType(Array),
  14606. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  14607. }
  14608. });
  14609. const {
  14610. useModelToggleProps: useTooltipModelToggleProps,
  14611. useModelToggleEmits: useTooltipModelToggleEmits,
  14612. useModelToggle: useTooltipModelToggle
  14613. } = createModelToggleComposable("visible");
  14614. const useTooltipProps = buildProps({
  14615. ...popperProps,
  14616. ...useTooltipModelToggleProps,
  14617. ...useTooltipContentProps,
  14618. ...useTooltipTriggerProps,
  14619. ...popperArrowProps,
  14620. showArrow: {
  14621. type: Boolean,
  14622. default: true
  14623. }
  14624. });
  14625. const tooltipEmits = [
  14626. ...useTooltipModelToggleEmits,
  14627. "before-show",
  14628. "before-hide",
  14629. "show",
  14630. "hide",
  14631. "open",
  14632. "close"
  14633. ];
  14634. const isTriggerType = (trigger, type) => {
  14635. if (isArray$1(trigger)) {
  14636. return trigger.includes(type);
  14637. }
  14638. return trigger === type;
  14639. };
  14640. const whenTrigger = (trigger, type, handler) => {
  14641. return (e) => {
  14642. isTriggerType(vue.unref(trigger), type) && handler(e);
  14643. };
  14644. };
  14645. const __default__$1r = vue.defineComponent({
  14646. name: "ElTooltipTrigger"
  14647. });
  14648. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  14649. ...__default__$1r,
  14650. props: useTooltipTriggerProps,
  14651. setup(__props, { expose }) {
  14652. const props = __props;
  14653. const ns = useNamespace("tooltip");
  14654. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  14655. const triggerRef = vue.ref(null);
  14656. const stopWhenControlledOrDisabled = () => {
  14657. if (vue.unref(controlled) || props.disabled) {
  14658. return true;
  14659. }
  14660. };
  14661. const trigger = vue.toRef(props, "trigger");
  14662. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  14663. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  14664. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  14665. if (e.button === 0) {
  14666. onToggle(e);
  14667. }
  14668. }));
  14669. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  14670. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  14671. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  14672. e.preventDefault();
  14673. onToggle(e);
  14674. }));
  14675. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  14676. const { code } = e;
  14677. if (props.triggerKeys.includes(code)) {
  14678. e.preventDefault();
  14679. onToggle(e);
  14680. }
  14681. });
  14682. expose({
  14683. triggerRef
  14684. });
  14685. return (_ctx, _cache) => {
  14686. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  14687. id: vue.unref(id),
  14688. "virtual-ref": _ctx.virtualRef,
  14689. open: vue.unref(open),
  14690. "virtual-triggering": _ctx.virtualTriggering,
  14691. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  14692. onBlur: vue.unref(onBlur),
  14693. onClick: vue.unref(onClick),
  14694. onContextmenu: vue.unref(onContextMenu),
  14695. onFocus: vue.unref(onFocus),
  14696. onMouseenter: vue.unref(onMouseenter),
  14697. onMouseleave: vue.unref(onMouseleave),
  14698. onKeydown: vue.unref(onKeydown)
  14699. }, {
  14700. default: vue.withCtx(() => [
  14701. vue.renderSlot(_ctx.$slots, "default")
  14702. ]),
  14703. _: 3
  14704. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  14705. };
  14706. }
  14707. });
  14708. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "trigger.vue"]]);
  14709. const __default__$1q = vue.defineComponent({
  14710. name: "ElTooltipContent",
  14711. inheritAttrs: false
  14712. });
  14713. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  14714. ...__default__$1q,
  14715. props: useTooltipContentProps,
  14716. setup(__props, { expose }) {
  14717. const props = __props;
  14718. const { selector } = usePopperContainerId();
  14719. const ns = useNamespace("tooltip");
  14720. const contentRef = vue.ref(null);
  14721. const destroyed = vue.ref(false);
  14722. const {
  14723. controlled,
  14724. id,
  14725. open,
  14726. trigger,
  14727. onClose,
  14728. onOpen,
  14729. onShow,
  14730. onHide,
  14731. onBeforeShow,
  14732. onBeforeHide
  14733. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  14734. const transitionClass = vue.computed(() => {
  14735. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  14736. });
  14737. const persistentRef = vue.computed(() => {
  14738. return props.persistent;
  14739. });
  14740. vue.onBeforeUnmount(() => {
  14741. destroyed.value = true;
  14742. });
  14743. const shouldRender = vue.computed(() => {
  14744. return vue.unref(persistentRef) ? true : vue.unref(open);
  14745. });
  14746. const shouldShow = vue.computed(() => {
  14747. return props.disabled ? false : vue.unref(open);
  14748. });
  14749. const appendTo = vue.computed(() => {
  14750. return props.appendTo || selector.value;
  14751. });
  14752. const contentStyle = vue.computed(() => {
  14753. var _a;
  14754. return (_a = props.style) != null ? _a : {};
  14755. });
  14756. const ariaHidden = vue.computed(() => !vue.unref(open));
  14757. const onTransitionLeave = () => {
  14758. onHide();
  14759. };
  14760. const stopWhenControlled = () => {
  14761. if (vue.unref(controlled))
  14762. return true;
  14763. };
  14764. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  14765. if (props.enterable && vue.unref(trigger) === "hover") {
  14766. onOpen();
  14767. }
  14768. });
  14769. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  14770. if (vue.unref(trigger) === "hover") {
  14771. onClose();
  14772. }
  14773. });
  14774. const onBeforeEnter = () => {
  14775. var _a, _b;
  14776. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  14777. onBeforeShow == null ? void 0 : onBeforeShow();
  14778. };
  14779. const onBeforeLeave = () => {
  14780. onBeforeHide == null ? void 0 : onBeforeHide();
  14781. };
  14782. const onAfterShow = () => {
  14783. onShow();
  14784. stopHandle = onClickOutside(vue.computed(() => {
  14785. var _a;
  14786. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  14787. }), () => {
  14788. if (vue.unref(controlled))
  14789. return;
  14790. const $trigger = vue.unref(trigger);
  14791. if ($trigger !== "hover") {
  14792. onClose();
  14793. }
  14794. });
  14795. };
  14796. const onBlur = () => {
  14797. if (!props.virtualTriggering) {
  14798. onClose();
  14799. }
  14800. };
  14801. let stopHandle;
  14802. vue.watch(() => vue.unref(open), (val) => {
  14803. if (!val) {
  14804. stopHandle == null ? void 0 : stopHandle();
  14805. }
  14806. }, {
  14807. flush: "post"
  14808. });
  14809. vue.watch(() => props.content, () => {
  14810. var _a, _b;
  14811. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  14812. });
  14813. expose({
  14814. contentRef
  14815. });
  14816. return (_ctx, _cache) => {
  14817. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  14818. disabled: !_ctx.teleported,
  14819. to: vue.unref(appendTo)
  14820. }, [
  14821. vue.createVNode(vue.Transition, {
  14822. name: vue.unref(transitionClass),
  14823. onAfterLeave: onTransitionLeave,
  14824. onBeforeEnter,
  14825. onAfterEnter: onAfterShow,
  14826. onBeforeLeave
  14827. }, {
  14828. default: vue.withCtx(() => [
  14829. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  14830. key: 0,
  14831. id: vue.unref(id),
  14832. ref_key: "contentRef",
  14833. ref: contentRef
  14834. }, _ctx.$attrs, {
  14835. "aria-label": _ctx.ariaLabel,
  14836. "aria-hidden": vue.unref(ariaHidden),
  14837. "boundaries-padding": _ctx.boundariesPadding,
  14838. "fallback-placements": _ctx.fallbackPlacements,
  14839. "gpu-acceleration": _ctx.gpuAcceleration,
  14840. offset: _ctx.offset,
  14841. placement: _ctx.placement,
  14842. "popper-options": _ctx.popperOptions,
  14843. strategy: _ctx.strategy,
  14844. effect: _ctx.effect,
  14845. enterable: _ctx.enterable,
  14846. pure: _ctx.pure,
  14847. "popper-class": _ctx.popperClass,
  14848. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  14849. "reference-el": _ctx.referenceEl,
  14850. "trigger-target-el": _ctx.triggerTargetEl,
  14851. visible: vue.unref(shouldShow),
  14852. "z-index": _ctx.zIndex,
  14853. onMouseenter: vue.unref(onContentEnter),
  14854. onMouseleave: vue.unref(onContentLeave),
  14855. onBlur,
  14856. onClose: vue.unref(onClose)
  14857. }), {
  14858. default: vue.withCtx(() => [
  14859. !destroyed.value ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  14860. ]),
  14861. _: 3
  14862. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
  14863. [vue.vShow, vue.unref(shouldShow)]
  14864. ]) : vue.createCommentVNode("v-if", true)
  14865. ]),
  14866. _: 3
  14867. }, 8, ["name"])
  14868. ], 8, ["disabled", "to"]);
  14869. };
  14870. }
  14871. });
  14872. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "content.vue"]]);
  14873. const _hoisted_1$11 = ["innerHTML"];
  14874. const _hoisted_2$F = { key: 1 };
  14875. const __default__$1p = vue.defineComponent({
  14876. name: "ElTooltip"
  14877. });
  14878. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  14879. ...__default__$1p,
  14880. props: useTooltipProps,
  14881. emits: tooltipEmits,
  14882. setup(__props, { expose, emit }) {
  14883. const props = __props;
  14884. usePopperContainer();
  14885. const id = useId();
  14886. const popperRef = vue.ref();
  14887. const contentRef = vue.ref();
  14888. const updatePopper = () => {
  14889. var _a;
  14890. const popperComponent = vue.unref(popperRef);
  14891. if (popperComponent) {
  14892. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  14893. }
  14894. };
  14895. const open = vue.ref(false);
  14896. const toggleReason = vue.ref();
  14897. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  14898. indicator: open,
  14899. toggleReason
  14900. });
  14901. const { onOpen, onClose } = useDelayedToggle({
  14902. showAfter: vue.toRef(props, "showAfter"),
  14903. hideAfter: vue.toRef(props, "hideAfter"),
  14904. autoClose: vue.toRef(props, "autoClose"),
  14905. open: show,
  14906. close: hide
  14907. });
  14908. const controlled = vue.computed(() => isBoolean$1(props.visible) && !hasUpdateHandler.value);
  14909. vue.provide(TOOLTIP_INJECTION_KEY, {
  14910. controlled,
  14911. id,
  14912. open: vue.readonly(open),
  14913. trigger: vue.toRef(props, "trigger"),
  14914. onOpen: (event) => {
  14915. onOpen(event);
  14916. },
  14917. onClose: (event) => {
  14918. onClose(event);
  14919. },
  14920. onToggle: (event) => {
  14921. if (vue.unref(open)) {
  14922. onClose(event);
  14923. } else {
  14924. onOpen(event);
  14925. }
  14926. },
  14927. onShow: () => {
  14928. emit("show", toggleReason.value);
  14929. },
  14930. onHide: () => {
  14931. emit("hide", toggleReason.value);
  14932. },
  14933. onBeforeShow: () => {
  14934. emit("before-show", toggleReason.value);
  14935. },
  14936. onBeforeHide: () => {
  14937. emit("before-hide", toggleReason.value);
  14938. },
  14939. updatePopper
  14940. });
  14941. vue.watch(() => props.disabled, (disabled) => {
  14942. if (disabled && open.value) {
  14943. open.value = false;
  14944. }
  14945. });
  14946. const isFocusInsideContent = () => {
  14947. var _a, _b;
  14948. const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
  14949. return popperContent && popperContent.contains(document.activeElement);
  14950. };
  14951. vue.onDeactivated(() => open.value && hide());
  14952. expose({
  14953. popperRef,
  14954. contentRef,
  14955. isFocusInsideContent,
  14956. updatePopper,
  14957. onOpen,
  14958. onClose,
  14959. hide
  14960. });
  14961. return (_ctx, _cache) => {
  14962. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  14963. ref_key: "popperRef",
  14964. ref: popperRef,
  14965. role: _ctx.role
  14966. }, {
  14967. default: vue.withCtx(() => [
  14968. vue.createVNode(ElTooltipTrigger, {
  14969. disabled: _ctx.disabled,
  14970. trigger: _ctx.trigger,
  14971. "trigger-keys": _ctx.triggerKeys,
  14972. "virtual-ref": _ctx.virtualRef,
  14973. "virtual-triggering": _ctx.virtualTriggering
  14974. }, {
  14975. default: vue.withCtx(() => [
  14976. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  14977. ]),
  14978. _: 3
  14979. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  14980. vue.createVNode(ElTooltipContent, {
  14981. ref_key: "contentRef",
  14982. ref: contentRef,
  14983. "aria-label": _ctx.ariaLabel,
  14984. "boundaries-padding": _ctx.boundariesPadding,
  14985. content: _ctx.content,
  14986. disabled: _ctx.disabled,
  14987. effect: _ctx.effect,
  14988. enterable: _ctx.enterable,
  14989. "fallback-placements": _ctx.fallbackPlacements,
  14990. "hide-after": _ctx.hideAfter,
  14991. "gpu-acceleration": _ctx.gpuAcceleration,
  14992. offset: _ctx.offset,
  14993. persistent: _ctx.persistent,
  14994. "popper-class": _ctx.popperClass,
  14995. "popper-style": _ctx.popperStyle,
  14996. placement: _ctx.placement,
  14997. "popper-options": _ctx.popperOptions,
  14998. pure: _ctx.pure,
  14999. "raw-content": _ctx.rawContent,
  15000. "reference-el": _ctx.referenceEl,
  15001. "trigger-target-el": _ctx.triggerTargetEl,
  15002. "show-after": _ctx.showAfter,
  15003. strategy: _ctx.strategy,
  15004. teleported: _ctx.teleported,
  15005. transition: _ctx.transition,
  15006. "virtual-triggering": _ctx.virtualTriggering,
  15007. "z-index": _ctx.zIndex,
  15008. "append-to": _ctx.appendTo
  15009. }, {
  15010. default: vue.withCtx(() => [
  15011. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  15012. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  15013. key: 0,
  15014. innerHTML: _ctx.content
  15015. }, null, 8, _hoisted_1$11)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$F, vue.toDisplayString(_ctx.content), 1))
  15016. ]),
  15017. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  15018. key: 0,
  15019. "arrow-offset": _ctx.arrowOffset
  15020. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  15021. ]),
  15022. _: 3
  15023. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
  15024. ]),
  15025. _: 3
  15026. }, 8, ["role"]);
  15027. };
  15028. }
  15029. });
  15030. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "tooltip.vue"]]);
  15031. const ElTooltip = withInstall(Tooltip);
  15032. const autocompleteProps = buildProps({
  15033. valueKey: {
  15034. type: String,
  15035. default: "value"
  15036. },
  15037. modelValue: {
  15038. type: [String, Number],
  15039. default: ""
  15040. },
  15041. debounce: {
  15042. type: Number,
  15043. default: 300
  15044. },
  15045. placement: {
  15046. type: definePropType(String),
  15047. values: [
  15048. "top",
  15049. "top-start",
  15050. "top-end",
  15051. "bottom",
  15052. "bottom-start",
  15053. "bottom-end"
  15054. ],
  15055. default: "bottom-start"
  15056. },
  15057. fetchSuggestions: {
  15058. type: definePropType([Function, Array]),
  15059. default: NOOP
  15060. },
  15061. popperClass: {
  15062. type: String,
  15063. default: ""
  15064. },
  15065. triggerOnFocus: {
  15066. type: Boolean,
  15067. default: true
  15068. },
  15069. selectWhenUnmatched: {
  15070. type: Boolean,
  15071. default: false
  15072. },
  15073. hideLoading: {
  15074. type: Boolean,
  15075. default: false
  15076. },
  15077. label: {
  15078. type: String
  15079. },
  15080. teleported: useTooltipContentProps.teleported,
  15081. highlightFirstItem: {
  15082. type: Boolean,
  15083. default: false
  15084. },
  15085. fitInputWidth: {
  15086. type: Boolean,
  15087. default: false
  15088. },
  15089. clearable: {
  15090. type: Boolean,
  15091. default: false
  15092. },
  15093. disabled: {
  15094. type: Boolean,
  15095. default: false
  15096. },
  15097. name: String
  15098. });
  15099. const autocompleteEmits = {
  15100. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  15101. [INPUT_EVENT]: (value) => isString$1(value),
  15102. [CHANGE_EVENT]: (value) => isString$1(value),
  15103. focus: (evt) => evt instanceof FocusEvent,
  15104. blur: (evt) => evt instanceof FocusEvent,
  15105. clear: () => true,
  15106. select: (item) => isObject$1(item)
  15107. };
  15108. const _hoisted_1$10 = ["aria-expanded", "aria-owns"];
  15109. const _hoisted_2$E = { key: 0 };
  15110. const _hoisted_3$k = ["id", "aria-selected", "onClick"];
  15111. const COMPONENT_NAME$i = "ElAutocomplete";
  15112. const __default__$1o = vue.defineComponent({
  15113. name: COMPONENT_NAME$i,
  15114. inheritAttrs: false
  15115. });
  15116. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  15117. ...__default__$1o,
  15118. props: autocompleteProps,
  15119. emits: autocompleteEmits,
  15120. setup(__props, { expose, emit }) {
  15121. const props = __props;
  15122. const attrs = useAttrs();
  15123. const rawAttrs = vue.useAttrs();
  15124. const disabled = useFormDisabled();
  15125. const ns = useNamespace("autocomplete");
  15126. const inputRef = vue.ref();
  15127. const regionRef = vue.ref();
  15128. const popperRef = vue.ref();
  15129. const listboxRef = vue.ref();
  15130. let readonly = false;
  15131. let ignoreFocusEvent = false;
  15132. const suggestions = vue.ref([]);
  15133. const highlightedIndex = vue.ref(-1);
  15134. const dropdownWidth = vue.ref("");
  15135. const activated = vue.ref(false);
  15136. const suggestionDisabled = vue.ref(false);
  15137. const loading = vue.ref(false);
  15138. const listboxId = vue.computed(() => ns.b(String(generateId())));
  15139. const styles = vue.computed(() => rawAttrs.style);
  15140. const suggestionVisible = vue.computed(() => {
  15141. const isValidData = suggestions.value.length > 0;
  15142. return (isValidData || loading.value) && activated.value;
  15143. });
  15144. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  15145. const refInput = vue.computed(() => {
  15146. if (inputRef.value) {
  15147. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15148. }
  15149. return [];
  15150. });
  15151. const onSuggestionShow = async () => {
  15152. await vue.nextTick();
  15153. if (suggestionVisible.value) {
  15154. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  15155. }
  15156. };
  15157. const onHide = () => {
  15158. highlightedIndex.value = -1;
  15159. };
  15160. const getData = async (queryString) => {
  15161. if (suggestionDisabled.value)
  15162. return;
  15163. const cb = (suggestionList) => {
  15164. loading.value = false;
  15165. if (suggestionDisabled.value)
  15166. return;
  15167. if (isArray$1(suggestionList)) {
  15168. suggestions.value = suggestionList;
  15169. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  15170. } else {
  15171. throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array");
  15172. }
  15173. };
  15174. loading.value = true;
  15175. if (isArray$1(props.fetchSuggestions)) {
  15176. cb(props.fetchSuggestions);
  15177. } else {
  15178. const result = await props.fetchSuggestions(queryString, cb);
  15179. if (isArray$1(result))
  15180. cb(result);
  15181. }
  15182. };
  15183. const debouncedGetData = debounce(getData, props.debounce);
  15184. const handleInput = (value) => {
  15185. const valuePresented = !!value;
  15186. emit(INPUT_EVENT, value);
  15187. emit(UPDATE_MODEL_EVENT, value);
  15188. suggestionDisabled.value = false;
  15189. activated.value || (activated.value = valuePresented);
  15190. if (!props.triggerOnFocus && !value) {
  15191. suggestionDisabled.value = true;
  15192. suggestions.value = [];
  15193. return;
  15194. }
  15195. debouncedGetData(value);
  15196. };
  15197. const handleMouseDown = (event) => {
  15198. var _a;
  15199. if (disabled.value)
  15200. return;
  15201. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15202. activated.value = true;
  15203. }
  15204. };
  15205. const handleChange = (value) => {
  15206. emit(CHANGE_EVENT, value);
  15207. };
  15208. const handleFocus = (evt) => {
  15209. if (!ignoreFocusEvent) {
  15210. activated.value = true;
  15211. emit("focus", evt);
  15212. if (props.triggerOnFocus && !readonly) {
  15213. debouncedGetData(String(props.modelValue));
  15214. }
  15215. } else {
  15216. ignoreFocusEvent = false;
  15217. }
  15218. };
  15219. const handleBlur = (evt) => {
  15220. setTimeout(() => {
  15221. var _a;
  15222. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  15223. ignoreFocusEvent = true;
  15224. return;
  15225. }
  15226. activated.value && close();
  15227. emit("blur", evt);
  15228. });
  15229. };
  15230. const handleClear = () => {
  15231. activated.value = false;
  15232. emit(UPDATE_MODEL_EVENT, "");
  15233. emit("clear");
  15234. };
  15235. const handleKeyEnter = async () => {
  15236. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  15237. handleSelect(suggestions.value[highlightedIndex.value]);
  15238. } else if (props.selectWhenUnmatched) {
  15239. emit("select", { value: props.modelValue });
  15240. suggestions.value = [];
  15241. highlightedIndex.value = -1;
  15242. }
  15243. };
  15244. const handleKeyEscape = (evt) => {
  15245. if (suggestionVisible.value) {
  15246. evt.preventDefault();
  15247. evt.stopPropagation();
  15248. close();
  15249. }
  15250. };
  15251. const close = () => {
  15252. activated.value = false;
  15253. };
  15254. const focus = () => {
  15255. var _a;
  15256. (_a = inputRef.value) == null ? void 0 : _a.focus();
  15257. };
  15258. const blur = () => {
  15259. var _a;
  15260. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15261. };
  15262. const handleSelect = async (item) => {
  15263. emit(INPUT_EVENT, item[props.valueKey]);
  15264. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  15265. emit("select", item);
  15266. suggestions.value = [];
  15267. highlightedIndex.value = -1;
  15268. };
  15269. const highlight = (index) => {
  15270. if (!suggestionVisible.value || loading.value)
  15271. return;
  15272. if (index < 0) {
  15273. highlightedIndex.value = -1;
  15274. return;
  15275. }
  15276. if (index >= suggestions.value.length) {
  15277. index = suggestions.value.length - 1;
  15278. }
  15279. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15280. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  15281. const highlightItem = suggestionList[index];
  15282. const scrollTop = suggestion.scrollTop;
  15283. const { offsetTop, scrollHeight } = highlightItem;
  15284. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  15285. suggestion.scrollTop += scrollHeight;
  15286. }
  15287. if (offsetTop < scrollTop) {
  15288. suggestion.scrollTop -= scrollHeight;
  15289. }
  15290. highlightedIndex.value = index;
  15291. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15292. };
  15293. onClickOutside(listboxRef, () => {
  15294. suggestionVisible.value && close();
  15295. });
  15296. vue.onMounted(() => {
  15297. inputRef.value.ref.setAttribute("role", "textbox");
  15298. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  15299. inputRef.value.ref.setAttribute("aria-controls", "id");
  15300. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15301. readonly = inputRef.value.ref.hasAttribute("readonly");
  15302. });
  15303. expose({
  15304. highlightedIndex,
  15305. activated,
  15306. loading,
  15307. inputRef,
  15308. popperRef,
  15309. suggestions,
  15310. handleSelect,
  15311. handleKeyEnter,
  15312. focus,
  15313. blur,
  15314. close,
  15315. highlight
  15316. });
  15317. return (_ctx, _cache) => {
  15318. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  15319. ref_key: "popperRef",
  15320. ref: popperRef,
  15321. visible: vue.unref(suggestionVisible),
  15322. placement: _ctx.placement,
  15323. "fallback-placements": ["bottom-start", "top-start"],
  15324. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  15325. teleported: _ctx.teleported,
  15326. "gpu-acceleration": false,
  15327. pure: "",
  15328. "manual-mode": "",
  15329. effect: "light",
  15330. trigger: "click",
  15331. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  15332. persistent: "",
  15333. onBeforeShow: onSuggestionShow,
  15334. onHide
  15335. }, {
  15336. content: vue.withCtx(() => [
  15337. vue.createElementVNode("div", {
  15338. ref_key: "regionRef",
  15339. ref: regionRef,
  15340. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  15341. style: vue.normalizeStyle({
  15342. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15343. outline: "none"
  15344. }),
  15345. role: "region"
  15346. }, [
  15347. vue.createVNode(vue.unref(ElScrollbar), {
  15348. id: vue.unref(listboxId),
  15349. tag: "ul",
  15350. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  15351. "view-class": vue.unref(ns).be("suggestion", "list"),
  15352. role: "listbox"
  15353. }, {
  15354. default: vue.withCtx(() => [
  15355. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_2$E, [
  15356. vue.createVNode(vue.unref(ElIcon), {
  15357. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  15358. }, {
  15359. default: vue.withCtx(() => [
  15360. vue.createVNode(vue.unref(loading_default))
  15361. ]),
  15362. _: 1
  15363. }, 8, ["class"])
  15364. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  15365. return vue.openBlock(), vue.createElementBlock("li", {
  15366. id: `${vue.unref(listboxId)}-item-${index}`,
  15367. key: index,
  15368. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  15369. role: "option",
  15370. "aria-selected": highlightedIndex.value === index,
  15371. onClick: ($event) => handleSelect(item)
  15372. }, [
  15373. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  15374. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  15375. ])
  15376. ], 10, _hoisted_3$k);
  15377. }), 128))
  15378. ]),
  15379. _: 3
  15380. }, 8, ["id", "wrap-class", "view-class"])
  15381. ], 6)
  15382. ]),
  15383. default: vue.withCtx(() => [
  15384. vue.createElementVNode("div", {
  15385. ref_key: "listboxRef",
  15386. ref: listboxRef,
  15387. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  15388. style: vue.normalizeStyle(vue.unref(styles)),
  15389. role: "combobox",
  15390. "aria-haspopup": "listbox",
  15391. "aria-expanded": vue.unref(suggestionVisible),
  15392. "aria-owns": vue.unref(listboxId)
  15393. }, [
  15394. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  15395. ref_key: "inputRef",
  15396. ref: inputRef
  15397. }, vue.unref(attrs), {
  15398. clearable: _ctx.clearable,
  15399. disabled: vue.unref(disabled),
  15400. name: _ctx.name,
  15401. "model-value": _ctx.modelValue,
  15402. onInput: handleInput,
  15403. onChange: handleChange,
  15404. onFocus: handleFocus,
  15405. onBlur: handleBlur,
  15406. onClear: handleClear,
  15407. onKeydown: [
  15408. _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"])),
  15409. _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"])),
  15410. vue.withKeys(handleKeyEnter, ["enter"]),
  15411. vue.withKeys(close, ["tab"]),
  15412. vue.withKeys(handleKeyEscape, ["esc"])
  15413. ],
  15414. onMousedown: handleMouseDown
  15415. }), vue.createSlots({ _: 2 }, [
  15416. _ctx.$slots.prepend ? {
  15417. name: "prepend",
  15418. fn: vue.withCtx(() => [
  15419. vue.renderSlot(_ctx.$slots, "prepend")
  15420. ])
  15421. } : void 0,
  15422. _ctx.$slots.append ? {
  15423. name: "append",
  15424. fn: vue.withCtx(() => [
  15425. vue.renderSlot(_ctx.$slots, "append")
  15426. ])
  15427. } : void 0,
  15428. _ctx.$slots.prefix ? {
  15429. name: "prefix",
  15430. fn: vue.withCtx(() => [
  15431. vue.renderSlot(_ctx.$slots, "prefix")
  15432. ])
  15433. } : void 0,
  15434. _ctx.$slots.suffix ? {
  15435. name: "suffix",
  15436. fn: vue.withCtx(() => [
  15437. vue.renderSlot(_ctx.$slots, "suffix")
  15438. ])
  15439. } : void 0
  15440. ]), 1040, ["clearable", "disabled", "name", "model-value", "onKeydown"])
  15441. ], 14, _hoisted_1$10)
  15442. ]),
  15443. _: 3
  15444. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  15445. };
  15446. }
  15447. });
  15448. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "autocomplete.vue"]]);
  15449. const ElAutocomplete = withInstall(Autocomplete);
  15450. const avatarProps = buildProps({
  15451. size: {
  15452. type: [Number, String],
  15453. values: componentSizes,
  15454. default: "",
  15455. validator: (val) => isNumber$1(val)
  15456. },
  15457. shape: {
  15458. type: String,
  15459. values: ["circle", "square"],
  15460. default: "circle"
  15461. },
  15462. icon: {
  15463. type: iconPropType
  15464. },
  15465. src: {
  15466. type: String,
  15467. default: ""
  15468. },
  15469. alt: String,
  15470. srcSet: String,
  15471. fit: {
  15472. type: definePropType(String),
  15473. default: "cover"
  15474. }
  15475. });
  15476. const avatarEmits = {
  15477. error: (evt) => evt instanceof Event
  15478. };
  15479. const _hoisted_1$$ = ["src", "alt", "srcset"];
  15480. const __default__$1n = vue.defineComponent({
  15481. name: "ElAvatar"
  15482. });
  15483. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  15484. ...__default__$1n,
  15485. props: avatarProps,
  15486. emits: avatarEmits,
  15487. setup(__props, { emit }) {
  15488. const props = __props;
  15489. const ns = useNamespace("avatar");
  15490. const hasLoadError = vue.ref(false);
  15491. const avatarClass = vue.computed(() => {
  15492. const { size, icon, shape } = props;
  15493. const classList = [ns.b()];
  15494. if (isString$1(size))
  15495. classList.push(ns.m(size));
  15496. if (icon)
  15497. classList.push(ns.m("icon"));
  15498. if (shape)
  15499. classList.push(ns.m(shape));
  15500. return classList;
  15501. });
  15502. const sizeStyle = vue.computed(() => {
  15503. const { size } = props;
  15504. return isNumber$1(size) ? ns.cssVarBlock({
  15505. size: addUnit(size) || ""
  15506. }) : void 0;
  15507. });
  15508. const fitStyle = vue.computed(() => ({
  15509. objectFit: props.fit
  15510. }));
  15511. vue.watch(() => props.src, () => hasLoadError.value = false);
  15512. function handleError(e) {
  15513. hasLoadError.value = true;
  15514. emit("error", e);
  15515. }
  15516. return (_ctx, _cache) => {
  15517. return vue.openBlock(), vue.createElementBlock("span", {
  15518. class: vue.normalizeClass(vue.unref(avatarClass)),
  15519. style: vue.normalizeStyle(vue.unref(sizeStyle))
  15520. }, [
  15521. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  15522. key: 0,
  15523. src: _ctx.src,
  15524. alt: _ctx.alt,
  15525. srcset: _ctx.srcSet,
  15526. style: vue.normalizeStyle(vue.unref(fitStyle)),
  15527. onError: handleError
  15528. }, null, 44, _hoisted_1$$)) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  15529. default: vue.withCtx(() => [
  15530. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  15531. ]),
  15532. _: 1
  15533. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  15534. ], 6);
  15535. };
  15536. }
  15537. });
  15538. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "avatar.vue"]]);
  15539. const ElAvatar = withInstall(Avatar);
  15540. const backtopProps = {
  15541. visibilityHeight: {
  15542. type: Number,
  15543. default: 200
  15544. },
  15545. target: {
  15546. type: String,
  15547. default: ""
  15548. },
  15549. right: {
  15550. type: Number,
  15551. default: 40
  15552. },
  15553. bottom: {
  15554. type: Number,
  15555. default: 40
  15556. }
  15557. };
  15558. const backtopEmits = {
  15559. click: (evt) => evt instanceof MouseEvent
  15560. };
  15561. const useBackTop = (props, emit, componentName) => {
  15562. const el = vue.shallowRef();
  15563. const container = vue.shallowRef();
  15564. const visible = vue.ref(false);
  15565. const handleScroll = () => {
  15566. if (el.value)
  15567. visible.value = el.value.scrollTop >= props.visibilityHeight;
  15568. };
  15569. const handleClick = (event) => {
  15570. var _a;
  15571. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  15572. emit("click", event);
  15573. };
  15574. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  15575. useEventListener(container, "scroll", handleScrollThrottled);
  15576. vue.onMounted(() => {
  15577. var _a;
  15578. container.value = document;
  15579. el.value = document.documentElement;
  15580. if (props.target) {
  15581. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  15582. if (!el.value) {
  15583. throwError(componentName, `target does not exist: ${props.target}`);
  15584. }
  15585. container.value = el.value;
  15586. }
  15587. });
  15588. return {
  15589. visible,
  15590. handleClick
  15591. };
  15592. };
  15593. const COMPONENT_NAME$h = "ElBacktop";
  15594. const __default__$1m = vue.defineComponent({
  15595. name: COMPONENT_NAME$h
  15596. });
  15597. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  15598. ...__default__$1m,
  15599. props: backtopProps,
  15600. emits: backtopEmits,
  15601. setup(__props, { emit }) {
  15602. const props = __props;
  15603. const ns = useNamespace("backtop");
  15604. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$h);
  15605. const backTopStyle = vue.computed(() => ({
  15606. right: `${props.right}px`,
  15607. bottom: `${props.bottom}px`
  15608. }));
  15609. return (_ctx, _cache) => {
  15610. return vue.openBlock(), vue.createBlock(vue.Transition, {
  15611. name: `${vue.unref(ns).namespace.value}-fade-in`
  15612. }, {
  15613. default: vue.withCtx(() => [
  15614. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  15615. key: 0,
  15616. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  15617. class: vue.normalizeClass(vue.unref(ns).b()),
  15618. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args), ["stop"]))
  15619. }, [
  15620. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  15621. vue.createVNode(vue.unref(ElIcon), {
  15622. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  15623. }, {
  15624. default: vue.withCtx(() => [
  15625. vue.createVNode(vue.unref(caret_top_default))
  15626. ]),
  15627. _: 1
  15628. }, 8, ["class"])
  15629. ])
  15630. ], 6)) : vue.createCommentVNode("v-if", true)
  15631. ]),
  15632. _: 3
  15633. }, 8, ["name"]);
  15634. };
  15635. }
  15636. });
  15637. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "backtop.vue"]]);
  15638. const ElBacktop = withInstall(Backtop);
  15639. const badgeProps = buildProps({
  15640. value: {
  15641. type: [String, Number],
  15642. default: ""
  15643. },
  15644. max: {
  15645. type: Number,
  15646. default: 99
  15647. },
  15648. isDot: Boolean,
  15649. hidden: Boolean,
  15650. type: {
  15651. type: String,
  15652. values: ["primary", "success", "warning", "info", "danger"],
  15653. default: "danger"
  15654. }
  15655. });
  15656. const _hoisted_1$_ = ["textContent"];
  15657. const __default__$1l = vue.defineComponent({
  15658. name: "ElBadge"
  15659. });
  15660. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  15661. ...__default__$1l,
  15662. props: badgeProps,
  15663. setup(__props, { expose }) {
  15664. const props = __props;
  15665. const ns = useNamespace("badge");
  15666. const content = vue.computed(() => {
  15667. if (props.isDot)
  15668. return "";
  15669. if (isNumber$1(props.value) && isNumber$1(props.max)) {
  15670. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  15671. }
  15672. return `${props.value}`;
  15673. });
  15674. expose({
  15675. content
  15676. });
  15677. return (_ctx, _cache) => {
  15678. return vue.openBlock(), vue.createElementBlock("div", {
  15679. class: vue.normalizeClass(vue.unref(ns).b())
  15680. }, [
  15681. vue.renderSlot(_ctx.$slots, "default"),
  15682. vue.createVNode(vue.Transition, {
  15683. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  15684. persisted: ""
  15685. }, {
  15686. default: vue.withCtx(() => [
  15687. vue.withDirectives(vue.createElementVNode("sup", {
  15688. class: vue.normalizeClass([
  15689. vue.unref(ns).e("content"),
  15690. vue.unref(ns).em("content", _ctx.type),
  15691. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  15692. vue.unref(ns).is("dot", _ctx.isDot)
  15693. ]),
  15694. textContent: vue.toDisplayString(vue.unref(content))
  15695. }, null, 10, _hoisted_1$_), [
  15696. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)]
  15697. ])
  15698. ]),
  15699. _: 1
  15700. }, 8, ["name"])
  15701. ], 2);
  15702. };
  15703. }
  15704. });
  15705. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "badge.vue"]]);
  15706. const ElBadge = withInstall(Badge);
  15707. const breadcrumbKey = Symbol("breadcrumbKey");
  15708. const breadcrumbProps = buildProps({
  15709. separator: {
  15710. type: String,
  15711. default: "/"
  15712. },
  15713. separatorIcon: {
  15714. type: iconPropType
  15715. }
  15716. });
  15717. const __default__$1k = vue.defineComponent({
  15718. name: "ElBreadcrumb"
  15719. });
  15720. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  15721. ...__default__$1k,
  15722. props: breadcrumbProps,
  15723. setup(__props) {
  15724. const props = __props;
  15725. const ns = useNamespace("breadcrumb");
  15726. const breadcrumb = vue.ref();
  15727. vue.provide(breadcrumbKey, props);
  15728. vue.onMounted(() => {
  15729. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  15730. if (items.length) {
  15731. items[items.length - 1].setAttribute("aria-current", "page");
  15732. }
  15733. });
  15734. return (_ctx, _cache) => {
  15735. return vue.openBlock(), vue.createElementBlock("div", {
  15736. ref_key: "breadcrumb",
  15737. ref: breadcrumb,
  15738. class: vue.normalizeClass(vue.unref(ns).b()),
  15739. "aria-label": "Breadcrumb",
  15740. role: "navigation"
  15741. }, [
  15742. vue.renderSlot(_ctx.$slots, "default")
  15743. ], 2);
  15744. };
  15745. }
  15746. });
  15747. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "breadcrumb.vue"]]);
  15748. const breadcrumbItemProps = buildProps({
  15749. to: {
  15750. type: definePropType([String, Object]),
  15751. default: ""
  15752. },
  15753. replace: {
  15754. type: Boolean,
  15755. default: false
  15756. }
  15757. });
  15758. const __default__$1j = vue.defineComponent({
  15759. name: "ElBreadcrumbItem"
  15760. });
  15761. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  15762. ...__default__$1j,
  15763. props: breadcrumbItemProps,
  15764. setup(__props) {
  15765. const props = __props;
  15766. const instance = vue.getCurrentInstance();
  15767. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  15768. const ns = useNamespace("breadcrumb");
  15769. const { separator, separatorIcon } = vue.toRefs(breadcrumbContext);
  15770. const router = instance.appContext.config.globalProperties.$router;
  15771. const link = vue.ref();
  15772. const onClick = () => {
  15773. if (!props.to || !router)
  15774. return;
  15775. props.replace ? router.replace(props.to) : router.push(props.to);
  15776. };
  15777. return (_ctx, _cache) => {
  15778. return vue.openBlock(), vue.createElementBlock("span", {
  15779. class: vue.normalizeClass(vue.unref(ns).e("item"))
  15780. }, [
  15781. vue.createElementVNode("span", {
  15782. ref_key: "link",
  15783. ref: link,
  15784. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  15785. role: "link",
  15786. onClick
  15787. }, [
  15788. vue.renderSlot(_ctx.$slots, "default")
  15789. ], 2),
  15790. vue.unref(separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  15791. key: 0,
  15792. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  15793. }, {
  15794. default: vue.withCtx(() => [
  15795. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(separatorIcon))))
  15796. ]),
  15797. _: 1
  15798. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  15799. key: 1,
  15800. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  15801. role: "presentation"
  15802. }, vue.toDisplayString(vue.unref(separator)), 3))
  15803. ], 2);
  15804. };
  15805. }
  15806. });
  15807. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "breadcrumb-item.vue"]]);
  15808. const ElBreadcrumb = withInstall(Breadcrumb, {
  15809. BreadcrumbItem
  15810. });
  15811. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  15812. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  15813. const useButton = (props, emit) => {
  15814. useDeprecated({
  15815. from: "type.text",
  15816. replacement: "link",
  15817. version: "3.0.0",
  15818. scope: "props",
  15819. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  15820. }, vue.computed(() => props.type === "text"));
  15821. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  15822. const globalConfig = useGlobalConfig("button");
  15823. const { form } = useFormItem();
  15824. const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  15825. const _disabled = useFormDisabled();
  15826. const _ref = vue.ref();
  15827. const slots = vue.useSlots();
  15828. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  15829. const autoInsertSpace = vue.computed(() => {
  15830. var _a, _b, _c;
  15831. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  15832. });
  15833. const shouldAddSpace = vue.computed(() => {
  15834. var _a;
  15835. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  15836. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  15837. const slot = defaultSlot[0];
  15838. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  15839. const text = slot.children;
  15840. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  15841. }
  15842. }
  15843. return false;
  15844. });
  15845. const handleClick = (evt) => {
  15846. if (props.nativeType === "reset") {
  15847. form == null ? void 0 : form.resetFields();
  15848. }
  15849. emit("click", evt);
  15850. };
  15851. return {
  15852. _disabled,
  15853. _size,
  15854. _type,
  15855. _ref,
  15856. shouldAddSpace,
  15857. handleClick
  15858. };
  15859. };
  15860. const buttonTypes = [
  15861. "default",
  15862. "primary",
  15863. "success",
  15864. "warning",
  15865. "info",
  15866. "danger",
  15867. "text",
  15868. ""
  15869. ];
  15870. const buttonNativeTypes = ["button", "submit", "reset"];
  15871. const buttonProps = buildProps({
  15872. size: useSizeProp,
  15873. disabled: Boolean,
  15874. type: {
  15875. type: String,
  15876. values: buttonTypes,
  15877. default: ""
  15878. },
  15879. icon: {
  15880. type: iconPropType
  15881. },
  15882. nativeType: {
  15883. type: String,
  15884. values: buttonNativeTypes,
  15885. default: "button"
  15886. },
  15887. loading: Boolean,
  15888. loadingIcon: {
  15889. type: iconPropType,
  15890. default: () => loading_default
  15891. },
  15892. plain: Boolean,
  15893. text: Boolean,
  15894. link: Boolean,
  15895. bg: Boolean,
  15896. autofocus: Boolean,
  15897. round: Boolean,
  15898. circle: Boolean,
  15899. color: String,
  15900. dark: Boolean,
  15901. autoInsertSpace: {
  15902. type: Boolean,
  15903. default: void 0
  15904. }
  15905. });
  15906. const buttonEmits = {
  15907. click: (evt) => evt instanceof MouseEvent
  15908. };
  15909. function bound01$1(n, max) {
  15910. if (isOnePointZero$1(n)) {
  15911. n = "100%";
  15912. }
  15913. var isPercent = isPercentage$1(n);
  15914. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  15915. if (isPercent) {
  15916. n = parseInt(String(n * max), 10) / 100;
  15917. }
  15918. if (Math.abs(n - max) < 1e-6) {
  15919. return 1;
  15920. }
  15921. if (max === 360) {
  15922. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  15923. } else {
  15924. n = n % max / parseFloat(String(max));
  15925. }
  15926. return n;
  15927. }
  15928. function clamp01(val) {
  15929. return Math.min(1, Math.max(0, val));
  15930. }
  15931. function isOnePointZero$1(n) {
  15932. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  15933. }
  15934. function isPercentage$1(n) {
  15935. return typeof n === "string" && n.indexOf("%") !== -1;
  15936. }
  15937. function boundAlpha(a) {
  15938. a = parseFloat(a);
  15939. if (isNaN(a) || a < 0 || a > 1) {
  15940. a = 1;
  15941. }
  15942. return a;
  15943. }
  15944. function convertToPercentage(n) {
  15945. if (n <= 1) {
  15946. return "".concat(Number(n) * 100, "%");
  15947. }
  15948. return n;
  15949. }
  15950. function pad2(c) {
  15951. return c.length === 1 ? "0" + c : String(c);
  15952. }
  15953. function rgbToRgb(r, g, b) {
  15954. return {
  15955. r: bound01$1(r, 255) * 255,
  15956. g: bound01$1(g, 255) * 255,
  15957. b: bound01$1(b, 255) * 255
  15958. };
  15959. }
  15960. function rgbToHsl(r, g, b) {
  15961. r = bound01$1(r, 255);
  15962. g = bound01$1(g, 255);
  15963. b = bound01$1(b, 255);
  15964. var max = Math.max(r, g, b);
  15965. var min = Math.min(r, g, b);
  15966. var h = 0;
  15967. var s = 0;
  15968. var l = (max + min) / 2;
  15969. if (max === min) {
  15970. s = 0;
  15971. h = 0;
  15972. } else {
  15973. var d = max - min;
  15974. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  15975. switch (max) {
  15976. case r:
  15977. h = (g - b) / d + (g < b ? 6 : 0);
  15978. break;
  15979. case g:
  15980. h = (b - r) / d + 2;
  15981. break;
  15982. case b:
  15983. h = (r - g) / d + 4;
  15984. break;
  15985. }
  15986. h /= 6;
  15987. }
  15988. return { h, s, l };
  15989. }
  15990. function hue2rgb(p, q, t) {
  15991. if (t < 0) {
  15992. t += 1;
  15993. }
  15994. if (t > 1) {
  15995. t -= 1;
  15996. }
  15997. if (t < 1 / 6) {
  15998. return p + (q - p) * (6 * t);
  15999. }
  16000. if (t < 1 / 2) {
  16001. return q;
  16002. }
  16003. if (t < 2 / 3) {
  16004. return p + (q - p) * (2 / 3 - t) * 6;
  16005. }
  16006. return p;
  16007. }
  16008. function hslToRgb(h, s, l) {
  16009. var r;
  16010. var g;
  16011. var b;
  16012. h = bound01$1(h, 360);
  16013. s = bound01$1(s, 100);
  16014. l = bound01$1(l, 100);
  16015. if (s === 0) {
  16016. g = l;
  16017. b = l;
  16018. r = l;
  16019. } else {
  16020. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  16021. var p = 2 * l - q;
  16022. r = hue2rgb(p, q, h + 1 / 3);
  16023. g = hue2rgb(p, q, h);
  16024. b = hue2rgb(p, q, h - 1 / 3);
  16025. }
  16026. return { r: r * 255, g: g * 255, b: b * 255 };
  16027. }
  16028. function rgbToHsv(r, g, b) {
  16029. r = bound01$1(r, 255);
  16030. g = bound01$1(g, 255);
  16031. b = bound01$1(b, 255);
  16032. var max = Math.max(r, g, b);
  16033. var min = Math.min(r, g, b);
  16034. var h = 0;
  16035. var v = max;
  16036. var d = max - min;
  16037. var s = max === 0 ? 0 : d / max;
  16038. if (max === min) {
  16039. h = 0;
  16040. } else {
  16041. switch (max) {
  16042. case r:
  16043. h = (g - b) / d + (g < b ? 6 : 0);
  16044. break;
  16045. case g:
  16046. h = (b - r) / d + 2;
  16047. break;
  16048. case b:
  16049. h = (r - g) / d + 4;
  16050. break;
  16051. }
  16052. h /= 6;
  16053. }
  16054. return { h, s, v };
  16055. }
  16056. function hsvToRgb(h, s, v) {
  16057. h = bound01$1(h, 360) * 6;
  16058. s = bound01$1(s, 100);
  16059. v = bound01$1(v, 100);
  16060. var i = Math.floor(h);
  16061. var f = h - i;
  16062. var p = v * (1 - s);
  16063. var q = v * (1 - f * s);
  16064. var t = v * (1 - (1 - f) * s);
  16065. var mod = i % 6;
  16066. var r = [v, q, p, p, t, v][mod];
  16067. var g = [t, v, v, q, p, p][mod];
  16068. var b = [p, p, t, v, v, q][mod];
  16069. return { r: r * 255, g: g * 255, b: b * 255 };
  16070. }
  16071. function rgbToHex(r, g, b, allow3Char) {
  16072. var hex = [
  16073. pad2(Math.round(r).toString(16)),
  16074. pad2(Math.round(g).toString(16)),
  16075. pad2(Math.round(b).toString(16))
  16076. ];
  16077. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  16078. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16079. }
  16080. return hex.join("");
  16081. }
  16082. function rgbaToHex(r, g, b, a, allow4Char) {
  16083. var hex = [
  16084. pad2(Math.round(r).toString(16)),
  16085. pad2(Math.round(g).toString(16)),
  16086. pad2(Math.round(b).toString(16)),
  16087. pad2(convertDecimalToHex(a))
  16088. ];
  16089. 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))) {
  16090. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16091. }
  16092. return hex.join("");
  16093. }
  16094. function convertDecimalToHex(d) {
  16095. return Math.round(parseFloat(d) * 255).toString(16);
  16096. }
  16097. function convertHexToDecimal(h) {
  16098. return parseIntFromHex(h) / 255;
  16099. }
  16100. function parseIntFromHex(val) {
  16101. return parseInt(val, 16);
  16102. }
  16103. function numberInputToObject(color) {
  16104. return {
  16105. r: color >> 16,
  16106. g: (color & 65280) >> 8,
  16107. b: color & 255
  16108. };
  16109. }
  16110. var names = {
  16111. aliceblue: "#f0f8ff",
  16112. antiquewhite: "#faebd7",
  16113. aqua: "#00ffff",
  16114. aquamarine: "#7fffd4",
  16115. azure: "#f0ffff",
  16116. beige: "#f5f5dc",
  16117. bisque: "#ffe4c4",
  16118. black: "#000000",
  16119. blanchedalmond: "#ffebcd",
  16120. blue: "#0000ff",
  16121. blueviolet: "#8a2be2",
  16122. brown: "#a52a2a",
  16123. burlywood: "#deb887",
  16124. cadetblue: "#5f9ea0",
  16125. chartreuse: "#7fff00",
  16126. chocolate: "#d2691e",
  16127. coral: "#ff7f50",
  16128. cornflowerblue: "#6495ed",
  16129. cornsilk: "#fff8dc",
  16130. crimson: "#dc143c",
  16131. cyan: "#00ffff",
  16132. darkblue: "#00008b",
  16133. darkcyan: "#008b8b",
  16134. darkgoldenrod: "#b8860b",
  16135. darkgray: "#a9a9a9",
  16136. darkgreen: "#006400",
  16137. darkgrey: "#a9a9a9",
  16138. darkkhaki: "#bdb76b",
  16139. darkmagenta: "#8b008b",
  16140. darkolivegreen: "#556b2f",
  16141. darkorange: "#ff8c00",
  16142. darkorchid: "#9932cc",
  16143. darkred: "#8b0000",
  16144. darksalmon: "#e9967a",
  16145. darkseagreen: "#8fbc8f",
  16146. darkslateblue: "#483d8b",
  16147. darkslategray: "#2f4f4f",
  16148. darkslategrey: "#2f4f4f",
  16149. darkturquoise: "#00ced1",
  16150. darkviolet: "#9400d3",
  16151. deeppink: "#ff1493",
  16152. deepskyblue: "#00bfff",
  16153. dimgray: "#696969",
  16154. dimgrey: "#696969",
  16155. dodgerblue: "#1e90ff",
  16156. firebrick: "#b22222",
  16157. floralwhite: "#fffaf0",
  16158. forestgreen: "#228b22",
  16159. fuchsia: "#ff00ff",
  16160. gainsboro: "#dcdcdc",
  16161. ghostwhite: "#f8f8ff",
  16162. goldenrod: "#daa520",
  16163. gold: "#ffd700",
  16164. gray: "#808080",
  16165. green: "#008000",
  16166. greenyellow: "#adff2f",
  16167. grey: "#808080",
  16168. honeydew: "#f0fff0",
  16169. hotpink: "#ff69b4",
  16170. indianred: "#cd5c5c",
  16171. indigo: "#4b0082",
  16172. ivory: "#fffff0",
  16173. khaki: "#f0e68c",
  16174. lavenderblush: "#fff0f5",
  16175. lavender: "#e6e6fa",
  16176. lawngreen: "#7cfc00",
  16177. lemonchiffon: "#fffacd",
  16178. lightblue: "#add8e6",
  16179. lightcoral: "#f08080",
  16180. lightcyan: "#e0ffff",
  16181. lightgoldenrodyellow: "#fafad2",
  16182. lightgray: "#d3d3d3",
  16183. lightgreen: "#90ee90",
  16184. lightgrey: "#d3d3d3",
  16185. lightpink: "#ffb6c1",
  16186. lightsalmon: "#ffa07a",
  16187. lightseagreen: "#20b2aa",
  16188. lightskyblue: "#87cefa",
  16189. lightslategray: "#778899",
  16190. lightslategrey: "#778899",
  16191. lightsteelblue: "#b0c4de",
  16192. lightyellow: "#ffffe0",
  16193. lime: "#00ff00",
  16194. limegreen: "#32cd32",
  16195. linen: "#faf0e6",
  16196. magenta: "#ff00ff",
  16197. maroon: "#800000",
  16198. mediumaquamarine: "#66cdaa",
  16199. mediumblue: "#0000cd",
  16200. mediumorchid: "#ba55d3",
  16201. mediumpurple: "#9370db",
  16202. mediumseagreen: "#3cb371",
  16203. mediumslateblue: "#7b68ee",
  16204. mediumspringgreen: "#00fa9a",
  16205. mediumturquoise: "#48d1cc",
  16206. mediumvioletred: "#c71585",
  16207. midnightblue: "#191970",
  16208. mintcream: "#f5fffa",
  16209. mistyrose: "#ffe4e1",
  16210. moccasin: "#ffe4b5",
  16211. navajowhite: "#ffdead",
  16212. navy: "#000080",
  16213. oldlace: "#fdf5e6",
  16214. olive: "#808000",
  16215. olivedrab: "#6b8e23",
  16216. orange: "#ffa500",
  16217. orangered: "#ff4500",
  16218. orchid: "#da70d6",
  16219. palegoldenrod: "#eee8aa",
  16220. palegreen: "#98fb98",
  16221. paleturquoise: "#afeeee",
  16222. palevioletred: "#db7093",
  16223. papayawhip: "#ffefd5",
  16224. peachpuff: "#ffdab9",
  16225. peru: "#cd853f",
  16226. pink: "#ffc0cb",
  16227. plum: "#dda0dd",
  16228. powderblue: "#b0e0e6",
  16229. purple: "#800080",
  16230. rebeccapurple: "#663399",
  16231. red: "#ff0000",
  16232. rosybrown: "#bc8f8f",
  16233. royalblue: "#4169e1",
  16234. saddlebrown: "#8b4513",
  16235. salmon: "#fa8072",
  16236. sandybrown: "#f4a460",
  16237. seagreen: "#2e8b57",
  16238. seashell: "#fff5ee",
  16239. sienna: "#a0522d",
  16240. silver: "#c0c0c0",
  16241. skyblue: "#87ceeb",
  16242. slateblue: "#6a5acd",
  16243. slategray: "#708090",
  16244. slategrey: "#708090",
  16245. snow: "#fffafa",
  16246. springgreen: "#00ff7f",
  16247. steelblue: "#4682b4",
  16248. tan: "#d2b48c",
  16249. teal: "#008080",
  16250. thistle: "#d8bfd8",
  16251. tomato: "#ff6347",
  16252. turquoise: "#40e0d0",
  16253. violet: "#ee82ee",
  16254. wheat: "#f5deb3",
  16255. white: "#ffffff",
  16256. whitesmoke: "#f5f5f5",
  16257. yellow: "#ffff00",
  16258. yellowgreen: "#9acd32"
  16259. };
  16260. function inputToRGB(color) {
  16261. var rgb = { r: 0, g: 0, b: 0 };
  16262. var a = 1;
  16263. var s = null;
  16264. var v = null;
  16265. var l = null;
  16266. var ok = false;
  16267. var format = false;
  16268. if (typeof color === "string") {
  16269. color = stringInputToObject(color);
  16270. }
  16271. if (typeof color === "object") {
  16272. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16273. rgb = rgbToRgb(color.r, color.g, color.b);
  16274. ok = true;
  16275. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16276. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16277. s = convertToPercentage(color.s);
  16278. v = convertToPercentage(color.v);
  16279. rgb = hsvToRgb(color.h, s, v);
  16280. ok = true;
  16281. format = "hsv";
  16282. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16283. s = convertToPercentage(color.s);
  16284. l = convertToPercentage(color.l);
  16285. rgb = hslToRgb(color.h, s, l);
  16286. ok = true;
  16287. format = "hsl";
  16288. }
  16289. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  16290. a = color.a;
  16291. }
  16292. }
  16293. a = boundAlpha(a);
  16294. return {
  16295. ok,
  16296. format: color.format || format,
  16297. r: Math.min(255, Math.max(rgb.r, 0)),
  16298. g: Math.min(255, Math.max(rgb.g, 0)),
  16299. b: Math.min(255, Math.max(rgb.b, 0)),
  16300. a
  16301. };
  16302. }
  16303. var CSS_INTEGER = "[-\\+]?\\d+%?";
  16304. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  16305. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  16306. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16307. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16308. var matchers = {
  16309. CSS_UNIT: new RegExp(CSS_UNIT),
  16310. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16311. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16312. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16313. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16314. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16315. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16316. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16317. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16318. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16319. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16320. };
  16321. function stringInputToObject(color) {
  16322. color = color.trim().toLowerCase();
  16323. if (color.length === 0) {
  16324. return false;
  16325. }
  16326. var named = false;
  16327. if (names[color]) {
  16328. color = names[color];
  16329. named = true;
  16330. } else if (color === "transparent") {
  16331. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  16332. }
  16333. var match = matchers.rgb.exec(color);
  16334. if (match) {
  16335. return { r: match[1], g: match[2], b: match[3] };
  16336. }
  16337. match = matchers.rgba.exec(color);
  16338. if (match) {
  16339. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  16340. }
  16341. match = matchers.hsl.exec(color);
  16342. if (match) {
  16343. return { h: match[1], s: match[2], l: match[3] };
  16344. }
  16345. match = matchers.hsla.exec(color);
  16346. if (match) {
  16347. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  16348. }
  16349. match = matchers.hsv.exec(color);
  16350. if (match) {
  16351. return { h: match[1], s: match[2], v: match[3] };
  16352. }
  16353. match = matchers.hsva.exec(color);
  16354. if (match) {
  16355. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  16356. }
  16357. match = matchers.hex8.exec(color);
  16358. if (match) {
  16359. return {
  16360. r: parseIntFromHex(match[1]),
  16361. g: parseIntFromHex(match[2]),
  16362. b: parseIntFromHex(match[3]),
  16363. a: convertHexToDecimal(match[4]),
  16364. format: named ? "name" : "hex8"
  16365. };
  16366. }
  16367. match = matchers.hex6.exec(color);
  16368. if (match) {
  16369. return {
  16370. r: parseIntFromHex(match[1]),
  16371. g: parseIntFromHex(match[2]),
  16372. b: parseIntFromHex(match[3]),
  16373. format: named ? "name" : "hex"
  16374. };
  16375. }
  16376. match = matchers.hex4.exec(color);
  16377. if (match) {
  16378. return {
  16379. r: parseIntFromHex(match[1] + match[1]),
  16380. g: parseIntFromHex(match[2] + match[2]),
  16381. b: parseIntFromHex(match[3] + match[3]),
  16382. a: convertHexToDecimal(match[4] + match[4]),
  16383. format: named ? "name" : "hex8"
  16384. };
  16385. }
  16386. match = matchers.hex3.exec(color);
  16387. if (match) {
  16388. return {
  16389. r: parseIntFromHex(match[1] + match[1]),
  16390. g: parseIntFromHex(match[2] + match[2]),
  16391. b: parseIntFromHex(match[3] + match[3]),
  16392. format: named ? "name" : "hex"
  16393. };
  16394. }
  16395. return false;
  16396. }
  16397. function isValidCSSUnit(color) {
  16398. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  16399. }
  16400. var TinyColor = function() {
  16401. function TinyColor2(color, opts) {
  16402. if (color === void 0) {
  16403. color = "";
  16404. }
  16405. if (opts === void 0) {
  16406. opts = {};
  16407. }
  16408. var _a;
  16409. if (color instanceof TinyColor2) {
  16410. return color;
  16411. }
  16412. if (typeof color === "number") {
  16413. color = numberInputToObject(color);
  16414. }
  16415. this.originalInput = color;
  16416. var rgb = inputToRGB(color);
  16417. this.originalInput = color;
  16418. this.r = rgb.r;
  16419. this.g = rgb.g;
  16420. this.b = rgb.b;
  16421. this.a = rgb.a;
  16422. this.roundA = Math.round(100 * this.a) / 100;
  16423. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  16424. this.gradientType = opts.gradientType;
  16425. if (this.r < 1) {
  16426. this.r = Math.round(this.r);
  16427. }
  16428. if (this.g < 1) {
  16429. this.g = Math.round(this.g);
  16430. }
  16431. if (this.b < 1) {
  16432. this.b = Math.round(this.b);
  16433. }
  16434. this.isValid = rgb.ok;
  16435. }
  16436. TinyColor2.prototype.isDark = function() {
  16437. return this.getBrightness() < 128;
  16438. };
  16439. TinyColor2.prototype.isLight = function() {
  16440. return !this.isDark();
  16441. };
  16442. TinyColor2.prototype.getBrightness = function() {
  16443. var rgb = this.toRgb();
  16444. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16445. };
  16446. TinyColor2.prototype.getLuminance = function() {
  16447. var rgb = this.toRgb();
  16448. var R;
  16449. var G;
  16450. var B;
  16451. var RsRGB = rgb.r / 255;
  16452. var GsRGB = rgb.g / 255;
  16453. var BsRGB = rgb.b / 255;
  16454. if (RsRGB <= 0.03928) {
  16455. R = RsRGB / 12.92;
  16456. } else {
  16457. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  16458. }
  16459. if (GsRGB <= 0.03928) {
  16460. G = GsRGB / 12.92;
  16461. } else {
  16462. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  16463. }
  16464. if (BsRGB <= 0.03928) {
  16465. B = BsRGB / 12.92;
  16466. } else {
  16467. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  16468. }
  16469. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  16470. };
  16471. TinyColor2.prototype.getAlpha = function() {
  16472. return this.a;
  16473. };
  16474. TinyColor2.prototype.setAlpha = function(alpha) {
  16475. this.a = boundAlpha(alpha);
  16476. this.roundA = Math.round(100 * this.a) / 100;
  16477. return this;
  16478. };
  16479. TinyColor2.prototype.toHsv = function() {
  16480. var hsv = rgbToHsv(this.r, this.g, this.b);
  16481. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  16482. };
  16483. TinyColor2.prototype.toHsvString = function() {
  16484. var hsv = rgbToHsv(this.r, this.g, this.b);
  16485. var h = Math.round(hsv.h * 360);
  16486. var s = Math.round(hsv.s * 100);
  16487. var v = Math.round(hsv.v * 100);
  16488. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  16489. };
  16490. TinyColor2.prototype.toHsl = function() {
  16491. var hsl = rgbToHsl(this.r, this.g, this.b);
  16492. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  16493. };
  16494. TinyColor2.prototype.toHslString = function() {
  16495. var hsl = rgbToHsl(this.r, this.g, this.b);
  16496. var h = Math.round(hsl.h * 360);
  16497. var s = Math.round(hsl.s * 100);
  16498. var l = Math.round(hsl.l * 100);
  16499. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  16500. };
  16501. TinyColor2.prototype.toHex = function(allow3Char) {
  16502. if (allow3Char === void 0) {
  16503. allow3Char = false;
  16504. }
  16505. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16506. };
  16507. TinyColor2.prototype.toHexString = function(allow3Char) {
  16508. if (allow3Char === void 0) {
  16509. allow3Char = false;
  16510. }
  16511. return "#" + this.toHex(allow3Char);
  16512. };
  16513. TinyColor2.prototype.toHex8 = function(allow4Char) {
  16514. if (allow4Char === void 0) {
  16515. allow4Char = false;
  16516. }
  16517. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16518. };
  16519. TinyColor2.prototype.toHex8String = function(allow4Char) {
  16520. if (allow4Char === void 0) {
  16521. allow4Char = false;
  16522. }
  16523. return "#" + this.toHex8(allow4Char);
  16524. };
  16525. TinyColor2.prototype.toRgb = function() {
  16526. return {
  16527. r: Math.round(this.r),
  16528. g: Math.round(this.g),
  16529. b: Math.round(this.b),
  16530. a: this.a
  16531. };
  16532. };
  16533. TinyColor2.prototype.toRgbString = function() {
  16534. var r = Math.round(this.r);
  16535. var g = Math.round(this.g);
  16536. var b = Math.round(this.b);
  16537. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  16538. };
  16539. TinyColor2.prototype.toPercentageRgb = function() {
  16540. var fmt = function(x) {
  16541. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  16542. };
  16543. return {
  16544. r: fmt(this.r),
  16545. g: fmt(this.g),
  16546. b: fmt(this.b),
  16547. a: this.a
  16548. };
  16549. };
  16550. TinyColor2.prototype.toPercentageRgbString = function() {
  16551. var rnd = function(x) {
  16552. return Math.round(bound01$1(x, 255) * 100);
  16553. };
  16554. 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, ")");
  16555. };
  16556. TinyColor2.prototype.toName = function() {
  16557. if (this.a === 0) {
  16558. return "transparent";
  16559. }
  16560. if (this.a < 1) {
  16561. return false;
  16562. }
  16563. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  16564. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  16565. var _b = _a[_i], key = _b[0], value = _b[1];
  16566. if (hex === value) {
  16567. return key;
  16568. }
  16569. }
  16570. return false;
  16571. };
  16572. TinyColor2.prototype.toString = function(format) {
  16573. var formatSet = Boolean(format);
  16574. format = format !== null && format !== void 0 ? format : this.format;
  16575. var formattedString = false;
  16576. var hasAlpha = this.a < 1 && this.a >= 0;
  16577. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  16578. if (needsAlphaFormat) {
  16579. if (format === "name" && this.a === 0) {
  16580. return this.toName();
  16581. }
  16582. return this.toRgbString();
  16583. }
  16584. if (format === "rgb") {
  16585. formattedString = this.toRgbString();
  16586. }
  16587. if (format === "prgb") {
  16588. formattedString = this.toPercentageRgbString();
  16589. }
  16590. if (format === "hex" || format === "hex6") {
  16591. formattedString = this.toHexString();
  16592. }
  16593. if (format === "hex3") {
  16594. formattedString = this.toHexString(true);
  16595. }
  16596. if (format === "hex4") {
  16597. formattedString = this.toHex8String(true);
  16598. }
  16599. if (format === "hex8") {
  16600. formattedString = this.toHex8String();
  16601. }
  16602. if (format === "name") {
  16603. formattedString = this.toName();
  16604. }
  16605. if (format === "hsl") {
  16606. formattedString = this.toHslString();
  16607. }
  16608. if (format === "hsv") {
  16609. formattedString = this.toHsvString();
  16610. }
  16611. return formattedString || this.toHexString();
  16612. };
  16613. TinyColor2.prototype.toNumber = function() {
  16614. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  16615. };
  16616. TinyColor2.prototype.clone = function() {
  16617. return new TinyColor2(this.toString());
  16618. };
  16619. TinyColor2.prototype.lighten = function(amount) {
  16620. if (amount === void 0) {
  16621. amount = 10;
  16622. }
  16623. var hsl = this.toHsl();
  16624. hsl.l += amount / 100;
  16625. hsl.l = clamp01(hsl.l);
  16626. return new TinyColor2(hsl);
  16627. };
  16628. TinyColor2.prototype.brighten = function(amount) {
  16629. if (amount === void 0) {
  16630. amount = 10;
  16631. }
  16632. var rgb = this.toRgb();
  16633. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  16634. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  16635. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  16636. return new TinyColor2(rgb);
  16637. };
  16638. TinyColor2.prototype.darken = function(amount) {
  16639. if (amount === void 0) {
  16640. amount = 10;
  16641. }
  16642. var hsl = this.toHsl();
  16643. hsl.l -= amount / 100;
  16644. hsl.l = clamp01(hsl.l);
  16645. return new TinyColor2(hsl);
  16646. };
  16647. TinyColor2.prototype.tint = function(amount) {
  16648. if (amount === void 0) {
  16649. amount = 10;
  16650. }
  16651. return this.mix("white", amount);
  16652. };
  16653. TinyColor2.prototype.shade = function(amount) {
  16654. if (amount === void 0) {
  16655. amount = 10;
  16656. }
  16657. return this.mix("black", amount);
  16658. };
  16659. TinyColor2.prototype.desaturate = function(amount) {
  16660. if (amount === void 0) {
  16661. amount = 10;
  16662. }
  16663. var hsl = this.toHsl();
  16664. hsl.s -= amount / 100;
  16665. hsl.s = clamp01(hsl.s);
  16666. return new TinyColor2(hsl);
  16667. };
  16668. TinyColor2.prototype.saturate = function(amount) {
  16669. if (amount === void 0) {
  16670. amount = 10;
  16671. }
  16672. var hsl = this.toHsl();
  16673. hsl.s += amount / 100;
  16674. hsl.s = clamp01(hsl.s);
  16675. return new TinyColor2(hsl);
  16676. };
  16677. TinyColor2.prototype.greyscale = function() {
  16678. return this.desaturate(100);
  16679. };
  16680. TinyColor2.prototype.spin = function(amount) {
  16681. var hsl = this.toHsl();
  16682. var hue = (hsl.h + amount) % 360;
  16683. hsl.h = hue < 0 ? 360 + hue : hue;
  16684. return new TinyColor2(hsl);
  16685. };
  16686. TinyColor2.prototype.mix = function(color, amount) {
  16687. if (amount === void 0) {
  16688. amount = 50;
  16689. }
  16690. var rgb1 = this.toRgb();
  16691. var rgb2 = new TinyColor2(color).toRgb();
  16692. var p = amount / 100;
  16693. var rgba = {
  16694. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  16695. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  16696. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  16697. a: (rgb2.a - rgb1.a) * p + rgb1.a
  16698. };
  16699. return new TinyColor2(rgba);
  16700. };
  16701. TinyColor2.prototype.analogous = function(results, slices) {
  16702. if (results === void 0) {
  16703. results = 6;
  16704. }
  16705. if (slices === void 0) {
  16706. slices = 30;
  16707. }
  16708. var hsl = this.toHsl();
  16709. var part = 360 / slices;
  16710. var ret = [this];
  16711. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  16712. hsl.h = (hsl.h + part) % 360;
  16713. ret.push(new TinyColor2(hsl));
  16714. }
  16715. return ret;
  16716. };
  16717. TinyColor2.prototype.complement = function() {
  16718. var hsl = this.toHsl();
  16719. hsl.h = (hsl.h + 180) % 360;
  16720. return new TinyColor2(hsl);
  16721. };
  16722. TinyColor2.prototype.monochromatic = function(results) {
  16723. if (results === void 0) {
  16724. results = 6;
  16725. }
  16726. var hsv = this.toHsv();
  16727. var h = hsv.h;
  16728. var s = hsv.s;
  16729. var v = hsv.v;
  16730. var res = [];
  16731. var modification = 1 / results;
  16732. while (results--) {
  16733. res.push(new TinyColor2({ h, s, v }));
  16734. v = (v + modification) % 1;
  16735. }
  16736. return res;
  16737. };
  16738. TinyColor2.prototype.splitcomplement = function() {
  16739. var hsl = this.toHsl();
  16740. var h = hsl.h;
  16741. return [
  16742. this,
  16743. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  16744. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  16745. ];
  16746. };
  16747. TinyColor2.prototype.onBackground = function(background) {
  16748. var fg = this.toRgb();
  16749. var bg = new TinyColor2(background).toRgb();
  16750. return new TinyColor2({
  16751. r: bg.r + (fg.r - bg.r) * fg.a,
  16752. g: bg.g + (fg.g - bg.g) * fg.a,
  16753. b: bg.b + (fg.b - bg.b) * fg.a
  16754. });
  16755. };
  16756. TinyColor2.prototype.triad = function() {
  16757. return this.polyad(3);
  16758. };
  16759. TinyColor2.prototype.tetrad = function() {
  16760. return this.polyad(4);
  16761. };
  16762. TinyColor2.prototype.polyad = function(n) {
  16763. var hsl = this.toHsl();
  16764. var h = hsl.h;
  16765. var result = [this];
  16766. var increment = 360 / n;
  16767. for (var i = 1; i < n; i++) {
  16768. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  16769. }
  16770. return result;
  16771. };
  16772. TinyColor2.prototype.equals = function(color) {
  16773. return this.toRgbString() === new TinyColor2(color).toRgbString();
  16774. };
  16775. return TinyColor2;
  16776. }();
  16777. function darken(color, amount = 20) {
  16778. return color.mix("#141414", amount).toString();
  16779. }
  16780. function useButtonCustomStyle(props) {
  16781. const _disabled = useFormDisabled();
  16782. const ns = useNamespace("button");
  16783. return vue.computed(() => {
  16784. let styles = {};
  16785. const buttonColor = props.color;
  16786. if (buttonColor) {
  16787. const color = new TinyColor(buttonColor);
  16788. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  16789. if (props.plain) {
  16790. styles = ns.cssVarBlock({
  16791. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  16792. "text-color": buttonColor,
  16793. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  16794. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  16795. "hover-bg-color": buttonColor,
  16796. "hover-border-color": buttonColor,
  16797. "active-bg-color": activeBgColor,
  16798. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  16799. "active-border-color": activeBgColor
  16800. });
  16801. if (_disabled.value) {
  16802. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  16803. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  16804. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  16805. }
  16806. } else {
  16807. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  16808. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  16809. styles = ns.cssVarBlock({
  16810. "bg-color": buttonColor,
  16811. "text-color": textColor,
  16812. "border-color": buttonColor,
  16813. "hover-bg-color": hoverBgColor,
  16814. "hover-text-color": textColor,
  16815. "hover-border-color": hoverBgColor,
  16816. "active-bg-color": activeBgColor,
  16817. "active-border-color": activeBgColor
  16818. });
  16819. if (_disabled.value) {
  16820. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  16821. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  16822. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  16823. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  16824. }
  16825. }
  16826. }
  16827. return styles;
  16828. });
  16829. }
  16830. const _hoisted_1$Z = ["aria-disabled", "disabled", "autofocus", "type"];
  16831. const __default__$1i = vue.defineComponent({
  16832. name: "ElButton"
  16833. });
  16834. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  16835. ...__default__$1i,
  16836. props: buttonProps,
  16837. emits: buttonEmits,
  16838. setup(__props, { expose, emit }) {
  16839. const props = __props;
  16840. const buttonStyle = useButtonCustomStyle(props);
  16841. const ns = useNamespace("button");
  16842. const { _ref, _size, _type, _disabled, shouldAddSpace, handleClick } = useButton(props, emit);
  16843. expose({
  16844. ref: _ref,
  16845. size: _size,
  16846. type: _type,
  16847. disabled: _disabled,
  16848. shouldAddSpace
  16849. });
  16850. return (_ctx, _cache) => {
  16851. return vue.openBlock(), vue.createElementBlock("button", {
  16852. ref_key: "_ref",
  16853. ref: _ref,
  16854. class: vue.normalizeClass([
  16855. vue.unref(ns).b(),
  16856. vue.unref(ns).m(vue.unref(_type)),
  16857. vue.unref(ns).m(vue.unref(_size)),
  16858. vue.unref(ns).is("disabled", vue.unref(_disabled)),
  16859. vue.unref(ns).is("loading", _ctx.loading),
  16860. vue.unref(ns).is("plain", _ctx.plain),
  16861. vue.unref(ns).is("round", _ctx.round),
  16862. vue.unref(ns).is("circle", _ctx.circle),
  16863. vue.unref(ns).is("text", _ctx.text),
  16864. vue.unref(ns).is("link", _ctx.link),
  16865. vue.unref(ns).is("has-bg", _ctx.bg)
  16866. ]),
  16867. "aria-disabled": vue.unref(_disabled) || _ctx.loading,
  16868. disabled: vue.unref(_disabled) || _ctx.loading,
  16869. autofocus: _ctx.autofocus,
  16870. type: _ctx.nativeType,
  16871. style: vue.normalizeStyle(vue.unref(buttonStyle)),
  16872. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args))
  16873. }, [
  16874. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  16875. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16876. key: 1,
  16877. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  16878. }, {
  16879. default: vue.withCtx(() => [
  16880. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  16881. ]),
  16882. _: 1
  16883. }, 8, ["class"]))
  16884. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  16885. default: vue.withCtx(() => [
  16886. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  16887. ]),
  16888. _: 3
  16889. })) : vue.createCommentVNode("v-if", true),
  16890. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  16891. key: 2,
  16892. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  16893. }, [
  16894. vue.renderSlot(_ctx.$slots, "default")
  16895. ], 2)) : vue.createCommentVNode("v-if", true)
  16896. ], 14, _hoisted_1$Z);
  16897. };
  16898. }
  16899. });
  16900. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "button.vue"]]);
  16901. const buttonGroupProps = {
  16902. size: buttonProps.size,
  16903. type: buttonProps.type
  16904. };
  16905. const __default__$1h = vue.defineComponent({
  16906. name: "ElButtonGroup"
  16907. });
  16908. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  16909. ...__default__$1h,
  16910. props: buttonGroupProps,
  16911. setup(__props) {
  16912. const props = __props;
  16913. vue.provide(buttonGroupContextKey, vue.reactive({
  16914. size: vue.toRef(props, "size"),
  16915. type: vue.toRef(props, "type")
  16916. }));
  16917. const ns = useNamespace("button");
  16918. return (_ctx, _cache) => {
  16919. return vue.openBlock(), vue.createElementBlock("div", {
  16920. class: vue.normalizeClass(`${vue.unref(ns).b("group")}`)
  16921. }, [
  16922. vue.renderSlot(_ctx.$slots, "default")
  16923. ], 2);
  16924. };
  16925. }
  16926. });
  16927. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "button-group.vue"]]);
  16928. const ElButton = withInstall(Button, {
  16929. ButtonGroup
  16930. });
  16931. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  16932. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  16933. var dayjs_min = {exports: {}};
  16934. (function(module, exports) {
  16935. !function(t, e) {
  16936. module.exports = e() ;
  16937. }(commonjsGlobal, function() {
  16938. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_") }, m = function(t2, e2, n2) {
  16939. var r2 = String(t2);
  16940. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  16941. }, g = { s: m, z: function(t2) {
  16942. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  16943. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  16944. }, m: function t2(e2, n2) {
  16945. if (e2.date() < n2.date())
  16946. return -t2(n2, e2);
  16947. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
  16948. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  16949. }, a: function(t2) {
  16950. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  16951. }, p: function(t2) {
  16952. return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  16953. }, u: function(t2) {
  16954. return t2 === void 0;
  16955. } }, v = "en", D = {};
  16956. D[v] = M;
  16957. var p = function(t2) {
  16958. return t2 instanceof _;
  16959. }, S = function t2(e2, n2, r2) {
  16960. var i2;
  16961. if (!e2)
  16962. return v;
  16963. if (typeof e2 == "string") {
  16964. var s2 = e2.toLowerCase();
  16965. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  16966. var u2 = e2.split("-");
  16967. if (!i2 && u2.length > 1)
  16968. return t2(u2[0]);
  16969. } else {
  16970. var a2 = e2.name;
  16971. D[a2] = e2, i2 = a2;
  16972. }
  16973. return !r2 && i2 && (v = i2), i2 || !r2 && v;
  16974. }, w = function(t2, e2) {
  16975. if (p(t2))
  16976. return t2.clone();
  16977. var n2 = typeof e2 == "object" ? e2 : {};
  16978. return n2.date = t2, n2.args = arguments, new _(n2);
  16979. }, O = g;
  16980. O.l = S, O.i = p, O.w = function(t2, e2) {
  16981. return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  16982. };
  16983. var _ = function() {
  16984. function M2(t2) {
  16985. this.$L = S(t2.locale, null, true), this.parse(t2);
  16986. }
  16987. var m2 = M2.prototype;
  16988. return m2.parse = function(t2) {
  16989. this.$d = function(t3) {
  16990. var e2 = t3.date, n2 = t3.utc;
  16991. if (e2 === null)
  16992. return new Date(NaN);
  16993. if (O.u(e2))
  16994. return new Date();
  16995. if (e2 instanceof Date)
  16996. return new Date(e2);
  16997. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  16998. var r2 = e2.match(l);
  16999. if (r2) {
  17000. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  17001. 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);
  17002. }
  17003. }
  17004. return new Date(e2);
  17005. }(t2), this.$x = t2.x || {}, this.init();
  17006. }, m2.init = function() {
  17007. var t2 = this.$d;
  17008. 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();
  17009. }, m2.$utils = function() {
  17010. return O;
  17011. }, m2.isValid = function() {
  17012. return !(this.$d.toString() === $);
  17013. }, m2.isSame = function(t2, e2) {
  17014. var n2 = w(t2);
  17015. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  17016. }, m2.isAfter = function(t2, e2) {
  17017. return w(t2) < this.startOf(e2);
  17018. }, m2.isBefore = function(t2, e2) {
  17019. return this.endOf(e2) < w(t2);
  17020. }, m2.$g = function(t2, e2, n2) {
  17021. return O.u(t2) ? this[e2] : this.set(n2, t2);
  17022. }, m2.unix = function() {
  17023. return Math.floor(this.valueOf() / 1e3);
  17024. }, m2.valueOf = function() {
  17025. return this.$d.getTime();
  17026. }, m2.startOf = function(t2, e2) {
  17027. var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
  17028. var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  17029. return r2 ? i2 : i2.endOf(a);
  17030. }, l2 = function(t3, e3) {
  17031. return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  17032. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  17033. switch (h2) {
  17034. case c:
  17035. return r2 ? $2(1, 0) : $2(31, 11);
  17036. case f:
  17037. return r2 ? $2(1, M3) : $2(0, M3 + 1);
  17038. case o:
  17039. var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2;
  17040. return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  17041. case a:
  17042. case d:
  17043. return l2(g2 + "Hours", 0);
  17044. case u:
  17045. return l2(g2 + "Minutes", 1);
  17046. case s:
  17047. return l2(g2 + "Seconds", 2);
  17048. case i:
  17049. return l2(g2 + "Milliseconds", 3);
  17050. default:
  17051. return this.clone();
  17052. }
  17053. }, m2.endOf = function(t2) {
  17054. return this.startOf(t2, false);
  17055. }, m2.$set = function(t2, e2) {
  17056. var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
  17057. if (o2 === f || o2 === c) {
  17058. var y2 = this.clone().set(d, 1);
  17059. y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  17060. } else
  17061. $2 && this.$d[$2](l2);
  17062. return this.init(), this;
  17063. }, m2.set = function(t2, e2) {
  17064. return this.clone().$set(t2, e2);
  17065. }, m2.get = function(t2) {
  17066. return this[O.p(t2)]();
  17067. }, m2.add = function(r2, h2) {
  17068. var d2, $2 = this;
  17069. r2 = Number(r2);
  17070. var l2 = O.p(h2), y2 = function(t2) {
  17071. var e2 = w($2);
  17072. return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  17073. };
  17074. if (l2 === f)
  17075. return this.set(f, this.$M + r2);
  17076. if (l2 === c)
  17077. return this.set(c, this.$y + r2);
  17078. if (l2 === a)
  17079. return y2(1);
  17080. if (l2 === o)
  17081. return y2(7);
  17082. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
  17083. return O.w(m3, this);
  17084. }, m2.subtract = function(t2, e2) {
  17085. return this.add(-1 * t2, e2);
  17086. }, m2.format = function(t2) {
  17087. var e2 = this, n2 = this.$locale();
  17088. if (!this.isValid())
  17089. return n2.invalidDate || $;
  17090. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
  17091. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  17092. }, c2 = function(t3) {
  17093. return O.s(s2 % 12 || 12, t3, "0");
  17094. }, d2 = n2.meridiem || function(t3, e3, n3) {
  17095. var r3 = t3 < 12 ? "AM" : "PM";
  17096. return n3 ? r3.toLowerCase() : r3;
  17097. }, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
  17098. return r2.replace(y, function(t3, e3) {
  17099. return e3 || l2[t3] || i2.replace(":", "");
  17100. });
  17101. }, m2.utcOffset = function() {
  17102. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17103. }, m2.diff = function(r2, d2, $2) {
  17104. var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3);
  17105. return v2 = (l2 = {}, l2[c] = v2 / 12, l2[f] = v2, l2[h] = v2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? v2 : O.a(v2);
  17106. }, m2.daysInMonth = function() {
  17107. return this.endOf(f).$D;
  17108. }, m2.$locale = function() {
  17109. return D[this.$L];
  17110. }, m2.locale = function(t2, e2) {
  17111. if (!t2)
  17112. return this.$L;
  17113. var n2 = this.clone(), r2 = S(t2, e2, true);
  17114. return r2 && (n2.$L = r2), n2;
  17115. }, m2.clone = function() {
  17116. return O.w(this.$d, this);
  17117. }, m2.toDate = function() {
  17118. return new Date(this.valueOf());
  17119. }, m2.toJSON = function() {
  17120. return this.isValid() ? this.toISOString() : null;
  17121. }, m2.toISOString = function() {
  17122. return this.$d.toISOString();
  17123. }, m2.toString = function() {
  17124. return this.$d.toUTCString();
  17125. }, M2;
  17126. }(), T = _.prototype;
  17127. return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
  17128. T[t2[1]] = function(e2) {
  17129. return this.$g(e2, t2[0], t2[1]);
  17130. };
  17131. }), w.extend = function(t2, e2) {
  17132. return t2.$i || (t2(e2, _, w), t2.$i = true), w;
  17133. }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
  17134. return w(1e3 * t2);
  17135. }, w.en = D[v], w.Ls = D, w.p = {}, w;
  17136. });
  17137. })(dayjs_min);
  17138. var dayjs = dayjs_min.exports;
  17139. var customParseFormat$1 = {exports: {}};
  17140. (function(module, exports) {
  17141. !function(e, t) {
  17142. module.exports = t() ;
  17143. }(commonjsGlobal, function() {
  17144. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e2) {
  17145. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  17146. };
  17147. var a = function(e2) {
  17148. return function(t2) {
  17149. this[e2] = +t2;
  17150. };
  17151. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  17152. (this.zone || (this.zone = {})).offset = function(e3) {
  17153. if (!e3)
  17154. return 0;
  17155. if (e3 === "Z")
  17156. return 0;
  17157. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  17158. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  17159. }(e2);
  17160. }], h = function(e2) {
  17161. var t2 = o[e2];
  17162. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  17163. }, u = function(e2, t2) {
  17164. var n2, r2 = o.meridiem;
  17165. if (r2) {
  17166. for (var i2 = 1; i2 <= 24; i2 += 1)
  17167. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  17168. n2 = i2 > 12;
  17169. break;
  17170. }
  17171. } else
  17172. n2 = e2 === (t2 ? "pm" : "PM");
  17173. return n2;
  17174. }, d = { A: [i, function(e2) {
  17175. this.afternoon = u(e2, false);
  17176. }], a: [i, function(e2) {
  17177. this.afternoon = u(e2, true);
  17178. }], S: [/\d/, function(e2) {
  17179. this.milliseconds = 100 * +e2;
  17180. }], SS: [n, function(e2) {
  17181. this.milliseconds = 10 * +e2;
  17182. }], SSS: [/\d{3}/, function(e2) {
  17183. this.milliseconds = +e2;
  17184. }], s: [r, a("seconds")], ss: [r, a("seconds")], m: [r, a("minutes")], mm: [r, a("minutes")], H: [r, a("hours")], h: [r, a("hours")], HH: [r, a("hours")], hh: [r, a("hours")], D: [r, a("day")], DD: [n, a("day")], Do: [i, function(e2) {
  17185. var t2 = o.ordinal, n2 = e2.match(/\d+/);
  17186. if (this.day = n2[0], t2)
  17187. for (var r2 = 1; r2 <= 31; r2 += 1)
  17188. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  17189. }], M: [r, a("month")], MM: [n, a("month")], MMM: [i, function(e2) {
  17190. var t2 = h("months"), n2 = (h("monthsShort") || t2.map(function(e3) {
  17191. return e3.slice(0, 3);
  17192. })).indexOf(e2) + 1;
  17193. if (n2 < 1)
  17194. throw new Error();
  17195. this.month = n2 % 12 || n2;
  17196. }], MMMM: [i, function(e2) {
  17197. var t2 = h("months").indexOf(e2) + 1;
  17198. if (t2 < 1)
  17199. throw new Error();
  17200. this.month = t2 % 12 || t2;
  17201. }], Y: [/[+-]?\d+/, a("year")], YY: [n, function(e2) {
  17202. this.year = s(e2);
  17203. }], YYYY: [/\d{4}/, a("year")], Z: f, ZZ: f };
  17204. function c(n2) {
  17205. var r2, i2;
  17206. r2 = n2, i2 = o && o.formats;
  17207. for (var s2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  17208. var o2 = r3 && r3.toUpperCase();
  17209. return n3 || i2[r3] || e[r3] || i2[o2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  17210. return t3 || n4.slice(1);
  17211. });
  17212. })).match(t), a2 = s2.length, f2 = 0; f2 < a2; f2 += 1) {
  17213. var h2 = s2[f2], u2 = d[h2], c2 = u2 && u2[0], l = u2 && u2[1];
  17214. s2[f2] = l ? { regex: c2, parser: l } : h2.replace(/^\[|\]$/g, "");
  17215. }
  17216. return function(e2) {
  17217. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  17218. var i3 = s2[n3];
  17219. if (typeof i3 == "string")
  17220. r3 += i3.length;
  17221. else {
  17222. var o2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = o2.exec(h3)[0];
  17223. f3.call(t2, u3), e2 = e2.replace(u3, "");
  17224. }
  17225. }
  17226. return function(e3) {
  17227. var t3 = e3.afternoon;
  17228. if (t3 !== void 0) {
  17229. var n4 = e3.hours;
  17230. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  17231. }
  17232. }(t2), t2;
  17233. };
  17234. }
  17235. return function(e2, t2, n2) {
  17236. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s = e2.parseTwoDigitYear);
  17237. var r2 = t2.prototype, i2 = r2.parse;
  17238. r2.parse = function(e3) {
  17239. var t3 = e3.date, r3 = e3.utc, s2 = e3.args;
  17240. this.$u = r3;
  17241. var a2 = s2[1];
  17242. if (typeof a2 == "string") {
  17243. var f2 = s2[2] === true, h2 = s2[3] === true, u2 = f2 || h2, d2 = s2[2];
  17244. h2 && (d2 = s2[2]), o = this.$locale(), !f2 && d2 && (o = n2.Ls[d2]), this.$d = function(e4, t4, n3) {
  17245. try {
  17246. if (["x", "X"].indexOf(t4) > -1)
  17247. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  17248. var r4 = c(t4)(e4), i3 = r4.year, o2 = r4.month, s3 = r4.day, a3 = r4.hours, f3 = r4.minutes, h3 = r4.seconds, u3 = r4.milliseconds, d3 = r4.zone, l2 = new Date(), m2 = s3 || (i3 || o2 ? 1 : l2.getDate()), M2 = i3 || l2.getFullYear(), Y = 0;
  17249. i3 && !o2 || (Y = o2 > 0 ? o2 - 1 : l2.getMonth());
  17250. var p = a3 || 0, v = f3 || 0, D = h3 || 0, g = u3 || 0;
  17251. return d3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g + 60 * d3.offset * 1e3)) : n3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g)) : new Date(M2, Y, m2, p, v, D, g);
  17252. } catch (e5) {
  17253. return new Date("");
  17254. }
  17255. }(t3, a2, r3), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), o = {};
  17256. } else if (a2 instanceof Array)
  17257. for (var l = a2.length, m = 1; m <= l; m += 1) {
  17258. s2[1] = a2[m - 1];
  17259. var M = n2.apply(this, s2);
  17260. if (M.isValid()) {
  17261. this.$d = M.$d, this.$L = M.$L, this.init();
  17262. break;
  17263. }
  17264. m === l && (this.$d = new Date(""));
  17265. }
  17266. else
  17267. i2.call(this, e3);
  17268. };
  17269. };
  17270. });
  17271. })(customParseFormat$1);
  17272. var customParseFormat = customParseFormat$1.exports;
  17273. const timeUnits$1 = ["hours", "minutes", "seconds"];
  17274. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17275. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17276. const DEFAULT_FORMATS_DATEPICKER = {
  17277. date: DEFAULT_FORMATS_DATE,
  17278. dates: DEFAULT_FORMATS_DATE,
  17279. week: "gggg[w]ww",
  17280. year: "YYYY",
  17281. month: "YYYY-MM",
  17282. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17283. monthrange: "YYYY-MM",
  17284. daterange: DEFAULT_FORMATS_DATE,
  17285. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17286. };
  17287. const buildTimeList = (value, bound) => {
  17288. return [
  17289. value > 0 ? value - 1 : void 0,
  17290. value,
  17291. value < bound ? value + 1 : void 0
  17292. ];
  17293. };
  17294. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17295. const extractDateFormat = (format) => {
  17296. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17297. };
  17298. const extractTimeFormat = (format) => {
  17299. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17300. };
  17301. const dateEquals = function(a, b) {
  17302. const aIsDate = isDate$1(a);
  17303. const bIsDate = isDate$1(b);
  17304. if (aIsDate && bIsDate) {
  17305. return a.getTime() === b.getTime();
  17306. }
  17307. if (!aIsDate && !bIsDate) {
  17308. return a === b;
  17309. }
  17310. return false;
  17311. };
  17312. const valueEquals = function(a, b) {
  17313. const aIsArray = isArray$1(a);
  17314. const bIsArray = isArray$1(b);
  17315. if (aIsArray && bIsArray) {
  17316. if (a.length !== b.length) {
  17317. return false;
  17318. }
  17319. return a.every((item, index) => dateEquals(item, b[index]));
  17320. }
  17321. if (!aIsArray && !bIsArray) {
  17322. return dateEquals(a, b);
  17323. }
  17324. return false;
  17325. };
  17326. const parseDate = function(date, format, lang) {
  17327. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  17328. return day.isValid() ? day : void 0;
  17329. };
  17330. const formatter = function(date, format, lang) {
  17331. if (isEmpty(format))
  17332. return date;
  17333. if (format === "x")
  17334. return +date;
  17335. return dayjs(date).locale(lang).format(format);
  17336. };
  17337. const makeList = (total, method) => {
  17338. var _a;
  17339. const arr = [];
  17340. const disabledArr = method == null ? void 0 : method();
  17341. for (let i = 0; i < total; i++) {
  17342. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  17343. }
  17344. return arr;
  17345. };
  17346. const disabledTimeListsProps = buildProps({
  17347. disabledHours: {
  17348. type: definePropType(Function)
  17349. },
  17350. disabledMinutes: {
  17351. type: definePropType(Function)
  17352. },
  17353. disabledSeconds: {
  17354. type: definePropType(Function)
  17355. }
  17356. });
  17357. const timePanelSharedProps = buildProps({
  17358. visible: Boolean,
  17359. actualVisible: {
  17360. type: Boolean,
  17361. default: void 0
  17362. },
  17363. format: {
  17364. type: String,
  17365. default: ""
  17366. }
  17367. });
  17368. const timePickerDefaultProps = buildProps({
  17369. id: {
  17370. type: definePropType([Array, String])
  17371. },
  17372. name: {
  17373. type: definePropType([Array, String]),
  17374. default: ""
  17375. },
  17376. popperClass: {
  17377. type: String,
  17378. default: ""
  17379. },
  17380. format: String,
  17381. valueFormat: String,
  17382. type: {
  17383. type: String,
  17384. default: ""
  17385. },
  17386. clearable: {
  17387. type: Boolean,
  17388. default: true
  17389. },
  17390. clearIcon: {
  17391. type: definePropType([String, Object]),
  17392. default: circle_close_default
  17393. },
  17394. editable: {
  17395. type: Boolean,
  17396. default: true
  17397. },
  17398. prefixIcon: {
  17399. type: definePropType([String, Object]),
  17400. default: ""
  17401. },
  17402. size: useSizeProp,
  17403. readonly: {
  17404. type: Boolean,
  17405. default: false
  17406. },
  17407. disabled: {
  17408. type: Boolean,
  17409. default: false
  17410. },
  17411. placeholder: {
  17412. type: String,
  17413. default: ""
  17414. },
  17415. popperOptions: {
  17416. type: definePropType(Object),
  17417. default: () => ({})
  17418. },
  17419. modelValue: {
  17420. type: definePropType([Date, Array, String, Number]),
  17421. default: ""
  17422. },
  17423. rangeSeparator: {
  17424. type: String,
  17425. default: "-"
  17426. },
  17427. startPlaceholder: String,
  17428. endPlaceholder: String,
  17429. defaultValue: {
  17430. type: definePropType([Date, Array])
  17431. },
  17432. defaultTime: {
  17433. type: definePropType([Date, Array])
  17434. },
  17435. isRange: {
  17436. type: Boolean,
  17437. default: false
  17438. },
  17439. ...disabledTimeListsProps,
  17440. disabledDate: {
  17441. type: Function
  17442. },
  17443. cellClassName: {
  17444. type: Function
  17445. },
  17446. shortcuts: {
  17447. type: Array,
  17448. default: () => []
  17449. },
  17450. arrowControl: {
  17451. type: Boolean,
  17452. default: false
  17453. },
  17454. label: {
  17455. type: String,
  17456. default: void 0
  17457. },
  17458. tabindex: {
  17459. type: definePropType([String, Number]),
  17460. default: 0
  17461. },
  17462. validateEvent: {
  17463. type: Boolean,
  17464. default: true
  17465. },
  17466. unlinkPanels: Boolean
  17467. });
  17468. const _hoisted_1$Y = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  17469. const _hoisted_2$D = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  17470. const __default__$1g = vue.defineComponent({
  17471. name: "Picker"
  17472. });
  17473. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  17474. ...__default__$1g,
  17475. props: timePickerDefaultProps,
  17476. emits: [
  17477. "update:modelValue",
  17478. "change",
  17479. "focus",
  17480. "blur",
  17481. "calendar-change",
  17482. "panel-change",
  17483. "visible-change",
  17484. "keydown"
  17485. ],
  17486. setup(__props, { expose, emit }) {
  17487. const props = __props;
  17488. const { lang } = useLocale();
  17489. const nsDate = useNamespace("date");
  17490. const nsInput = useNamespace("input");
  17491. const nsRange = useNamespace("range");
  17492. const { form, formItem } = useFormItem();
  17493. const elPopperOptions = vue.inject("ElPopperOptions", {});
  17494. const refPopper = vue.ref();
  17495. const inputRef = vue.ref();
  17496. const pickerVisible = vue.ref(false);
  17497. const pickerActualVisible = vue.ref(false);
  17498. const valueOnOpen = vue.ref(null);
  17499. let hasJustTabExitedInput = false;
  17500. let ignoreFocusEvent = false;
  17501. vue.watch(pickerVisible, (val) => {
  17502. if (!val) {
  17503. userInput.value = null;
  17504. vue.nextTick(() => {
  17505. emitChange(props.modelValue);
  17506. });
  17507. } else {
  17508. vue.nextTick(() => {
  17509. if (val) {
  17510. valueOnOpen.value = props.modelValue;
  17511. }
  17512. });
  17513. }
  17514. });
  17515. const emitChange = (val, isClear) => {
  17516. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  17517. emit("change", val);
  17518. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  17519. }
  17520. };
  17521. const emitInput = (input) => {
  17522. if (!valueEquals(props.modelValue, input)) {
  17523. let formatted;
  17524. if (isArray$1(input)) {
  17525. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  17526. } else if (input) {
  17527. formatted = formatter(input, props.valueFormat, lang.value);
  17528. }
  17529. emit("update:modelValue", input ? formatted : input, lang.value);
  17530. }
  17531. };
  17532. const emitKeydown = (e) => {
  17533. emit("keydown", e);
  17534. };
  17535. const refInput = vue.computed(() => {
  17536. if (inputRef.value) {
  17537. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  17538. return Array.from(_r.querySelectorAll("input"));
  17539. }
  17540. return [];
  17541. });
  17542. const setSelectionRange = (start, end, pos) => {
  17543. const _inputs = refInput.value;
  17544. if (!_inputs.length)
  17545. return;
  17546. if (!pos || pos === "min") {
  17547. _inputs[0].setSelectionRange(start, end);
  17548. _inputs[0].focus();
  17549. } else if (pos === "max") {
  17550. _inputs[1].setSelectionRange(start, end);
  17551. _inputs[1].focus();
  17552. }
  17553. };
  17554. const focusOnInputBox = () => {
  17555. focus(true, true);
  17556. vue.nextTick(() => {
  17557. ignoreFocusEvent = false;
  17558. });
  17559. };
  17560. const onPick = (date = "", visible = false) => {
  17561. if (!visible) {
  17562. ignoreFocusEvent = true;
  17563. }
  17564. pickerVisible.value = visible;
  17565. let result;
  17566. if (isArray$1(date)) {
  17567. result = date.map((_) => _.toDate());
  17568. } else {
  17569. result = date ? date.toDate() : date;
  17570. }
  17571. userInput.value = null;
  17572. emitInput(result);
  17573. };
  17574. const onBeforeShow = () => {
  17575. pickerActualVisible.value = true;
  17576. };
  17577. const onShow = () => {
  17578. emit("visible-change", true);
  17579. };
  17580. const onKeydownPopperContent = (event) => {
  17581. if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) {
  17582. focus(true, true);
  17583. }
  17584. };
  17585. const onHide = () => {
  17586. pickerActualVisible.value = false;
  17587. pickerVisible.value = false;
  17588. ignoreFocusEvent = false;
  17589. emit("visible-change", false);
  17590. };
  17591. const handleOpen = () => {
  17592. pickerVisible.value = true;
  17593. };
  17594. const handleClose = () => {
  17595. pickerVisible.value = false;
  17596. };
  17597. const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => {
  17598. ignoreFocusEvent = isIgnoreFocusEvent;
  17599. const [leftInput, rightInput] = vue.unref(refInput);
  17600. let input = leftInput;
  17601. if (!focusStartInput && isRangeInput.value) {
  17602. input = rightInput;
  17603. }
  17604. if (input) {
  17605. input.focus();
  17606. }
  17607. };
  17608. const handleFocusInput = (e) => {
  17609. if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) {
  17610. return;
  17611. }
  17612. pickerVisible.value = true;
  17613. emit("focus", e);
  17614. };
  17615. let currentHandleBlurDeferCallback = void 0;
  17616. const handleBlurInput = (e) => {
  17617. const handleBlurDefer = async () => {
  17618. setTimeout(() => {
  17619. var _a;
  17620. if (currentHandleBlurDeferCallback === handleBlurDefer) {
  17621. if (!(((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((input) => {
  17622. return input.contains(document.activeElement);
  17623. }).length === 0) {
  17624. handleChange();
  17625. pickerVisible.value = false;
  17626. emit("blur", e);
  17627. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  17628. }
  17629. hasJustTabExitedInput = false;
  17630. }
  17631. }, 0);
  17632. };
  17633. currentHandleBlurDeferCallback = handleBlurDefer;
  17634. handleBlurDefer();
  17635. };
  17636. const pickerDisabled = vue.computed(() => {
  17637. return props.disabled || (form == null ? void 0 : form.disabled);
  17638. });
  17639. const parsedValue = vue.computed(() => {
  17640. let dayOrDays;
  17641. if (valueIsEmpty.value) {
  17642. if (pickerOptions.value.getDefaultValue) {
  17643. dayOrDays = pickerOptions.value.getDefaultValue();
  17644. }
  17645. } else {
  17646. if (isArray$1(props.modelValue)) {
  17647. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  17648. } else {
  17649. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  17650. }
  17651. }
  17652. if (pickerOptions.value.getRangeAvailableTime) {
  17653. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  17654. if (!isEqual$1(availableResult, dayOrDays)) {
  17655. dayOrDays = availableResult;
  17656. emitInput(isArray$1(dayOrDays) ? dayOrDays.map((_) => _.toDate()) : dayOrDays.toDate());
  17657. }
  17658. }
  17659. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  17660. dayOrDays = [];
  17661. }
  17662. return dayOrDays;
  17663. });
  17664. const displayValue = vue.computed(() => {
  17665. if (!pickerOptions.value.panelReady)
  17666. return "";
  17667. const formattedValue = formatDayjsToString(parsedValue.value);
  17668. if (isArray$1(userInput.value)) {
  17669. return [
  17670. userInput.value[0] || formattedValue && formattedValue[0] || "",
  17671. userInput.value[1] || formattedValue && formattedValue[1] || ""
  17672. ];
  17673. } else if (userInput.value !== null) {
  17674. return userInput.value;
  17675. }
  17676. if (!isTimePicker.value && valueIsEmpty.value)
  17677. return "";
  17678. if (!pickerVisible.value && valueIsEmpty.value)
  17679. return "";
  17680. if (formattedValue) {
  17681. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  17682. }
  17683. return "";
  17684. });
  17685. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  17686. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  17687. const isDatesPicker = vue.computed(() => props.type === "dates");
  17688. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  17689. const showClose = vue.ref(false);
  17690. const onClearIconClick = (event) => {
  17691. if (props.readonly || pickerDisabled.value)
  17692. return;
  17693. if (showClose.value) {
  17694. event.stopPropagation();
  17695. focusOnInputBox();
  17696. emitInput(null);
  17697. emitChange(null, true);
  17698. showClose.value = false;
  17699. pickerVisible.value = false;
  17700. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  17701. }
  17702. };
  17703. const valueIsEmpty = vue.computed(() => {
  17704. const { modelValue } = props;
  17705. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  17706. });
  17707. const onMouseDownInput = async (event) => {
  17708. var _a;
  17709. if (props.readonly || pickerDisabled.value)
  17710. return;
  17711. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  17712. pickerVisible.value = true;
  17713. }
  17714. };
  17715. const onMouseEnter = () => {
  17716. if (props.readonly || pickerDisabled.value)
  17717. return;
  17718. if (!valueIsEmpty.value && props.clearable) {
  17719. showClose.value = true;
  17720. }
  17721. };
  17722. const onMouseLeave = () => {
  17723. showClose.value = false;
  17724. };
  17725. const onTouchStartInput = (event) => {
  17726. var _a;
  17727. if (props.readonly || pickerDisabled.value)
  17728. return;
  17729. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  17730. pickerVisible.value = true;
  17731. }
  17732. };
  17733. const isRangeInput = vue.computed(() => {
  17734. return props.type.includes("range");
  17735. });
  17736. const pickerSize = useFormSize();
  17737. const popperEl = vue.computed(() => {
  17738. var _a, _b;
  17739. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  17740. });
  17741. const actualInputRef = vue.computed(() => {
  17742. var _a;
  17743. if (vue.unref(isRangeInput)) {
  17744. return vue.unref(inputRef);
  17745. }
  17746. return (_a = vue.unref(inputRef)) == null ? void 0 : _a.$el;
  17747. });
  17748. onClickOutside(actualInputRef, (e) => {
  17749. const unrefedPopperEl = vue.unref(popperEl);
  17750. const inputEl = vue.unref(actualInputRef);
  17751. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  17752. return;
  17753. pickerVisible.value = false;
  17754. });
  17755. const userInput = vue.ref(null);
  17756. const handleChange = () => {
  17757. if (userInput.value) {
  17758. const value = parseUserInputToDayjs(displayValue.value);
  17759. if (value) {
  17760. if (isValidValue(value)) {
  17761. emitInput(isArray$1(value) ? value.map((_) => _.toDate()) : value.toDate());
  17762. userInput.value = null;
  17763. }
  17764. }
  17765. }
  17766. if (userInput.value === "") {
  17767. emitInput(null);
  17768. emitChange(null);
  17769. userInput.value = null;
  17770. }
  17771. };
  17772. const parseUserInputToDayjs = (value) => {
  17773. if (!value)
  17774. return null;
  17775. return pickerOptions.value.parseUserInput(value);
  17776. };
  17777. const formatDayjsToString = (value) => {
  17778. if (!value)
  17779. return null;
  17780. return pickerOptions.value.formatToString(value);
  17781. };
  17782. const isValidValue = (value) => {
  17783. return pickerOptions.value.isValidValue(value);
  17784. };
  17785. const handleKeydownInput = async (event) => {
  17786. if (props.readonly || pickerDisabled.value)
  17787. return;
  17788. const { code } = event;
  17789. emitKeydown(event);
  17790. if (code === EVENT_CODE.esc) {
  17791. if (pickerVisible.value === true) {
  17792. pickerVisible.value = false;
  17793. event.preventDefault();
  17794. event.stopPropagation();
  17795. }
  17796. return;
  17797. }
  17798. if (code === EVENT_CODE.down) {
  17799. if (pickerOptions.value.handleFocusPicker) {
  17800. event.preventDefault();
  17801. event.stopPropagation();
  17802. }
  17803. if (pickerVisible.value === false) {
  17804. pickerVisible.value = true;
  17805. await vue.nextTick();
  17806. }
  17807. if (pickerOptions.value.handleFocusPicker) {
  17808. pickerOptions.value.handleFocusPicker();
  17809. return;
  17810. }
  17811. }
  17812. if (code === EVENT_CODE.tab) {
  17813. hasJustTabExitedInput = true;
  17814. return;
  17815. }
  17816. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  17817. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  17818. handleChange();
  17819. pickerVisible.value = false;
  17820. }
  17821. event.stopPropagation();
  17822. return;
  17823. }
  17824. if (userInput.value) {
  17825. event.stopPropagation();
  17826. return;
  17827. }
  17828. if (pickerOptions.value.handleKeydownInput) {
  17829. pickerOptions.value.handleKeydownInput(event);
  17830. }
  17831. };
  17832. const onUserInput = (e) => {
  17833. userInput.value = e;
  17834. if (!pickerVisible.value) {
  17835. pickerVisible.value = true;
  17836. }
  17837. };
  17838. const handleStartInput = (event) => {
  17839. const target = event.target;
  17840. if (userInput.value) {
  17841. userInput.value = [target.value, userInput.value[1]];
  17842. } else {
  17843. userInput.value = [target.value, null];
  17844. }
  17845. };
  17846. const handleEndInput = (event) => {
  17847. const target = event.target;
  17848. if (userInput.value) {
  17849. userInput.value = [userInput.value[0], target.value];
  17850. } else {
  17851. userInput.value = [null, target.value];
  17852. }
  17853. };
  17854. const handleStartChange = () => {
  17855. var _a;
  17856. const values = userInput.value;
  17857. const value = parseUserInputToDayjs(values && values[0]);
  17858. const parsedVal = vue.unref(parsedValue);
  17859. if (value && value.isValid()) {
  17860. userInput.value = [
  17861. formatDayjsToString(value),
  17862. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  17863. ];
  17864. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  17865. if (isValidValue(newValue)) {
  17866. emitInput(newValue);
  17867. userInput.value = null;
  17868. }
  17869. }
  17870. };
  17871. const handleEndChange = () => {
  17872. var _a;
  17873. const values = vue.unref(userInput);
  17874. const value = parseUserInputToDayjs(values && values[1]);
  17875. const parsedVal = vue.unref(parsedValue);
  17876. if (value && value.isValid()) {
  17877. userInput.value = [
  17878. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  17879. formatDayjsToString(value)
  17880. ];
  17881. const newValue = [parsedVal && parsedVal[0], value];
  17882. if (isValidValue(newValue)) {
  17883. emitInput(newValue);
  17884. userInput.value = null;
  17885. }
  17886. }
  17887. };
  17888. const pickerOptions = vue.ref({});
  17889. const onSetPickerOption = (e) => {
  17890. pickerOptions.value[e[0]] = e[1];
  17891. pickerOptions.value.panelReady = true;
  17892. };
  17893. const onCalendarChange = (e) => {
  17894. emit("calendar-change", e);
  17895. };
  17896. const onPanelChange = (value, mode, view) => {
  17897. emit("panel-change", value, mode, view);
  17898. };
  17899. vue.provide("EP_PICKER_BASE", {
  17900. props
  17901. });
  17902. expose({
  17903. focus,
  17904. handleFocusInput,
  17905. handleBlurInput,
  17906. handleOpen,
  17907. handleClose,
  17908. onPick
  17909. });
  17910. return (_ctx, _cache) => {
  17911. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  17912. ref_key: "refPopper",
  17913. ref: refPopper,
  17914. visible: pickerVisible.value,
  17915. effect: "light",
  17916. pure: "",
  17917. trigger: "click"
  17918. }, _ctx.$attrs, {
  17919. role: "dialog",
  17920. teleported: "",
  17921. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  17922. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  17923. "popper-options": vue.unref(elPopperOptions),
  17924. "fallback-placements": ["bottom", "top", "right", "left"],
  17925. "gpu-acceleration": false,
  17926. "stop-popper-mouse-event": false,
  17927. "hide-after": 0,
  17928. persistent: "",
  17929. onBeforeShow,
  17930. onShow,
  17931. onHide
  17932. }), {
  17933. default: vue.withCtx(() => [
  17934. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  17935. key: 0,
  17936. id: _ctx.id,
  17937. ref_key: "inputRef",
  17938. ref: inputRef,
  17939. "container-role": "combobox",
  17940. "model-value": vue.unref(displayValue),
  17941. name: _ctx.name,
  17942. size: vue.unref(pickerSize),
  17943. disabled: vue.unref(pickerDisabled),
  17944. placeholder: _ctx.placeholder,
  17945. class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  17946. style: vue.normalizeStyle(_ctx.$attrs.style),
  17947. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || _ctx.type === "week",
  17948. label: _ctx.label,
  17949. tabindex: _ctx.tabindex,
  17950. "validate-event": false,
  17951. onInput: onUserInput,
  17952. onFocus: handleFocusInput,
  17953. onBlur: handleBlurInput,
  17954. onKeydown: handleKeydownInput,
  17955. onChange: handleChange,
  17956. onMousedown: onMouseDownInput,
  17957. onMouseenter: onMouseEnter,
  17958. onMouseleave: onMouseLeave,
  17959. onTouchstart: onTouchStartInput,
  17960. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  17961. }, ["stop"]))
  17962. }, {
  17963. prefix: vue.withCtx(() => [
  17964. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  17965. key: 0,
  17966. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  17967. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  17968. onTouchstart: onTouchStartInput
  17969. }, {
  17970. default: vue.withCtx(() => [
  17971. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  17972. ]),
  17973. _: 1
  17974. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  17975. ]),
  17976. suffix: vue.withCtx(() => [
  17977. showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  17978. key: 0,
  17979. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  17980. onClick: vue.withModifiers(onClearIconClick, ["stop"])
  17981. }, {
  17982. default: vue.withCtx(() => [
  17983. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  17984. ]),
  17985. _: 1
  17986. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  17987. ]),
  17988. _: 1
  17989. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "label", "tabindex", "onKeydown"])) : (vue.openBlock(), vue.createElementBlock("div", {
  17990. key: 1,
  17991. ref_key: "inputRef",
  17992. ref: inputRef,
  17993. class: vue.normalizeClass([
  17994. vue.unref(nsDate).b("editor"),
  17995. vue.unref(nsDate).bm("editor", _ctx.type),
  17996. vue.unref(nsInput).e("wrapper"),
  17997. vue.unref(nsDate).is("disabled", vue.unref(pickerDisabled)),
  17998. vue.unref(nsDate).is("active", pickerVisible.value),
  17999. vue.unref(nsRange).b("editor"),
  18000. vue.unref(pickerSize) ? vue.unref(nsRange).bm("editor", vue.unref(pickerSize)) : "",
  18001. _ctx.$attrs.class
  18002. ]),
  18003. style: vue.normalizeStyle(_ctx.$attrs.style),
  18004. onClick: handleFocusInput,
  18005. onMouseenter: onMouseEnter,
  18006. onMouseleave: onMouseLeave,
  18007. onTouchstart: onTouchStartInput,
  18008. onKeydown: handleKeydownInput
  18009. }, [
  18010. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18011. key: 0,
  18012. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")]),
  18013. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  18014. onTouchstart: onTouchStartInput
  18015. }, {
  18016. default: vue.withCtx(() => [
  18017. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18018. ]),
  18019. _: 1
  18020. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  18021. vue.createElementVNode("input", {
  18022. id: _ctx.id && _ctx.id[0],
  18023. autocomplete: "off",
  18024. name: _ctx.name && _ctx.name[0],
  18025. placeholder: _ctx.startPlaceholder,
  18026. value: vue.unref(displayValue) && vue.unref(displayValue)[0],
  18027. disabled: vue.unref(pickerDisabled),
  18028. readonly: !_ctx.editable || _ctx.readonly,
  18029. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  18030. onMousedown: onMouseDownInput,
  18031. onInput: handleStartInput,
  18032. onChange: handleStartChange,
  18033. onFocus: handleFocusInput,
  18034. onBlur: handleBlurInput
  18035. }, null, 42, _hoisted_1$Y),
  18036. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  18037. vue.createElementVNode("span", {
  18038. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  18039. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  18040. ]),
  18041. vue.createElementVNode("input", {
  18042. id: _ctx.id && _ctx.id[1],
  18043. autocomplete: "off",
  18044. name: _ctx.name && _ctx.name[1],
  18045. placeholder: _ctx.endPlaceholder,
  18046. value: vue.unref(displayValue) && vue.unref(displayValue)[1],
  18047. disabled: vue.unref(pickerDisabled),
  18048. readonly: !_ctx.editable || _ctx.readonly,
  18049. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  18050. onMousedown: onMouseDownInput,
  18051. onFocus: handleFocusInput,
  18052. onBlur: handleBlurInput,
  18053. onInput: handleEndInput,
  18054. onChange: handleEndChange
  18055. }, null, 42, _hoisted_2$D),
  18056. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18057. key: 1,
  18058. class: vue.normalizeClass([
  18059. vue.unref(nsInput).e("icon"),
  18060. vue.unref(nsRange).e("close-icon"),
  18061. {
  18062. [vue.unref(nsRange).e("close-icon--hidden")]: !showClose.value
  18063. }
  18064. ]),
  18065. onClick: onClearIconClick
  18066. }, {
  18067. default: vue.withCtx(() => [
  18068. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18069. ]),
  18070. _: 1
  18071. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  18072. ], 38))
  18073. ]),
  18074. content: vue.withCtx(() => [
  18075. vue.renderSlot(_ctx.$slots, "default", {
  18076. visible: pickerVisible.value,
  18077. actualVisible: pickerActualVisible.value,
  18078. parsedValue: vue.unref(parsedValue),
  18079. format: _ctx.format,
  18080. unlinkPanels: _ctx.unlinkPanels,
  18081. type: _ctx.type,
  18082. defaultValue: _ctx.defaultValue,
  18083. onPick,
  18084. onSelectRange: setSelectionRange,
  18085. onSetPickerOption,
  18086. onCalendarChange,
  18087. onPanelChange,
  18088. onKeydown: onKeydownPopperContent,
  18089. onMousedown: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  18090. }, ["stop"]))
  18091. })
  18092. ]),
  18093. _: 3
  18094. }, 16, ["visible", "transition", "popper-class", "popper-options"]);
  18095. };
  18096. }
  18097. });
  18098. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "picker.vue"]]);
  18099. const panelTimePickerProps = buildProps({
  18100. ...timePanelSharedProps,
  18101. datetimeRole: String,
  18102. parsedValue: {
  18103. type: definePropType(Object)
  18104. }
  18105. });
  18106. const useTimePanel = ({
  18107. getAvailableHours,
  18108. getAvailableMinutes,
  18109. getAvailableSeconds
  18110. }) => {
  18111. const getAvailableTime = (date, role, first, compareDate) => {
  18112. const availableTimeGetters = {
  18113. hour: getAvailableHours,
  18114. minute: getAvailableMinutes,
  18115. second: getAvailableSeconds
  18116. };
  18117. let result = date;
  18118. ["hour", "minute", "second"].forEach((type) => {
  18119. if (availableTimeGetters[type]) {
  18120. let availableTimeSlots;
  18121. const method = availableTimeGetters[type];
  18122. switch (type) {
  18123. case "minute": {
  18124. availableTimeSlots = method(result.hour(), role, compareDate);
  18125. break;
  18126. }
  18127. case "second": {
  18128. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18129. break;
  18130. }
  18131. default: {
  18132. availableTimeSlots = method(role, compareDate);
  18133. break;
  18134. }
  18135. }
  18136. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  18137. const pos = first ? 0 : availableTimeSlots.length - 1;
  18138. result = result[type](availableTimeSlots[pos]);
  18139. }
  18140. }
  18141. });
  18142. return result;
  18143. };
  18144. const timePickerOptions = {};
  18145. const onSetOption = ([key, val]) => {
  18146. timePickerOptions[key] = val;
  18147. };
  18148. return {
  18149. timePickerOptions,
  18150. getAvailableTime,
  18151. onSetOption
  18152. };
  18153. };
  18154. const makeAvailableArr = (disabledList) => {
  18155. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18156. const getNumber = (predicate) => predicate !== true;
  18157. return disabledList.map(trueOrNumber).filter(getNumber);
  18158. };
  18159. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18160. const getHoursList = (role, compare) => {
  18161. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  18162. };
  18163. const getMinutesList = (hour, role, compare) => {
  18164. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  18165. };
  18166. const getSecondsList = (hour, minute, role, compare) => {
  18167. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  18168. };
  18169. return {
  18170. getHoursList,
  18171. getMinutesList,
  18172. getSecondsList
  18173. };
  18174. };
  18175. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18176. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18177. const getAvailableHours = (role, compare) => {
  18178. return makeAvailableArr(getHoursList(role, compare));
  18179. };
  18180. const getAvailableMinutes = (hour, role, compare) => {
  18181. return makeAvailableArr(getMinutesList(hour, role, compare));
  18182. };
  18183. const getAvailableSeconds = (hour, minute, role, compare) => {
  18184. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18185. };
  18186. return {
  18187. getAvailableHours,
  18188. getAvailableMinutes,
  18189. getAvailableSeconds
  18190. };
  18191. };
  18192. const useOldValue = (props) => {
  18193. const oldValue = vue.ref(props.parsedValue);
  18194. vue.watch(() => props.visible, (val) => {
  18195. if (!val) {
  18196. oldValue.value = props.parsedValue;
  18197. }
  18198. });
  18199. return oldValue;
  18200. };
  18201. const nodeList = /* @__PURE__ */ new Map();
  18202. let startClick;
  18203. if (isClient) {
  18204. document.addEventListener("mousedown", (e) => startClick = e);
  18205. document.addEventListener("mouseup", (e) => {
  18206. for (const handlers of nodeList.values()) {
  18207. for (const { documentHandler } of handlers) {
  18208. documentHandler(e, startClick);
  18209. }
  18210. }
  18211. });
  18212. }
  18213. function createDocumentHandler(el, binding) {
  18214. let excludes = [];
  18215. if (Array.isArray(binding.arg)) {
  18216. excludes = binding.arg;
  18217. } else if (isElement$1(binding.arg)) {
  18218. excludes.push(binding.arg);
  18219. }
  18220. return function(mouseup, mousedown) {
  18221. const popperRef = binding.instance.popperRef;
  18222. const mouseUpTarget = mouseup.target;
  18223. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  18224. const isBound = !binding || !binding.instance;
  18225. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18226. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18227. const isSelf = el === mouseUpTarget;
  18228. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18229. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18230. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  18231. return;
  18232. }
  18233. binding.value(mouseup, mousedown);
  18234. };
  18235. }
  18236. const ClickOutside = {
  18237. beforeMount(el, binding) {
  18238. if (!nodeList.has(el)) {
  18239. nodeList.set(el, []);
  18240. }
  18241. nodeList.get(el).push({
  18242. documentHandler: createDocumentHandler(el, binding),
  18243. bindingFn: binding.value
  18244. });
  18245. },
  18246. updated(el, binding) {
  18247. if (!nodeList.has(el)) {
  18248. nodeList.set(el, []);
  18249. }
  18250. const handlers = nodeList.get(el);
  18251. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18252. const newHandler = {
  18253. documentHandler: createDocumentHandler(el, binding),
  18254. bindingFn: binding.value
  18255. };
  18256. if (oldHandlerIndex >= 0) {
  18257. handlers.splice(oldHandlerIndex, 1, newHandler);
  18258. } else {
  18259. handlers.push(newHandler);
  18260. }
  18261. },
  18262. unmounted(el) {
  18263. nodeList.delete(el);
  18264. }
  18265. };
  18266. const REPEAT_INTERVAL = 100;
  18267. const REPEAT_DELAY = 600;
  18268. const vRepeatClick = {
  18269. beforeMount(el, binding) {
  18270. const value = binding.value;
  18271. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18272. let intervalId;
  18273. let delayId;
  18274. const handler = () => isFunction$1(value) ? value() : value.handler();
  18275. const clear = () => {
  18276. if (delayId) {
  18277. clearTimeout(delayId);
  18278. delayId = void 0;
  18279. }
  18280. if (intervalId) {
  18281. clearInterval(intervalId);
  18282. intervalId = void 0;
  18283. }
  18284. };
  18285. el.addEventListener("mousedown", (evt) => {
  18286. if (evt.button !== 0)
  18287. return;
  18288. clear();
  18289. handler();
  18290. document.addEventListener("mouseup", () => clear(), {
  18291. once: true
  18292. });
  18293. delayId = setTimeout(() => {
  18294. intervalId = setInterval(() => {
  18295. handler();
  18296. }, interval);
  18297. }, delay);
  18298. });
  18299. }
  18300. };
  18301. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18302. const FOCUS_STACK = [];
  18303. const FOCUS_HANDLER = (e) => {
  18304. if (FOCUS_STACK.length === 0)
  18305. return;
  18306. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18307. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  18308. if (focusableElement.length === 1) {
  18309. e.preventDefault();
  18310. if (document.activeElement !== focusableElement[0]) {
  18311. focusableElement[0].focus();
  18312. }
  18313. return;
  18314. }
  18315. const goingBackward = e.shiftKey;
  18316. const isFirst = e.target === focusableElement[0];
  18317. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18318. if (isFirst && goingBackward) {
  18319. e.preventDefault();
  18320. focusableElement[focusableElement.length - 1].focus();
  18321. }
  18322. if (isLast && !goingBackward) {
  18323. e.preventDefault();
  18324. focusableElement[0].focus();
  18325. }
  18326. }
  18327. };
  18328. const TrapFocus = {
  18329. beforeMount(el) {
  18330. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18331. FOCUS_STACK.push(el);
  18332. if (FOCUS_STACK.length <= 1) {
  18333. document.addEventListener("keydown", FOCUS_HANDLER);
  18334. }
  18335. },
  18336. updated(el) {
  18337. vue.nextTick(() => {
  18338. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18339. });
  18340. },
  18341. unmounted() {
  18342. FOCUS_STACK.shift();
  18343. if (FOCUS_STACK.length === 0) {
  18344. document.removeEventListener("keydown", FOCUS_HANDLER);
  18345. }
  18346. }
  18347. };
  18348. 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;/**
  18349. * Checks if an event is supported in the current execution environment.
  18350. *
  18351. * NOTE: This will not work correctly for non-generic events such as `change`,
  18352. * `reset`, `load`, `error`, and `select`.
  18353. *
  18354. * Borrows from Modernizr.
  18355. *
  18356. * @param {string} eventNameSuffix Event name, e.g. "click".
  18357. * @param {?boolean} capture Check if the capture phase is supported.
  18358. * @return {boolean} True if the event is supported.
  18359. * @internal
  18360. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  18361. */
  18362. const mousewheel = function(element, callback) {
  18363. if (element && element.addEventListener) {
  18364. const fn = function(event) {
  18365. const normalized = Y(event);
  18366. callback && Reflect.apply(callback, this, [event, normalized]);
  18367. };
  18368. element.addEventListener("wheel", fn, { passive: true });
  18369. }
  18370. };
  18371. const Mousewheel = {
  18372. beforeMount(el, binding) {
  18373. mousewheel(el, binding.value);
  18374. }
  18375. };
  18376. const basicTimeSpinnerProps = buildProps({
  18377. role: {
  18378. type: String,
  18379. required: true
  18380. },
  18381. spinnerDate: {
  18382. type: definePropType(Object),
  18383. required: true
  18384. },
  18385. showSeconds: {
  18386. type: Boolean,
  18387. default: true
  18388. },
  18389. arrowControl: Boolean,
  18390. amPmMode: {
  18391. type: definePropType(String),
  18392. default: ""
  18393. },
  18394. ...disabledTimeListsProps
  18395. });
  18396. const _hoisted_1$X = ["onClick"];
  18397. const _hoisted_2$C = ["onMouseenter"];
  18398. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  18399. __name: "basic-time-spinner",
  18400. props: basicTimeSpinnerProps,
  18401. emits: ["change", "select-range", "set-option"],
  18402. setup(__props, { emit }) {
  18403. const props = __props;
  18404. const ns = useNamespace("time");
  18405. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  18406. let isScrolling = false;
  18407. const currentScrollbar = vue.ref();
  18408. const listHoursRef = vue.ref();
  18409. const listMinutesRef = vue.ref();
  18410. const listSecondsRef = vue.ref();
  18411. const listRefsMap = {
  18412. hours: listHoursRef,
  18413. minutes: listMinutesRef,
  18414. seconds: listSecondsRef
  18415. };
  18416. const spinnerItems = vue.computed(() => {
  18417. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  18418. });
  18419. const timePartials = vue.computed(() => {
  18420. const { spinnerDate } = props;
  18421. const hours = spinnerDate.hour();
  18422. const minutes = spinnerDate.minute();
  18423. const seconds = spinnerDate.second();
  18424. return { hours, minutes, seconds };
  18425. });
  18426. const timeList = vue.computed(() => {
  18427. const { hours, minutes } = vue.unref(timePartials);
  18428. return {
  18429. hours: getHoursList(props.role),
  18430. minutes: getMinutesList(hours, props.role),
  18431. seconds: getSecondsList(hours, minutes, props.role)
  18432. };
  18433. });
  18434. const arrowControlTimeList = vue.computed(() => {
  18435. const { hours, minutes, seconds } = vue.unref(timePartials);
  18436. return {
  18437. hours: buildTimeList(hours, 23),
  18438. minutes: buildTimeList(minutes, 59),
  18439. seconds: buildTimeList(seconds, 59)
  18440. };
  18441. });
  18442. const debouncedResetScroll = debounce((type) => {
  18443. isScrolling = false;
  18444. adjustCurrentSpinner(type);
  18445. }, 200);
  18446. const getAmPmFlag = (hour) => {
  18447. const shouldShowAmPm = !!props.amPmMode;
  18448. if (!shouldShowAmPm)
  18449. return "";
  18450. const isCapital = props.amPmMode === "A";
  18451. let content = hour < 12 ? " am" : " pm";
  18452. if (isCapital)
  18453. content = content.toUpperCase();
  18454. return content;
  18455. };
  18456. const emitSelectRange = (type) => {
  18457. let range;
  18458. switch (type) {
  18459. case "hours":
  18460. range = [0, 2];
  18461. break;
  18462. case "minutes":
  18463. range = [3, 5];
  18464. break;
  18465. case "seconds":
  18466. range = [6, 8];
  18467. break;
  18468. }
  18469. const [left, right] = range;
  18470. emit("select-range", left, right);
  18471. currentScrollbar.value = type;
  18472. };
  18473. const adjustCurrentSpinner = (type) => {
  18474. adjustSpinner(type, vue.unref(timePartials)[type]);
  18475. };
  18476. const adjustSpinners = () => {
  18477. adjustCurrentSpinner("hours");
  18478. adjustCurrentSpinner("minutes");
  18479. adjustCurrentSpinner("seconds");
  18480. };
  18481. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  18482. const adjustSpinner = (type, value) => {
  18483. if (props.arrowControl)
  18484. return;
  18485. const scrollbar = vue.unref(listRefsMap[type]);
  18486. if (scrollbar && scrollbar.$el) {
  18487. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  18488. }
  18489. };
  18490. const typeItemHeight = (type) => {
  18491. const scrollbar = vue.unref(listRefsMap[type]);
  18492. return (scrollbar == null ? void 0 : scrollbar.$el.querySelector("li").offsetHeight) || 0;
  18493. };
  18494. const onIncrement = () => {
  18495. scrollDown(1);
  18496. };
  18497. const onDecrement = () => {
  18498. scrollDown(-1);
  18499. };
  18500. const scrollDown = (step) => {
  18501. if (!currentScrollbar.value) {
  18502. emitSelectRange("hours");
  18503. }
  18504. const label = currentScrollbar.value;
  18505. const now = vue.unref(timePartials)[label];
  18506. const total = currentScrollbar.value === "hours" ? 24 : 60;
  18507. const next = findNextUnDisabled(label, now, step, total);
  18508. modifyDateField(label, next);
  18509. adjustSpinner(label, next);
  18510. vue.nextTick(() => emitSelectRange(label));
  18511. };
  18512. const findNextUnDisabled = (type, now, step, total) => {
  18513. let next = (now + step + total) % total;
  18514. const list = vue.unref(timeList)[type];
  18515. while (list[next] && next !== now) {
  18516. next = (next + step + total) % total;
  18517. }
  18518. return next;
  18519. };
  18520. const modifyDateField = (type, value) => {
  18521. const list = vue.unref(timeList)[type];
  18522. const isDisabled = list[value];
  18523. if (isDisabled)
  18524. return;
  18525. const { hours, minutes, seconds } = vue.unref(timePartials);
  18526. let changeTo;
  18527. switch (type) {
  18528. case "hours":
  18529. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  18530. break;
  18531. case "minutes":
  18532. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  18533. break;
  18534. case "seconds":
  18535. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  18536. break;
  18537. }
  18538. emit("change", changeTo);
  18539. };
  18540. const handleClick = (type, { value, disabled }) => {
  18541. if (!disabled) {
  18542. modifyDateField(type, value);
  18543. emitSelectRange(type);
  18544. adjustSpinner(type, value);
  18545. }
  18546. };
  18547. const handleScroll = (type) => {
  18548. isScrolling = true;
  18549. debouncedResetScroll(type);
  18550. const value = Math.min(Math.round((getScrollbarElement(vue.unref(listRefsMap[type]).$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  18551. modifyDateField(type, value);
  18552. };
  18553. const scrollBarHeight = (type) => {
  18554. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  18555. };
  18556. const bindScrollEvent = () => {
  18557. const bindFunction = (type) => {
  18558. const scrollbar = vue.unref(listRefsMap[type]);
  18559. if (scrollbar && scrollbar.$el) {
  18560. getScrollbarElement(scrollbar.$el).onscroll = () => {
  18561. handleScroll(type);
  18562. };
  18563. }
  18564. };
  18565. bindFunction("hours");
  18566. bindFunction("minutes");
  18567. bindFunction("seconds");
  18568. };
  18569. vue.onMounted(() => {
  18570. vue.nextTick(() => {
  18571. !props.arrowControl && bindScrollEvent();
  18572. adjustSpinners();
  18573. if (props.role === "start")
  18574. emitSelectRange("hours");
  18575. });
  18576. });
  18577. const setRef = (scrollbar, type) => {
  18578. listRefsMap[type].value = scrollbar;
  18579. };
  18580. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  18581. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  18582. vue.watch(() => props.spinnerDate, () => {
  18583. if (isScrolling)
  18584. return;
  18585. adjustSpinners();
  18586. });
  18587. return (_ctx, _cache) => {
  18588. return vue.openBlock(), vue.createElementBlock("div", {
  18589. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  18590. }, [
  18591. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  18592. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  18593. key: item,
  18594. ref_for: true,
  18595. ref: (scrollbar) => setRef(scrollbar, item),
  18596. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  18597. "wrap-style": "max-height: inherit;",
  18598. "view-class": vue.unref(ns).be("spinner", "list"),
  18599. noresize: "",
  18600. tag: "ul",
  18601. onMouseenter: ($event) => emitSelectRange(item),
  18602. onMousemove: ($event) => adjustCurrentSpinner(item)
  18603. }, {
  18604. default: vue.withCtx(() => [
  18605. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  18606. return vue.openBlock(), vue.createElementBlock("li", {
  18607. key,
  18608. class: vue.normalizeClass([
  18609. vue.unref(ns).be("spinner", "item"),
  18610. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  18611. vue.unref(ns).is("disabled", disabled)
  18612. ]),
  18613. onClick: ($event) => handleClick(item, { value: key, disabled })
  18614. }, [
  18615. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18616. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  18617. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  18618. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  18619. ], 64))
  18620. ], 10, _hoisted_1$X);
  18621. }), 128))
  18622. ]),
  18623. _: 2
  18624. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  18625. }), 128)) : vue.createCommentVNode("v-if", true),
  18626. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  18627. return vue.openBlock(), vue.createElementBlock("div", {
  18628. key: item,
  18629. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  18630. onMouseenter: ($event) => emitSelectRange(item)
  18631. }, [
  18632. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18633. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  18634. }, {
  18635. default: vue.withCtx(() => [
  18636. vue.createVNode(vue.unref(arrow_up_default))
  18637. ]),
  18638. _: 1
  18639. }, 8, ["class"])), [
  18640. [vue.unref(vRepeatClick), onDecrement]
  18641. ]),
  18642. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18643. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  18644. }, {
  18645. default: vue.withCtx(() => [
  18646. vue.createVNode(vue.unref(arrow_down_default))
  18647. ]),
  18648. _: 1
  18649. }, 8, ["class"])), [
  18650. [vue.unref(vRepeatClick), onIncrement]
  18651. ]),
  18652. vue.createElementVNode("ul", {
  18653. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  18654. }, [
  18655. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  18656. return vue.openBlock(), vue.createElementBlock("li", {
  18657. key,
  18658. class: vue.normalizeClass([
  18659. vue.unref(ns).be("spinner", "item"),
  18660. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  18661. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  18662. ])
  18663. }, [
  18664. typeof time === "number" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18665. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18666. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  18667. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  18668. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  18669. ], 64))
  18670. ], 64)) : vue.createCommentVNode("v-if", true)
  18671. ], 2);
  18672. }), 128))
  18673. ], 2)
  18674. ], 42, _hoisted_2$C);
  18675. }), 128)) : vue.createCommentVNode("v-if", true)
  18676. ], 2);
  18677. };
  18678. }
  18679. });
  18680. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "basic-time-spinner.vue"]]);
  18681. const _sfc_main$1T = /* @__PURE__ */ vue.defineComponent({
  18682. __name: "panel-time-pick",
  18683. props: panelTimePickerProps,
  18684. emits: ["pick", "select-range", "set-picker-option"],
  18685. setup(__props, { emit }) {
  18686. const props = __props;
  18687. const pickerBase = vue.inject("EP_PICKER_BASE");
  18688. const {
  18689. arrowControl,
  18690. disabledHours,
  18691. disabledMinutes,
  18692. disabledSeconds,
  18693. defaultValue
  18694. } = pickerBase.props;
  18695. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  18696. const ns = useNamespace("time");
  18697. const { t, lang } = useLocale();
  18698. const selectionRange = vue.ref([0, 2]);
  18699. const oldValue = useOldValue(props);
  18700. const transitionName = vue.computed(() => {
  18701. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  18702. });
  18703. const showSeconds = vue.computed(() => {
  18704. return props.format.includes("ss");
  18705. });
  18706. const amPmMode = vue.computed(() => {
  18707. if (props.format.includes("A"))
  18708. return "A";
  18709. if (props.format.includes("a"))
  18710. return "a";
  18711. return "";
  18712. });
  18713. const isValidValue = (_date) => {
  18714. const parsedDate = dayjs(_date).locale(lang.value);
  18715. const result = getRangeAvailableTime(parsedDate);
  18716. return parsedDate.isSame(result);
  18717. };
  18718. const handleCancel = () => {
  18719. emit("pick", oldValue.value, false);
  18720. };
  18721. const handleConfirm = (visible = false, first = false) => {
  18722. if (first)
  18723. return;
  18724. emit("pick", props.parsedValue, visible);
  18725. };
  18726. const handleChange = (_date) => {
  18727. if (!props.visible) {
  18728. return;
  18729. }
  18730. const result = getRangeAvailableTime(_date).millisecond(0);
  18731. emit("pick", result, true);
  18732. };
  18733. const setSelectionRange = (start, end) => {
  18734. emit("select-range", start, end);
  18735. selectionRange.value = [start, end];
  18736. };
  18737. const changeSelectionRange = (step) => {
  18738. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  18739. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  18740. const index = list.indexOf(selectionRange.value[0]);
  18741. const next = (index + step + list.length) % list.length;
  18742. timePickerOptions["start_emitSelectRange"](mapping[next]);
  18743. };
  18744. const handleKeydown = (event) => {
  18745. const code = event.code;
  18746. const { left, right, up, down } = EVENT_CODE;
  18747. if ([left, right].includes(code)) {
  18748. const step = code === left ? -1 : 1;
  18749. changeSelectionRange(step);
  18750. event.preventDefault();
  18751. return;
  18752. }
  18753. if ([up, down].includes(code)) {
  18754. const step = code === up ? -1 : 1;
  18755. timePickerOptions["start_scrollDown"](step);
  18756. event.preventDefault();
  18757. return;
  18758. }
  18759. };
  18760. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  18761. getAvailableHours,
  18762. getAvailableMinutes,
  18763. getAvailableSeconds
  18764. });
  18765. const getRangeAvailableTime = (date) => {
  18766. return getAvailableTime(date, props.datetimeRole || "", true);
  18767. };
  18768. const parseUserInput = (value) => {
  18769. if (!value)
  18770. return null;
  18771. return dayjs(value, props.format).locale(lang.value);
  18772. };
  18773. const formatToString = (value) => {
  18774. if (!value)
  18775. return null;
  18776. return value.format(props.format);
  18777. };
  18778. const getDefaultValue = () => {
  18779. return dayjs(defaultValue).locale(lang.value);
  18780. };
  18781. emit("set-picker-option", ["isValidValue", isValidValue]);
  18782. emit("set-picker-option", ["formatToString", formatToString]);
  18783. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  18784. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  18785. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  18786. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  18787. return (_ctx, _cache) => {
  18788. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  18789. default: vue.withCtx(() => [
  18790. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  18791. key: 0,
  18792. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  18793. }, [
  18794. vue.createElementVNode("div", {
  18795. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  18796. }, [
  18797. vue.createVNode(TimeSpinner, {
  18798. ref: "spinner",
  18799. role: _ctx.datetimeRole || "start",
  18800. "arrow-control": vue.unref(arrowControl),
  18801. "show-seconds": vue.unref(showSeconds),
  18802. "am-pm-mode": vue.unref(amPmMode),
  18803. "spinner-date": _ctx.parsedValue,
  18804. "disabled-hours": vue.unref(disabledHours),
  18805. "disabled-minutes": vue.unref(disabledMinutes),
  18806. "disabled-seconds": vue.unref(disabledSeconds),
  18807. onChange: handleChange,
  18808. onSetOption: vue.unref(onSetOption),
  18809. onSelectRange: setSelectionRange
  18810. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  18811. ], 2),
  18812. vue.createElementVNode("div", {
  18813. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  18814. }, [
  18815. vue.createElementVNode("button", {
  18816. type: "button",
  18817. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  18818. onClick: handleCancel
  18819. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  18820. vue.createElementVNode("button", {
  18821. type: "button",
  18822. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  18823. onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
  18824. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 3)
  18825. ], 2)
  18826. ], 2)) : vue.createCommentVNode("v-if", true)
  18827. ]),
  18828. _: 1
  18829. }, 8, ["name"]);
  18830. };
  18831. }
  18832. });
  18833. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "panel-time-pick.vue"]]);
  18834. const panelTimeRangeProps = buildProps({
  18835. ...timePanelSharedProps,
  18836. parsedValue: {
  18837. type: definePropType(Array)
  18838. }
  18839. });
  18840. const _hoisted_1$W = ["disabled"];
  18841. const _sfc_main$1S = /* @__PURE__ */ vue.defineComponent({
  18842. __name: "panel-time-range",
  18843. props: panelTimeRangeProps,
  18844. emits: ["pick", "select-range", "set-picker-option"],
  18845. setup(__props, { emit }) {
  18846. const props = __props;
  18847. const makeSelectRange = (start, end) => {
  18848. const result = [];
  18849. for (let i = start; i <= end; i++) {
  18850. result.push(i);
  18851. }
  18852. return result;
  18853. };
  18854. const { t, lang } = useLocale();
  18855. const nsTime = useNamespace("time");
  18856. const nsPicker = useNamespace("picker");
  18857. const pickerBase = vue.inject("EP_PICKER_BASE");
  18858. const {
  18859. arrowControl,
  18860. disabledHours,
  18861. disabledMinutes,
  18862. disabledSeconds,
  18863. defaultValue
  18864. } = pickerBase.props;
  18865. const startTime = vue.computed(() => props.parsedValue[0]);
  18866. const endTime = vue.computed(() => props.parsedValue[1]);
  18867. const oldValue = useOldValue(props);
  18868. const handleCancel = () => {
  18869. emit("pick", oldValue.value, false);
  18870. };
  18871. const showSeconds = vue.computed(() => {
  18872. return props.format.includes("ss");
  18873. });
  18874. const amPmMode = vue.computed(() => {
  18875. if (props.format.includes("A"))
  18876. return "A";
  18877. if (props.format.includes("a"))
  18878. return "a";
  18879. return "";
  18880. });
  18881. const handleConfirm = (visible = false) => {
  18882. emit("pick", [startTime.value, endTime.value], visible);
  18883. };
  18884. const handleMinChange = (date) => {
  18885. handleChange(date.millisecond(0), endTime.value);
  18886. };
  18887. const handleMaxChange = (date) => {
  18888. handleChange(startTime.value, date.millisecond(0));
  18889. };
  18890. const isValidValue = (_date) => {
  18891. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  18892. const result = getRangeAvailableTime(parsedDate);
  18893. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  18894. };
  18895. const handleChange = (start, end) => {
  18896. emit("pick", [start, end], true);
  18897. };
  18898. const btnConfirmDisabled = vue.computed(() => {
  18899. return startTime.value > endTime.value;
  18900. });
  18901. const selectionRange = vue.ref([0, 2]);
  18902. const setMinSelectionRange = (start, end) => {
  18903. emit("select-range", start, end, "min");
  18904. selectionRange.value = [start, end];
  18905. };
  18906. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  18907. const setMaxSelectionRange = (start, end) => {
  18908. emit("select-range", start, end, "max");
  18909. const _offset = vue.unref(offset);
  18910. selectionRange.value = [start + _offset, end + _offset];
  18911. };
  18912. const changeSelectionRange = (step) => {
  18913. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  18914. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  18915. const index = list.indexOf(selectionRange.value[0]);
  18916. const next = (index + step + list.length) % list.length;
  18917. const half = list.length / 2;
  18918. if (next < half) {
  18919. timePickerOptions["start_emitSelectRange"](mapping[next]);
  18920. } else {
  18921. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  18922. }
  18923. };
  18924. const handleKeydown = (event) => {
  18925. const code = event.code;
  18926. const { left, right, up, down } = EVENT_CODE;
  18927. if ([left, right].includes(code)) {
  18928. const step = code === left ? -1 : 1;
  18929. changeSelectionRange(step);
  18930. event.preventDefault();
  18931. return;
  18932. }
  18933. if ([up, down].includes(code)) {
  18934. const step = code === up ? -1 : 1;
  18935. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  18936. timePickerOptions[`${role}_scrollDown`](step);
  18937. event.preventDefault();
  18938. return;
  18939. }
  18940. };
  18941. const disabledHours_ = (role, compare) => {
  18942. const defaultDisable = disabledHours ? disabledHours(role) : [];
  18943. const isStart = role === "start";
  18944. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  18945. const compareHour = compareDate.hour();
  18946. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  18947. return union(defaultDisable, nextDisable);
  18948. };
  18949. const disabledMinutes_ = (hour, role, compare) => {
  18950. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  18951. const isStart = role === "start";
  18952. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  18953. const compareHour = compareDate.hour();
  18954. if (hour !== compareHour) {
  18955. return defaultDisable;
  18956. }
  18957. const compareMinute = compareDate.minute();
  18958. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  18959. return union(defaultDisable, nextDisable);
  18960. };
  18961. const disabledSeconds_ = (hour, minute, role, compare) => {
  18962. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  18963. const isStart = role === "start";
  18964. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  18965. const compareHour = compareDate.hour();
  18966. const compareMinute = compareDate.minute();
  18967. if (hour !== compareHour || minute !== compareMinute) {
  18968. return defaultDisable;
  18969. }
  18970. const compareSecond = compareDate.second();
  18971. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  18972. return union(defaultDisable, nextDisable);
  18973. };
  18974. const getRangeAvailableTime = ([start, end]) => {
  18975. return [
  18976. getAvailableTime(start, "start", true, end),
  18977. getAvailableTime(end, "end", false, start)
  18978. ];
  18979. };
  18980. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  18981. const {
  18982. timePickerOptions,
  18983. getAvailableTime,
  18984. onSetOption
  18985. } = useTimePanel({
  18986. getAvailableHours,
  18987. getAvailableMinutes,
  18988. getAvailableSeconds
  18989. });
  18990. const parseUserInput = (days) => {
  18991. if (!days)
  18992. return null;
  18993. if (isArray$1(days)) {
  18994. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  18995. }
  18996. return dayjs(days, props.format).locale(lang.value);
  18997. };
  18998. const formatToString = (days) => {
  18999. if (!days)
  19000. return null;
  19001. if (isArray$1(days)) {
  19002. return days.map((d) => d.format(props.format));
  19003. }
  19004. return days.format(props.format);
  19005. };
  19006. const getDefaultValue = () => {
  19007. if (isArray$1(defaultValue)) {
  19008. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  19009. }
  19010. const defaultDay = dayjs(defaultValue).locale(lang.value);
  19011. return [defaultDay, defaultDay.add(60, "m")];
  19012. };
  19013. emit("set-picker-option", ["formatToString", formatToString]);
  19014. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19015. emit("set-picker-option", ["isValidValue", isValidValue]);
  19016. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19017. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19018. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19019. return (_ctx, _cache) => {
  19020. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  19021. key: 0,
  19022. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  19023. }, [
  19024. vue.createElementVNode("div", {
  19025. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  19026. }, [
  19027. vue.createElementVNode("div", {
  19028. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19029. }, [
  19030. vue.createElementVNode("div", {
  19031. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19032. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  19033. vue.createElementVNode("div", {
  19034. class: vue.normalizeClass([
  19035. vue.unref(nsTime).be("range-picker", "body"),
  19036. vue.unref(nsTime).be("panel", "content"),
  19037. vue.unref(nsTime).is("arrow", vue.unref(arrowControl)),
  19038. { "has-seconds": vue.unref(showSeconds) }
  19039. ])
  19040. }, [
  19041. vue.createVNode(TimeSpinner, {
  19042. ref: "minSpinner",
  19043. role: "start",
  19044. "show-seconds": vue.unref(showSeconds),
  19045. "am-pm-mode": vue.unref(amPmMode),
  19046. "arrow-control": vue.unref(arrowControl),
  19047. "spinner-date": vue.unref(startTime),
  19048. "disabled-hours": disabledHours_,
  19049. "disabled-minutes": disabledMinutes_,
  19050. "disabled-seconds": disabledSeconds_,
  19051. onChange: handleMinChange,
  19052. onSetOption: vue.unref(onSetOption),
  19053. onSelectRange: setMinSelectionRange
  19054. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19055. ], 2)
  19056. ], 2),
  19057. vue.createElementVNode("div", {
  19058. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19059. }, [
  19060. vue.createElementVNode("div", {
  19061. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19062. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  19063. vue.createElementVNode("div", {
  19064. class: vue.normalizeClass([
  19065. vue.unref(nsTime).be("range-picker", "body"),
  19066. vue.unref(nsTime).be("panel", "content"),
  19067. vue.unref(nsTime).is("arrow", vue.unref(arrowControl)),
  19068. { "has-seconds": vue.unref(showSeconds) }
  19069. ])
  19070. }, [
  19071. vue.createVNode(TimeSpinner, {
  19072. ref: "maxSpinner",
  19073. role: "end",
  19074. "show-seconds": vue.unref(showSeconds),
  19075. "am-pm-mode": vue.unref(amPmMode),
  19076. "arrow-control": vue.unref(arrowControl),
  19077. "spinner-date": vue.unref(endTime),
  19078. "disabled-hours": disabledHours_,
  19079. "disabled-minutes": disabledMinutes_,
  19080. "disabled-seconds": disabledSeconds_,
  19081. onChange: handleMaxChange,
  19082. onSetOption: vue.unref(onSetOption),
  19083. onSelectRange: setMaxSelectionRange
  19084. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19085. ], 2)
  19086. ], 2)
  19087. ], 2),
  19088. vue.createElementVNode("div", {
  19089. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  19090. }, [
  19091. vue.createElementVNode("button", {
  19092. type: "button",
  19093. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  19094. onClick: _cache[0] || (_cache[0] = ($event) => handleCancel())
  19095. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  19096. vue.createElementVNode("button", {
  19097. type: "button",
  19098. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  19099. disabled: vue.unref(btnConfirmDisabled),
  19100. onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm())
  19101. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, _hoisted_1$W)
  19102. ], 2)
  19103. ], 2)) : vue.createCommentVNode("v-if", true);
  19104. };
  19105. }
  19106. });
  19107. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "panel-time-range.vue"]]);
  19108. dayjs.extend(customParseFormat);
  19109. var TimePicker = vue.defineComponent({
  19110. name: "ElTimePicker",
  19111. install: null,
  19112. props: {
  19113. ...timePickerDefaultProps,
  19114. isRange: {
  19115. type: Boolean,
  19116. default: false
  19117. }
  19118. },
  19119. emits: ["update:modelValue"],
  19120. setup(props, ctx) {
  19121. const commonPicker = vue.ref();
  19122. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  19123. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  19124. vue.provide("ElPopperOptions", props.popperOptions);
  19125. ctx.expose({
  19126. focus: (e) => {
  19127. var _a;
  19128. (_a = commonPicker.value) == null ? void 0 : _a.handleFocusInput(e);
  19129. },
  19130. blur: (e) => {
  19131. var _a;
  19132. (_a = commonPicker.value) == null ? void 0 : _a.handleBlurInput(e);
  19133. },
  19134. handleOpen: () => {
  19135. var _a;
  19136. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  19137. },
  19138. handleClose: () => {
  19139. var _a;
  19140. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  19141. }
  19142. });
  19143. return () => {
  19144. var _a;
  19145. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  19146. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  19147. "ref": commonPicker,
  19148. "type": type,
  19149. "format": format,
  19150. "onUpdate:modelValue": modelUpdater
  19151. }), {
  19152. default: (props2) => vue.createVNode(Panel, props2, null)
  19153. });
  19154. };
  19155. }
  19156. });
  19157. const _TimePicker = TimePicker;
  19158. _TimePicker.install = (app) => {
  19159. app.component(_TimePicker.name, _TimePicker);
  19160. };
  19161. const ElTimePicker = _TimePicker;
  19162. const getPrevMonthLastDays = (date, count) => {
  19163. const lastDay = date.subtract(1, "month").endOf("month").date();
  19164. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19165. };
  19166. const getMonthDays = (date) => {
  19167. const days = date.daysInMonth();
  19168. return rangeArr(days).map((_, index) => index + 1);
  19169. };
  19170. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19171. const start = index * 7;
  19172. return days.slice(start, start + 7);
  19173. });
  19174. const dateTableProps = buildProps({
  19175. selectedDay: {
  19176. type: definePropType(Object)
  19177. },
  19178. range: {
  19179. type: definePropType(Array)
  19180. },
  19181. date: {
  19182. type: definePropType(Object),
  19183. required: true
  19184. },
  19185. hideHeader: {
  19186. type: Boolean
  19187. }
  19188. });
  19189. const dateTableEmits = {
  19190. pick: (value) => isObject$1(value)
  19191. };
  19192. var localeData$1 = {exports: {}};
  19193. (function(module, exports) {
  19194. !function(n, e) {
  19195. module.exports = e() ;
  19196. }(commonjsGlobal, function() {
  19197. return function(n, e, t) {
  19198. var r = e.prototype, o = function(n2) {
  19199. return n2 && (n2.indexOf ? n2 : n2.s);
  19200. }, u = function(n2, e2, t2, r2, u2) {
  19201. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  19202. return n3.slice(0, r2);
  19203. });
  19204. if (!u2)
  19205. return f;
  19206. var d = i2.weekStart;
  19207. return f.map(function(n3, e3) {
  19208. return f[(e3 + (d || 0)) % 7];
  19209. });
  19210. }, i = function() {
  19211. return t.Ls[t.locale()];
  19212. }, a = function(n2, e2) {
  19213. return n2.formats[e2] || function(n3) {
  19214. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  19215. return e3 || t2.slice(1);
  19216. });
  19217. }(n2.formats[e2.toUpperCase()]);
  19218. }, s = function() {
  19219. var n2 = this;
  19220. return { months: function(e2) {
  19221. return e2 ? e2.format("MMMM") : u(n2, "months");
  19222. }, monthsShort: function(e2) {
  19223. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  19224. }, firstDayOfWeek: function() {
  19225. return n2.$locale().weekStart || 0;
  19226. }, weekdays: function(e2) {
  19227. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  19228. }, weekdaysMin: function(e2) {
  19229. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  19230. }, weekdaysShort: function(e2) {
  19231. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  19232. }, longDateFormat: function(e2) {
  19233. return a(n2.$locale(), e2);
  19234. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  19235. };
  19236. r.localeData = function() {
  19237. return s.bind(this)();
  19238. }, t.localeData = function() {
  19239. var n2 = i();
  19240. return { firstDayOfWeek: function() {
  19241. return n2.weekStart || 0;
  19242. }, weekdays: function() {
  19243. return t.weekdays();
  19244. }, weekdaysShort: function() {
  19245. return t.weekdaysShort();
  19246. }, weekdaysMin: function() {
  19247. return t.weekdaysMin();
  19248. }, months: function() {
  19249. return t.months();
  19250. }, monthsShort: function() {
  19251. return t.monthsShort();
  19252. }, longDateFormat: function(e2) {
  19253. return a(n2, e2);
  19254. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  19255. }, t.months = function() {
  19256. return u(i(), "months");
  19257. }, t.monthsShort = function() {
  19258. return u(i(), "monthsShort", "months", 3);
  19259. }, t.weekdays = function(n2) {
  19260. return u(i(), "weekdays", null, null, n2);
  19261. }, t.weekdaysShort = function(n2) {
  19262. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  19263. }, t.weekdaysMin = function(n2) {
  19264. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  19265. };
  19266. };
  19267. });
  19268. })(localeData$1);
  19269. var localeData = localeData$1.exports;
  19270. const useDateTable = (props, emit) => {
  19271. dayjs.extend(localeData);
  19272. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  19273. const { t, lang } = useLocale();
  19274. const now = dayjs().locale(lang.value);
  19275. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  19276. const rows = vue.computed(() => {
  19277. let days = [];
  19278. if (isInRange.value) {
  19279. const [start, end] = props.range;
  19280. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19281. text: start.date() + index,
  19282. type: "current"
  19283. }));
  19284. let remaining = currentMonthRange.length % 7;
  19285. remaining = remaining === 0 ? 0 : 7 - remaining;
  19286. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19287. text: index + 1,
  19288. type: "next"
  19289. }));
  19290. days = currentMonthRange.concat(nextMonthRange);
  19291. } else {
  19292. const firstDay = props.date.startOf("month").day();
  19293. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19294. text: day,
  19295. type: "prev"
  19296. }));
  19297. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19298. text: day,
  19299. type: "current"
  19300. }));
  19301. days = [...prevMonthDays, ...currentMonthDays];
  19302. const remaining = 7 - (days.length % 7 || 7);
  19303. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  19304. text: index + 1,
  19305. type: "next"
  19306. }));
  19307. days = days.concat(nextMonthDays);
  19308. }
  19309. return toNestedArr(days);
  19310. });
  19311. const weekDays = vue.computed(() => {
  19312. const start = firstDayOfWeek;
  19313. if (start === 0) {
  19314. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19315. } else {
  19316. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19317. }
  19318. });
  19319. const getFormattedDate = (day, type) => {
  19320. switch (type) {
  19321. case "prev":
  19322. return props.date.startOf("month").subtract(1, "month").date(day);
  19323. case "next":
  19324. return props.date.startOf("month").add(1, "month").date(day);
  19325. case "current":
  19326. return props.date.date(day);
  19327. }
  19328. };
  19329. const handlePickDay = ({ text, type }) => {
  19330. const date = getFormattedDate(text, type);
  19331. emit("pick", date);
  19332. };
  19333. const getSlotData = ({ text, type }) => {
  19334. const day = getFormattedDate(text, type);
  19335. return {
  19336. isSelected: day.isSame(props.selectedDay),
  19337. type: `${type}-month`,
  19338. day: day.format("YYYY-MM-DD"),
  19339. date: day.toDate()
  19340. };
  19341. };
  19342. return {
  19343. now,
  19344. isInRange,
  19345. rows,
  19346. weekDays,
  19347. getFormattedDate,
  19348. handlePickDay,
  19349. getSlotData
  19350. };
  19351. };
  19352. const _hoisted_1$V = { key: 0 };
  19353. const _hoisted_2$B = ["onClick"];
  19354. const __default__$1f = vue.defineComponent({
  19355. name: "DateTable"
  19356. });
  19357. const _sfc_main$1R = /* @__PURE__ */ vue.defineComponent({
  19358. ...__default__$1f,
  19359. props: dateTableProps,
  19360. emits: dateTableEmits,
  19361. setup(__props, { expose, emit }) {
  19362. const props = __props;
  19363. const {
  19364. isInRange,
  19365. now,
  19366. rows,
  19367. weekDays,
  19368. getFormattedDate,
  19369. handlePickDay,
  19370. getSlotData
  19371. } = useDateTable(props, emit);
  19372. const nsTable = useNamespace("calendar-table");
  19373. const nsDay = useNamespace("calendar-day");
  19374. const getCellClass = ({ text, type }) => {
  19375. const classes = [type];
  19376. if (type === "current") {
  19377. const date = getFormattedDate(text, type);
  19378. if (date.isSame(props.selectedDay, "day")) {
  19379. classes.push(nsDay.is("selected"));
  19380. }
  19381. if (date.isSame(now, "day")) {
  19382. classes.push(nsDay.is("today"));
  19383. }
  19384. }
  19385. return classes;
  19386. };
  19387. expose({
  19388. getFormattedDate
  19389. });
  19390. return (_ctx, _cache) => {
  19391. return vue.openBlock(), vue.createElementBlock("table", {
  19392. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  19393. cellspacing: "0",
  19394. cellpadding: "0"
  19395. }, [
  19396. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", _hoisted_1$V, [
  19397. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  19398. return vue.openBlock(), vue.createElementBlock("th", { key: day }, vue.toDisplayString(day), 1);
  19399. }), 128))
  19400. ])) : vue.createCommentVNode("v-if", true),
  19401. vue.createElementVNode("tbody", null, [
  19402. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  19403. return vue.openBlock(), vue.createElementBlock("tr", {
  19404. key: index,
  19405. class: vue.normalizeClass({
  19406. [vue.unref(nsTable).e("row")]: true,
  19407. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  19408. })
  19409. }, [
  19410. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  19411. return vue.openBlock(), vue.createElementBlock("td", {
  19412. key,
  19413. class: vue.normalizeClass(getCellClass(cell)),
  19414. onClick: ($event) => vue.unref(handlePickDay)(cell)
  19415. }, [
  19416. vue.createElementVNode("div", {
  19417. class: vue.normalizeClass(vue.unref(nsDay).b())
  19418. }, [
  19419. vue.renderSlot(_ctx.$slots, "date-cell", {
  19420. data: vue.unref(getSlotData)(cell)
  19421. }, () => [
  19422. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  19423. ])
  19424. ], 2)
  19425. ], 10, _hoisted_2$B);
  19426. }), 128))
  19427. ], 2);
  19428. }), 128))
  19429. ])
  19430. ], 2);
  19431. };
  19432. }
  19433. });
  19434. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["__file", "date-table.vue"]]);
  19435. const adjacentMonth = (start, end) => {
  19436. const firstMonthLastDay = start.endOf("month");
  19437. const lastMonthFirstDay = end.startOf("month");
  19438. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  19439. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19440. return [
  19441. [start, firstMonthLastDay],
  19442. [lastMonthStartDay.startOf("week"), end]
  19443. ];
  19444. };
  19445. const threeConsecutiveMonth = (start, end) => {
  19446. const firstMonthLastDay = start.endOf("month");
  19447. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  19448. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  19449. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  19450. const lastMonthFirstDay = end.startOf("month");
  19451. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19452. return [
  19453. [start, firstMonthLastDay],
  19454. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  19455. [lastMonthStartDay.startOf("week"), end]
  19456. ];
  19457. };
  19458. const useCalendar = (props, emit, componentName) => {
  19459. const slots = vue.useSlots();
  19460. const { lang } = useLocale();
  19461. const selectedDay = vue.ref();
  19462. const now = dayjs().locale(lang.value);
  19463. const realSelectedDay = vue.computed({
  19464. get() {
  19465. if (!props.modelValue)
  19466. return selectedDay.value;
  19467. return date.value;
  19468. },
  19469. set(val) {
  19470. if (!val)
  19471. return;
  19472. selectedDay.value = val;
  19473. const result = val.toDate();
  19474. emit(INPUT_EVENT, result);
  19475. emit(UPDATE_MODEL_EVENT, result);
  19476. }
  19477. });
  19478. const validatedRange = vue.computed(() => {
  19479. if (!props.range)
  19480. return [];
  19481. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  19482. const [startDayjs, endDayjs] = rangeArrDayjs;
  19483. if (startDayjs.isAfter(endDayjs)) {
  19484. return [];
  19485. }
  19486. if (startDayjs.isSame(endDayjs, "month")) {
  19487. return calculateValidatedDateRange(startDayjs, endDayjs);
  19488. } else {
  19489. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  19490. return [];
  19491. }
  19492. return calculateValidatedDateRange(startDayjs, endDayjs);
  19493. }
  19494. });
  19495. const date = vue.computed(() => {
  19496. if (!props.modelValue) {
  19497. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  19498. } else {
  19499. return dayjs(props.modelValue).locale(lang.value);
  19500. }
  19501. });
  19502. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  19503. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  19504. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  19505. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  19506. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  19507. const firstDay = startDayjs.startOf("week");
  19508. const lastDay = endDayjs.endOf("week");
  19509. const firstMonth = firstDay.get("month");
  19510. const lastMonth = lastDay.get("month");
  19511. if (firstMonth === lastMonth) {
  19512. return [[firstDay, lastDay]];
  19513. } else if ((firstMonth + 1) % 12 === lastMonth) {
  19514. return adjacentMonth(firstDay, lastDay);
  19515. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  19516. return threeConsecutiveMonth(firstDay, lastDay);
  19517. } else {
  19518. return [];
  19519. }
  19520. };
  19521. const pickDay = (day) => {
  19522. realSelectedDay.value = day;
  19523. };
  19524. const selectDate = (type) => {
  19525. const dateMap = {
  19526. "prev-month": prevMonthDayjs.value,
  19527. "next-month": nextMonthDayjs.value,
  19528. "prev-year": prevYearDayjs.value,
  19529. "next-year": nextYearDayjs.value,
  19530. today: now
  19531. };
  19532. const day = dateMap[type];
  19533. if (!day.isSame(date.value, "day")) {
  19534. pickDay(day);
  19535. }
  19536. };
  19537. useDeprecated({
  19538. from: '"dateCell"',
  19539. replacement: '"date-cell"',
  19540. scope: "ElCalendar",
  19541. version: "2.3.0",
  19542. ref: "https://element-plus.org/en-US/component/calendar.html#slots",
  19543. type: "Slot"
  19544. }, vue.computed(() => !!slots.dateCell));
  19545. return {
  19546. calculateValidatedDateRange,
  19547. date,
  19548. realSelectedDay,
  19549. pickDay,
  19550. selectDate,
  19551. validatedRange
  19552. };
  19553. };
  19554. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  19555. const calendarProps = buildProps({
  19556. modelValue: {
  19557. type: Date
  19558. },
  19559. range: {
  19560. type: definePropType(Array),
  19561. validator: isValidRange$1
  19562. }
  19563. });
  19564. const calendarEmits = {
  19565. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  19566. [INPUT_EVENT]: (value) => isDate$1(value)
  19567. };
  19568. const COMPONENT_NAME$g = "ElCalendar";
  19569. const __default__$1e = vue.defineComponent({
  19570. name: COMPONENT_NAME$g
  19571. });
  19572. const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
  19573. ...__default__$1e,
  19574. props: calendarProps,
  19575. emits: calendarEmits,
  19576. setup(__props, { expose, emit }) {
  19577. const props = __props;
  19578. const ns = useNamespace("calendar");
  19579. const {
  19580. calculateValidatedDateRange,
  19581. date,
  19582. pickDay,
  19583. realSelectedDay,
  19584. selectDate,
  19585. validatedRange
  19586. } = useCalendar(props, emit);
  19587. const { t } = useLocale();
  19588. const i18nDate = vue.computed(() => {
  19589. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  19590. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  19591. });
  19592. expose({
  19593. selectedDay: realSelectedDay,
  19594. pickDay,
  19595. selectDate,
  19596. calculateValidatedDateRange
  19597. });
  19598. return (_ctx, _cache) => {
  19599. return vue.openBlock(), vue.createElementBlock("div", {
  19600. class: vue.normalizeClass(vue.unref(ns).b())
  19601. }, [
  19602. vue.createElementVNode("div", {
  19603. class: vue.normalizeClass(vue.unref(ns).e("header"))
  19604. }, [
  19605. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  19606. vue.createElementVNode("div", {
  19607. class: vue.normalizeClass(vue.unref(ns).e("title"))
  19608. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  19609. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  19610. key: 0,
  19611. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  19612. }, [
  19613. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  19614. default: vue.withCtx(() => [
  19615. vue.createVNode(vue.unref(ElButton), {
  19616. size: "small",
  19617. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(selectDate)("prev-month"))
  19618. }, {
  19619. default: vue.withCtx(() => [
  19620. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  19621. ]),
  19622. _: 1
  19623. }),
  19624. vue.createVNode(vue.unref(ElButton), {
  19625. size: "small",
  19626. onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(selectDate)("today"))
  19627. }, {
  19628. default: vue.withCtx(() => [
  19629. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  19630. ]),
  19631. _: 1
  19632. }),
  19633. vue.createVNode(vue.unref(ElButton), {
  19634. size: "small",
  19635. onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(selectDate)("next-month"))
  19636. }, {
  19637. default: vue.withCtx(() => [
  19638. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  19639. ]),
  19640. _: 1
  19641. })
  19642. ]),
  19643. _: 1
  19644. })
  19645. ], 2)) : vue.createCommentVNode("v-if", true)
  19646. ])
  19647. ], 2),
  19648. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  19649. key: 0,
  19650. class: vue.normalizeClass(vue.unref(ns).e("body"))
  19651. }, [
  19652. vue.createVNode(DateTable$1, {
  19653. date: vue.unref(date),
  19654. "selected-day": vue.unref(realSelectedDay),
  19655. onPick: vue.unref(pickDay)
  19656. }, vue.createSlots({ _: 2 }, [
  19657. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  19658. name: "date-cell",
  19659. fn: vue.withCtx((data) => [
  19660. _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data)))
  19661. ])
  19662. } : void 0
  19663. ]), 1032, ["date", "selected-day", "onPick"])
  19664. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  19665. key: 1,
  19666. class: vue.normalizeClass(vue.unref(ns).e("body"))
  19667. }, [
  19668. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  19669. return vue.openBlock(), vue.createBlock(DateTable$1, {
  19670. key: index,
  19671. date: range_[0],
  19672. "selected-day": vue.unref(realSelectedDay),
  19673. range: range_,
  19674. "hide-header": index !== 0,
  19675. onPick: vue.unref(pickDay)
  19676. }, vue.createSlots({ _: 2 }, [
  19677. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  19678. name: "date-cell",
  19679. fn: vue.withCtx((data) => [
  19680. _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data)))
  19681. ])
  19682. } : void 0
  19683. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  19684. }), 128))
  19685. ], 2))
  19686. ], 2);
  19687. };
  19688. }
  19689. });
  19690. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "calendar.vue"]]);
  19691. const ElCalendar = withInstall(Calendar);
  19692. const cardProps = buildProps({
  19693. header: {
  19694. type: String,
  19695. default: ""
  19696. },
  19697. bodyStyle: {
  19698. type: definePropType([String, Object, Array]),
  19699. default: ""
  19700. },
  19701. shadow: {
  19702. type: String,
  19703. values: ["always", "hover", "never"],
  19704. default: "always"
  19705. }
  19706. });
  19707. const __default__$1d = vue.defineComponent({
  19708. name: "ElCard"
  19709. });
  19710. const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
  19711. ...__default__$1d,
  19712. props: cardProps,
  19713. setup(__props) {
  19714. const ns = useNamespace("card");
  19715. return (_ctx, _cache) => {
  19716. return vue.openBlock(), vue.createElementBlock("div", {
  19717. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)])
  19718. }, [
  19719. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  19720. key: 0,
  19721. class: vue.normalizeClass(vue.unref(ns).e("header"))
  19722. }, [
  19723. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  19724. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  19725. ])
  19726. ], 2)) : vue.createCommentVNode("v-if", true),
  19727. vue.createElementVNode("div", {
  19728. class: vue.normalizeClass(vue.unref(ns).e("body")),
  19729. style: vue.normalizeStyle(_ctx.bodyStyle)
  19730. }, [
  19731. vue.renderSlot(_ctx.$slots, "default")
  19732. ], 6)
  19733. ], 2);
  19734. };
  19735. }
  19736. });
  19737. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "card.vue"]]);
  19738. const ElCard = withInstall(Card);
  19739. const carouselProps = buildProps({
  19740. initialIndex: {
  19741. type: Number,
  19742. default: 0
  19743. },
  19744. height: {
  19745. type: String,
  19746. default: ""
  19747. },
  19748. trigger: {
  19749. type: String,
  19750. values: ["hover", "click"],
  19751. default: "hover"
  19752. },
  19753. autoplay: {
  19754. type: Boolean,
  19755. default: true
  19756. },
  19757. interval: {
  19758. type: Number,
  19759. default: 3e3
  19760. },
  19761. indicatorPosition: {
  19762. type: String,
  19763. values: ["", "none", "outside"],
  19764. default: ""
  19765. },
  19766. arrow: {
  19767. type: String,
  19768. values: ["always", "hover", "never"],
  19769. default: "hover"
  19770. },
  19771. type: {
  19772. type: String,
  19773. values: ["", "card"],
  19774. default: ""
  19775. },
  19776. loop: {
  19777. type: Boolean,
  19778. default: true
  19779. },
  19780. direction: {
  19781. type: String,
  19782. values: ["horizontal", "vertical"],
  19783. default: "horizontal"
  19784. },
  19785. pauseOnHover: {
  19786. type: Boolean,
  19787. default: true
  19788. }
  19789. });
  19790. const carouselEmits = {
  19791. change: (current, prev) => [current, prev].every(isNumber$1)
  19792. };
  19793. const carouselContextKey = Symbol("carouselContextKey");
  19794. const THROTTLE_TIME = 300;
  19795. const useCarousel = (props, emit, componentName) => {
  19796. const {
  19797. children: items,
  19798. addChild: addItem,
  19799. removeChild: removeItem
  19800. } = useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem");
  19801. const activeIndex = vue.ref(-1);
  19802. const timer = vue.ref(null);
  19803. const hover = vue.ref(false);
  19804. const root = vue.ref();
  19805. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  19806. const hasLabel = vue.computed(() => {
  19807. return items.value.some((item) => item.props.label.toString().length > 0);
  19808. });
  19809. const isCardType = vue.computed(() => props.type === "card");
  19810. const isVertical = vue.computed(() => props.direction === "vertical");
  19811. const throttledArrowClick = throttle((index) => {
  19812. setActiveItem(index);
  19813. }, THROTTLE_TIME, { trailing: true });
  19814. const throttledIndicatorHover = throttle((index) => {
  19815. handleIndicatorHover(index);
  19816. }, THROTTLE_TIME);
  19817. function pauseTimer() {
  19818. if (timer.value) {
  19819. clearInterval(timer.value);
  19820. timer.value = null;
  19821. }
  19822. }
  19823. function startTimer() {
  19824. if (props.interval <= 0 || !props.autoplay || timer.value)
  19825. return;
  19826. timer.value = setInterval(() => playSlides(), props.interval);
  19827. }
  19828. const playSlides = () => {
  19829. if (activeIndex.value < items.value.length - 1) {
  19830. activeIndex.value = activeIndex.value + 1;
  19831. } else if (props.loop) {
  19832. activeIndex.value = 0;
  19833. }
  19834. };
  19835. function setActiveItem(index) {
  19836. if (isString$1(index)) {
  19837. const filteredItems = items.value.filter((item) => item.props.name === index);
  19838. if (filteredItems.length > 0) {
  19839. index = items.value.indexOf(filteredItems[0]);
  19840. }
  19841. }
  19842. index = Number(index);
  19843. if (Number.isNaN(index) || index !== Math.floor(index)) {
  19844. return;
  19845. }
  19846. const itemCount = items.value.length;
  19847. const oldIndex = activeIndex.value;
  19848. if (index < 0) {
  19849. activeIndex.value = props.loop ? itemCount - 1 : 0;
  19850. } else if (index >= itemCount) {
  19851. activeIndex.value = props.loop ? 0 : itemCount - 1;
  19852. } else {
  19853. activeIndex.value = index;
  19854. }
  19855. if (oldIndex === activeIndex.value) {
  19856. resetItemPosition(oldIndex);
  19857. }
  19858. resetTimer();
  19859. }
  19860. function resetItemPosition(oldIndex) {
  19861. items.value.forEach((item, index) => {
  19862. item.translateItem(index, activeIndex.value, oldIndex);
  19863. });
  19864. }
  19865. function itemInStage(item, index) {
  19866. var _a, _b, _c, _d;
  19867. const _items = vue.unref(items);
  19868. const itemCount = _items.length;
  19869. if (itemCount === 0 || !item.states.inStage)
  19870. return false;
  19871. const nextItemIndex = index + 1;
  19872. const prevItemIndex = index - 1;
  19873. const lastItemIndex = itemCount - 1;
  19874. const isLastItemActive = _items[lastItemIndex].states.active;
  19875. const isFirstItemActive = _items[0].states.active;
  19876. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  19877. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  19878. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  19879. return "left";
  19880. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  19881. return "right";
  19882. }
  19883. return false;
  19884. }
  19885. function handleMouseEnter() {
  19886. hover.value = true;
  19887. if (props.pauseOnHover) {
  19888. pauseTimer();
  19889. }
  19890. }
  19891. function handleMouseLeave() {
  19892. hover.value = false;
  19893. startTimer();
  19894. }
  19895. function handleButtonEnter(arrow) {
  19896. if (vue.unref(isVertical))
  19897. return;
  19898. items.value.forEach((item, index) => {
  19899. if (arrow === itemInStage(item, index)) {
  19900. item.states.hover = true;
  19901. }
  19902. });
  19903. }
  19904. function handleButtonLeave() {
  19905. if (vue.unref(isVertical))
  19906. return;
  19907. items.value.forEach((item) => {
  19908. item.states.hover = false;
  19909. });
  19910. }
  19911. function handleIndicatorClick(index) {
  19912. activeIndex.value = index;
  19913. }
  19914. function handleIndicatorHover(index) {
  19915. if (props.trigger === "hover" && index !== activeIndex.value) {
  19916. activeIndex.value = index;
  19917. }
  19918. }
  19919. function prev() {
  19920. setActiveItem(activeIndex.value - 1);
  19921. }
  19922. function next() {
  19923. setActiveItem(activeIndex.value + 1);
  19924. }
  19925. function resetTimer() {
  19926. pauseTimer();
  19927. startTimer();
  19928. }
  19929. vue.watch(() => activeIndex.value, (current, prev2) => {
  19930. resetItemPosition(prev2);
  19931. if (prev2 > -1) {
  19932. emit("change", current, prev2);
  19933. }
  19934. });
  19935. vue.watch(() => props.autoplay, (autoplay) => {
  19936. autoplay ? startTimer() : pauseTimer();
  19937. });
  19938. vue.watch(() => props.loop, () => {
  19939. setActiveItem(activeIndex.value);
  19940. });
  19941. vue.watch(() => props.interval, () => {
  19942. resetTimer();
  19943. });
  19944. vue.watch(() => items.value, () => {
  19945. if (items.value.length > 0)
  19946. setActiveItem(props.initialIndex);
  19947. });
  19948. const resizeObserver = vue.shallowRef();
  19949. vue.onMounted(() => {
  19950. resizeObserver.value = useResizeObserver(root.value, () => {
  19951. resetItemPosition();
  19952. });
  19953. startTimer();
  19954. });
  19955. vue.onBeforeUnmount(() => {
  19956. pauseTimer();
  19957. if (root.value && resizeObserver.value)
  19958. resizeObserver.value.stop();
  19959. });
  19960. vue.provide(carouselContextKey, {
  19961. root,
  19962. isCardType,
  19963. isVertical,
  19964. items,
  19965. loop: props.loop,
  19966. addItem,
  19967. removeItem,
  19968. setActiveItem
  19969. });
  19970. return {
  19971. root,
  19972. activeIndex,
  19973. arrowDisplay,
  19974. hasLabel,
  19975. hover,
  19976. isCardType,
  19977. items,
  19978. handleButtonEnter,
  19979. handleButtonLeave,
  19980. handleIndicatorClick,
  19981. handleMouseEnter,
  19982. handleMouseLeave,
  19983. setActiveItem,
  19984. prev,
  19985. next,
  19986. throttledArrowClick,
  19987. throttledIndicatorHover
  19988. };
  19989. };
  19990. const _hoisted_1$U = ["onMouseenter", "onClick"];
  19991. const _hoisted_2$A = { key: 0 };
  19992. const COMPONENT_NAME$f = "ElCarousel";
  19993. const __default__$1c = vue.defineComponent({
  19994. name: COMPONENT_NAME$f
  19995. });
  19996. const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
  19997. ...__default__$1c,
  19998. props: carouselProps,
  19999. emits: carouselEmits,
  20000. setup(__props, { expose, emit }) {
  20001. const props = __props;
  20002. const {
  20003. root,
  20004. activeIndex,
  20005. arrowDisplay,
  20006. hasLabel,
  20007. hover,
  20008. isCardType,
  20009. items,
  20010. handleButtonEnter,
  20011. handleButtonLeave,
  20012. handleIndicatorClick,
  20013. handleMouseEnter,
  20014. handleMouseLeave,
  20015. setActiveItem,
  20016. prev,
  20017. next,
  20018. throttledArrowClick,
  20019. throttledIndicatorHover
  20020. } = useCarousel(props, emit);
  20021. const ns = useNamespace("carousel");
  20022. const carouselClasses = vue.computed(() => {
  20023. const classes = [ns.b(), ns.m(props.direction)];
  20024. if (vue.unref(isCardType)) {
  20025. classes.push(ns.m("card"));
  20026. }
  20027. return classes;
  20028. });
  20029. const indicatorsClasses = vue.computed(() => {
  20030. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  20031. if (vue.unref(hasLabel)) {
  20032. classes.push(ns.em("indicators", "labels"));
  20033. }
  20034. if (props.indicatorPosition === "outside" || vue.unref(isCardType)) {
  20035. classes.push(ns.em("indicators", "outside"));
  20036. }
  20037. return classes;
  20038. });
  20039. expose({
  20040. setActiveItem,
  20041. prev,
  20042. next
  20043. });
  20044. return (_ctx, _cache) => {
  20045. return vue.openBlock(), vue.createElementBlock("div", {
  20046. ref_key: "root",
  20047. ref: root,
  20048. class: vue.normalizeClass(vue.unref(carouselClasses)),
  20049. onMouseenter: _cache[6] || (_cache[6] = vue.withModifiers((...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args), ["stop"])),
  20050. onMouseleave: _cache[7] || (_cache[7] = vue.withModifiers((...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args), ["stop"]))
  20051. }, [
  20052. vue.createElementVNode("div", {
  20053. class: vue.normalizeClass(vue.unref(ns).e("container")),
  20054. style: vue.normalizeStyle({ height: _ctx.height })
  20055. }, [
  20056. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20057. key: 0,
  20058. name: "carousel-arrow-left",
  20059. persisted: ""
  20060. }, {
  20061. default: vue.withCtx(() => [
  20062. vue.withDirectives(vue.createElementVNode("button", {
  20063. type: "button",
  20064. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  20065. onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(handleButtonEnter)("left")),
  20066. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  20067. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"]))
  20068. }, [
  20069. vue.createVNode(vue.unref(ElIcon), null, {
  20070. default: vue.withCtx(() => [
  20071. vue.createVNode(vue.unref(arrow_left_default))
  20072. ]),
  20073. _: 1
  20074. })
  20075. ], 34), [
  20076. [
  20077. vue.vShow,
  20078. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
  20079. ]
  20080. ])
  20081. ]),
  20082. _: 1
  20083. })) : vue.createCommentVNode("v-if", true),
  20084. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20085. key: 1,
  20086. name: "carousel-arrow-right",
  20087. persisted: ""
  20088. }, {
  20089. default: vue.withCtx(() => [
  20090. vue.withDirectives(vue.createElementVNode("button", {
  20091. type: "button",
  20092. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  20093. onMouseenter: _cache[3] || (_cache[3] = ($event) => vue.unref(handleButtonEnter)("right")),
  20094. onMouseleave: _cache[4] || (_cache[4] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  20095. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"]))
  20096. }, [
  20097. vue.createVNode(vue.unref(ElIcon), null, {
  20098. default: vue.withCtx(() => [
  20099. vue.createVNode(vue.unref(arrow_right_default))
  20100. ]),
  20101. _: 1
  20102. })
  20103. ], 34), [
  20104. [
  20105. vue.vShow,
  20106. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  20107. ]
  20108. ])
  20109. ]),
  20110. _: 1
  20111. })) : vue.createCommentVNode("v-if", true),
  20112. vue.renderSlot(_ctx.$slots, "default")
  20113. ], 6),
  20114. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  20115. key: 0,
  20116. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  20117. }, [
  20118. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  20119. return vue.openBlock(), vue.createElementBlock("li", {
  20120. key: index,
  20121. class: vue.normalizeClass([
  20122. vue.unref(ns).e("indicator"),
  20123. vue.unref(ns).em("indicator", _ctx.direction),
  20124. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  20125. ]),
  20126. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  20127. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  20128. }, [
  20129. vue.createElementVNode("button", {
  20130. class: vue.normalizeClass(vue.unref(ns).e("button"))
  20131. }, [
  20132. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$A, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  20133. ], 2)
  20134. ], 42, _hoisted_1$U);
  20135. }), 128))
  20136. ], 2)) : vue.createCommentVNode("v-if", true)
  20137. ], 34);
  20138. };
  20139. }
  20140. });
  20141. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "carousel.vue"]]);
  20142. const carouselItemProps = buildProps({
  20143. name: { type: String, default: "" },
  20144. label: {
  20145. type: [String, Number],
  20146. default: ""
  20147. }
  20148. });
  20149. const useCarouselItem = (props, componentName) => {
  20150. const carouselContext = vue.inject(carouselContextKey);
  20151. const instance = vue.getCurrentInstance();
  20152. const CARD_SCALE = 0.83;
  20153. const hover = vue.ref(false);
  20154. const translate = vue.ref(0);
  20155. const scale = vue.ref(1);
  20156. const active = vue.ref(false);
  20157. const ready = vue.ref(false);
  20158. const inStage = vue.ref(false);
  20159. const animating = vue.ref(false);
  20160. const { isCardType, isVertical } = carouselContext;
  20161. function processIndex(index, activeIndex, length) {
  20162. const lastItemIndex = length - 1;
  20163. const prevItemIndex = activeIndex - 1;
  20164. const nextItemIndex = activeIndex + 1;
  20165. const halfItemIndex = length / 2;
  20166. if (activeIndex === 0 && index === lastItemIndex) {
  20167. return -1;
  20168. } else if (activeIndex === lastItemIndex && index === 0) {
  20169. return length;
  20170. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  20171. return length + 1;
  20172. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  20173. return -2;
  20174. }
  20175. return index;
  20176. }
  20177. function calcCardTranslate(index, activeIndex) {
  20178. var _a;
  20179. const parentWidth = ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetWidth) || 0;
  20180. if (inStage.value) {
  20181. return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
  20182. } else if (index < activeIndex) {
  20183. return -(1 + CARD_SCALE) * parentWidth / 4;
  20184. } else {
  20185. return (3 + CARD_SCALE) * parentWidth / 4;
  20186. }
  20187. }
  20188. function calcTranslate(index, activeIndex, isVertical2) {
  20189. const rootEl = carouselContext.root.value;
  20190. if (!rootEl)
  20191. return 0;
  20192. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  20193. return distance * (index - activeIndex);
  20194. }
  20195. const translateItem = (index, activeIndex, oldIndex) => {
  20196. var _a;
  20197. const _isCardType = vue.unref(isCardType);
  20198. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  20199. const isActive = index === activeIndex;
  20200. if (!_isCardType && !isUndefined(oldIndex)) {
  20201. animating.value = isActive || index === oldIndex;
  20202. }
  20203. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  20204. index = processIndex(index, activeIndex, carouselItemLength);
  20205. }
  20206. const _isVertical = vue.unref(isVertical);
  20207. active.value = isActive;
  20208. if (_isCardType) {
  20209. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  20210. translate.value = calcCardTranslate(index, activeIndex);
  20211. scale.value = vue.unref(active) ? 1 : CARD_SCALE;
  20212. } else {
  20213. translate.value = calcTranslate(index, activeIndex, _isVertical);
  20214. }
  20215. ready.value = true;
  20216. };
  20217. function handleItemClick() {
  20218. if (carouselContext && vue.unref(isCardType)) {
  20219. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  20220. carouselContext.setActiveItem(index);
  20221. }
  20222. }
  20223. vue.onMounted(() => {
  20224. carouselContext.addItem({
  20225. props,
  20226. states: vue.reactive({
  20227. hover,
  20228. translate,
  20229. scale,
  20230. active,
  20231. ready,
  20232. inStage,
  20233. animating
  20234. }),
  20235. uid: instance.uid,
  20236. translateItem
  20237. });
  20238. });
  20239. vue.onUnmounted(() => {
  20240. carouselContext.removeItem(instance.uid);
  20241. });
  20242. return {
  20243. active,
  20244. animating,
  20245. hover,
  20246. inStage,
  20247. isVertical,
  20248. translate,
  20249. isCardType,
  20250. scale,
  20251. ready,
  20252. handleItemClick
  20253. };
  20254. };
  20255. const __default__$1b = vue.defineComponent({
  20256. name: "ElCarouselItem"
  20257. });
  20258. const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
  20259. ...__default__$1b,
  20260. props: carouselItemProps,
  20261. setup(__props) {
  20262. const props = __props;
  20263. const ns = useNamespace("carousel");
  20264. const {
  20265. active,
  20266. animating,
  20267. hover,
  20268. inStage,
  20269. isVertical,
  20270. translate,
  20271. isCardType,
  20272. scale,
  20273. ready,
  20274. handleItemClick
  20275. } = useCarouselItem(props);
  20276. const itemStyle = vue.computed(() => {
  20277. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  20278. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  20279. const _scale = `scale(${vue.unref(scale)})`;
  20280. const transform = [_translate, _scale].join(" ");
  20281. return {
  20282. transform
  20283. };
  20284. });
  20285. return (_ctx, _cache) => {
  20286. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20287. class: vue.normalizeClass([
  20288. vue.unref(ns).e("item"),
  20289. vue.unref(ns).is("active", vue.unref(active)),
  20290. vue.unref(ns).is("in-stage", vue.unref(inStage)),
  20291. vue.unref(ns).is("hover", vue.unref(hover)),
  20292. vue.unref(ns).is("animating", vue.unref(animating)),
  20293. { [vue.unref(ns).em("item", "card")]: vue.unref(isCardType) }
  20294. ]),
  20295. style: vue.normalizeStyle(vue.unref(itemStyle)),
  20296. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleItemClick) && vue.unref(handleItemClick)(...args))
  20297. }, [
  20298. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20299. key: 0,
  20300. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  20301. }, null, 2)), [
  20302. [vue.vShow, !vue.unref(active)]
  20303. ]) : vue.createCommentVNode("v-if", true),
  20304. vue.renderSlot(_ctx.$slots, "default")
  20305. ], 6)), [
  20306. [vue.vShow, vue.unref(ready)]
  20307. ]);
  20308. };
  20309. }
  20310. });
  20311. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "carousel-item.vue"]]);
  20312. const ElCarousel = withInstall(Carousel, {
  20313. CarouselItem
  20314. });
  20315. const ElCarouselItem = withNoopInstall(CarouselItem);
  20316. const checkboxProps = {
  20317. modelValue: {
  20318. type: [Number, String, Boolean],
  20319. default: void 0
  20320. },
  20321. label: {
  20322. type: [String, Boolean, Number, Object]
  20323. },
  20324. indeterminate: Boolean,
  20325. disabled: Boolean,
  20326. checked: Boolean,
  20327. name: {
  20328. type: String,
  20329. default: void 0
  20330. },
  20331. trueLabel: {
  20332. type: [String, Number],
  20333. default: void 0
  20334. },
  20335. falseLabel: {
  20336. type: [String, Number],
  20337. default: void 0
  20338. },
  20339. id: {
  20340. type: String,
  20341. default: void 0
  20342. },
  20343. controls: {
  20344. type: String,
  20345. default: void 0
  20346. },
  20347. border: Boolean,
  20348. size: useSizeProp,
  20349. tabindex: [String, Number],
  20350. validateEvent: {
  20351. type: Boolean,
  20352. default: true
  20353. }
  20354. };
  20355. const checkboxEmits = {
  20356. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber$1(val) || isBoolean$1(val),
  20357. change: (val) => isString$1(val) || isNumber$1(val) || isBoolean$1(val)
  20358. };
  20359. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  20360. const useCheckboxDisabled = ({
  20361. model,
  20362. isChecked
  20363. }) => {
  20364. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20365. const isLimitDisabled = vue.computed(() => {
  20366. var _a, _b;
  20367. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  20368. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  20369. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  20370. });
  20371. const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  20372. return {
  20373. isDisabled,
  20374. isLimitDisabled
  20375. };
  20376. };
  20377. const useCheckboxEvent = (props, {
  20378. model,
  20379. isLimitExceeded,
  20380. hasOwnLabel,
  20381. isDisabled,
  20382. isLabeledByFormItem
  20383. }) => {
  20384. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20385. const { formItem } = useFormItem();
  20386. const { emit } = vue.getCurrentInstance();
  20387. function getLabeledValue(value) {
  20388. var _a, _b;
  20389. return value === props.trueLabel || value === true ? (_a = props.trueLabel) != null ? _a : true : (_b = props.falseLabel) != null ? _b : false;
  20390. }
  20391. function emitChangeEvent(checked, e) {
  20392. emit("change", getLabeledValue(checked), e);
  20393. }
  20394. function handleChange(e) {
  20395. if (isLimitExceeded.value)
  20396. return;
  20397. const target = e.target;
  20398. emit("change", getLabeledValue(target.checked), e);
  20399. }
  20400. async function onClickRoot(e) {
  20401. if (isLimitExceeded.value)
  20402. return;
  20403. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  20404. const eventTargets = e.composedPath();
  20405. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  20406. if (!hasLabel) {
  20407. model.value = getLabeledValue([false, props.falseLabel].includes(model.value));
  20408. await vue.nextTick();
  20409. emitChangeEvent(model.value, e);
  20410. }
  20411. }
  20412. }
  20413. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  20414. vue.watch(() => props.modelValue, () => {
  20415. if (validateEvent.value) {
  20416. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  20417. }
  20418. });
  20419. return {
  20420. handleChange,
  20421. onClickRoot
  20422. };
  20423. };
  20424. const useCheckboxModel = (props) => {
  20425. const selfModel = vue.ref(false);
  20426. const { emit } = vue.getCurrentInstance();
  20427. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20428. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  20429. const isLimitExceeded = vue.ref(false);
  20430. const model = vue.computed({
  20431. get() {
  20432. var _a, _b;
  20433. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  20434. },
  20435. set(val) {
  20436. var _a, _b;
  20437. if (isGroup.value && isArray$1(val)) {
  20438. 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);
  20439. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  20440. } else {
  20441. emit(UPDATE_MODEL_EVENT, val);
  20442. selfModel.value = val;
  20443. }
  20444. }
  20445. });
  20446. return {
  20447. model,
  20448. isGroup,
  20449. isLimitExceeded
  20450. };
  20451. };
  20452. const useCheckboxStatus = (props, slots, { model }) => {
  20453. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20454. const isFocused = vue.ref(false);
  20455. const isChecked = vue.computed(() => {
  20456. const value = model.value;
  20457. if (isBoolean$1(value)) {
  20458. return value;
  20459. } else if (isArray$1(value)) {
  20460. if (isObject$1(props.label)) {
  20461. return value.map(vue.toRaw).some((o) => isEqual$1(o, props.label));
  20462. } else {
  20463. return value.map(vue.toRaw).includes(props.label);
  20464. }
  20465. } else if (value !== null && value !== void 0) {
  20466. return value === props.trueLabel;
  20467. } else {
  20468. return !!value;
  20469. }
  20470. });
  20471. const checkboxButtonSize = useFormSize(vue.computed(() => {
  20472. var _a;
  20473. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  20474. }), {
  20475. prop: true
  20476. });
  20477. const checkboxSize = useFormSize(vue.computed(() => {
  20478. var _a;
  20479. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  20480. }));
  20481. const hasOwnLabel = vue.computed(() => {
  20482. return !!(slots.default || props.label);
  20483. });
  20484. return {
  20485. checkboxButtonSize,
  20486. isChecked,
  20487. isFocused,
  20488. checkboxSize,
  20489. hasOwnLabel
  20490. };
  20491. };
  20492. const setStoreValue = (props, { model }) => {
  20493. function addToStore() {
  20494. if (isArray$1(model.value) && !model.value.includes(props.label)) {
  20495. model.value.push(props.label);
  20496. } else {
  20497. model.value = props.trueLabel || true;
  20498. }
  20499. }
  20500. props.checked && addToStore();
  20501. };
  20502. const useCheckbox = (props, slots) => {
  20503. const { formItem: elFormItem } = useFormItem();
  20504. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  20505. const {
  20506. isFocused,
  20507. isChecked,
  20508. checkboxButtonSize,
  20509. checkboxSize,
  20510. hasOwnLabel
  20511. } = useCheckboxStatus(props, slots, { model });
  20512. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  20513. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  20514. formItemContext: elFormItem,
  20515. disableIdGeneration: hasOwnLabel,
  20516. disableIdManagement: isGroup
  20517. });
  20518. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  20519. model,
  20520. isLimitExceeded,
  20521. hasOwnLabel,
  20522. isDisabled,
  20523. isLabeledByFormItem
  20524. });
  20525. setStoreValue(props, { model });
  20526. return {
  20527. inputId,
  20528. isLabeledByFormItem,
  20529. isChecked,
  20530. isDisabled,
  20531. isFocused,
  20532. checkboxButtonSize,
  20533. checkboxSize,
  20534. hasOwnLabel,
  20535. model,
  20536. handleChange,
  20537. onClickRoot
  20538. };
  20539. };
  20540. const _hoisted_1$T = ["tabindex", "role", "aria-checked"];
  20541. const _hoisted_2$z = ["id", "aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  20542. const _hoisted_3$j = ["id", "aria-hidden", "disabled", "value", "name", "tabindex"];
  20543. const __default__$1a = vue.defineComponent({
  20544. name: "ElCheckbox"
  20545. });
  20546. const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({
  20547. ...__default__$1a,
  20548. props: checkboxProps,
  20549. emits: checkboxEmits,
  20550. setup(__props) {
  20551. const props = __props;
  20552. const slots = vue.useSlots();
  20553. const {
  20554. inputId,
  20555. isLabeledByFormItem,
  20556. isChecked,
  20557. isDisabled,
  20558. isFocused,
  20559. checkboxSize,
  20560. hasOwnLabel,
  20561. model,
  20562. handleChange,
  20563. onClickRoot
  20564. } = useCheckbox(props, slots);
  20565. const ns = useNamespace("checkbox");
  20566. const compKls = vue.computed(() => {
  20567. return [
  20568. ns.b(),
  20569. ns.m(checkboxSize.value),
  20570. ns.is("disabled", isDisabled.value),
  20571. ns.is("bordered", props.border),
  20572. ns.is("checked", isChecked.value)
  20573. ];
  20574. });
  20575. const spanKls = vue.computed(() => {
  20576. return [
  20577. ns.e("input"),
  20578. ns.is("disabled", isDisabled.value),
  20579. ns.is("checked", isChecked.value),
  20580. ns.is("indeterminate", props.indeterminate),
  20581. ns.is("focus", isFocused.value)
  20582. ];
  20583. });
  20584. return (_ctx, _cache) => {
  20585. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  20586. class: vue.normalizeClass(vue.unref(compKls)),
  20587. "aria-controls": _ctx.indeterminate ? _ctx.controls : null,
  20588. onClick: vue.unref(onClickRoot)
  20589. }, {
  20590. default: vue.withCtx(() => [
  20591. vue.createElementVNode("span", {
  20592. class: vue.normalizeClass(vue.unref(spanKls)),
  20593. tabindex: _ctx.indeterminate ? 0 : void 0,
  20594. role: _ctx.indeterminate ? "checkbox" : void 0,
  20595. "aria-checked": _ctx.indeterminate ? "mixed" : void 0
  20596. }, [
  20597. _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  20598. key: 0,
  20599. id: vue.unref(inputId),
  20600. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  20601. class: vue.normalizeClass(vue.unref(ns).e("original")),
  20602. type: "checkbox",
  20603. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  20604. name: _ctx.name,
  20605. tabindex: _ctx.tabindex,
  20606. disabled: vue.unref(isDisabled),
  20607. "true-value": _ctx.trueLabel,
  20608. "false-value": _ctx.falseLabel,
  20609. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  20610. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  20611. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
  20612. }, null, 42, _hoisted_2$z)), [
  20613. [vue.vModelCheckbox, vue.unref(model)]
  20614. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  20615. key: 1,
  20616. id: vue.unref(inputId),
  20617. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null),
  20618. class: vue.normalizeClass(vue.unref(ns).e("original")),
  20619. type: "checkbox",
  20620. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  20621. disabled: vue.unref(isDisabled),
  20622. value: _ctx.label,
  20623. name: _ctx.name,
  20624. tabindex: _ctx.tabindex,
  20625. onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  20626. onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
  20627. onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
  20628. }, null, 42, _hoisted_3$j)), [
  20629. [vue.vModelCheckbox, vue.unref(model)]
  20630. ]),
  20631. vue.createElementVNode("span", {
  20632. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  20633. }, null, 2)
  20634. ], 10, _hoisted_1$T),
  20635. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  20636. key: 0,
  20637. class: vue.normalizeClass(vue.unref(ns).e("label"))
  20638. }, [
  20639. vue.renderSlot(_ctx.$slots, "default"),
  20640. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  20641. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  20642. ], 64)) : vue.createCommentVNode("v-if", true)
  20643. ], 2)) : vue.createCommentVNode("v-if", true)
  20644. ]),
  20645. _: 3
  20646. }, 8, ["class", "aria-controls", "onClick"]);
  20647. };
  20648. }
  20649. });
  20650. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "checkbox.vue"]]);
  20651. const _hoisted_1$S = ["name", "tabindex", "disabled", "true-value", "false-value"];
  20652. const _hoisted_2$y = ["name", "tabindex", "disabled", "value"];
  20653. const __default__$19 = vue.defineComponent({
  20654. name: "ElCheckboxButton"
  20655. });
  20656. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  20657. ...__default__$19,
  20658. props: checkboxProps,
  20659. emits: checkboxEmits,
  20660. setup(__props) {
  20661. const props = __props;
  20662. const slots = vue.useSlots();
  20663. const {
  20664. isFocused,
  20665. isChecked,
  20666. isDisabled,
  20667. checkboxButtonSize,
  20668. model,
  20669. handleChange
  20670. } = useCheckbox(props, slots);
  20671. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20672. const ns = useNamespace("checkbox");
  20673. const activeStyle = vue.computed(() => {
  20674. var _a, _b, _c, _d;
  20675. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  20676. return {
  20677. backgroundColor: fillValue,
  20678. borderColor: fillValue,
  20679. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  20680. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  20681. };
  20682. });
  20683. const labelKls = vue.computed(() => {
  20684. return [
  20685. ns.b("button"),
  20686. ns.bm("button", checkboxButtonSize.value),
  20687. ns.is("disabled", isDisabled.value),
  20688. ns.is("checked", isChecked.value),
  20689. ns.is("focus", isFocused.value)
  20690. ];
  20691. });
  20692. return (_ctx, _cache) => {
  20693. return vue.openBlock(), vue.createElementBlock("label", {
  20694. class: vue.normalizeClass(vue.unref(labelKls))
  20695. }, [
  20696. _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  20697. key: 0,
  20698. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  20699. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  20700. type: "checkbox",
  20701. name: _ctx.name,
  20702. tabindex: _ctx.tabindex,
  20703. disabled: vue.unref(isDisabled),
  20704. "true-value": _ctx.trueLabel,
  20705. "false-value": _ctx.falseLabel,
  20706. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  20707. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  20708. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
  20709. }, null, 42, _hoisted_1$S)), [
  20710. [vue.vModelCheckbox, vue.unref(model)]
  20711. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  20712. key: 1,
  20713. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null),
  20714. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  20715. type: "checkbox",
  20716. name: _ctx.name,
  20717. tabindex: _ctx.tabindex,
  20718. disabled: vue.unref(isDisabled),
  20719. value: _ctx.label,
  20720. onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  20721. onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
  20722. onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
  20723. }, null, 42, _hoisted_2$y)), [
  20724. [vue.vModelCheckbox, vue.unref(model)]
  20725. ]),
  20726. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  20727. key: 2,
  20728. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  20729. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  20730. }, [
  20731. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  20732. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  20733. ])
  20734. ], 6)) : vue.createCommentVNode("v-if", true)
  20735. ], 2);
  20736. };
  20737. }
  20738. });
  20739. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "checkbox-button.vue"]]);
  20740. const checkboxGroupProps = buildProps({
  20741. modelValue: {
  20742. type: definePropType(Array),
  20743. default: () => []
  20744. },
  20745. disabled: Boolean,
  20746. min: Number,
  20747. max: Number,
  20748. size: useSizeProp,
  20749. label: String,
  20750. fill: String,
  20751. textColor: String,
  20752. tag: {
  20753. type: String,
  20754. default: "div"
  20755. },
  20756. validateEvent: {
  20757. type: Boolean,
  20758. default: true
  20759. }
  20760. });
  20761. const checkboxGroupEmits = {
  20762. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  20763. change: (val) => isArray$1(val)
  20764. };
  20765. const __default__$18 = vue.defineComponent({
  20766. name: "ElCheckboxGroup"
  20767. });
  20768. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  20769. ...__default__$18,
  20770. props: checkboxGroupProps,
  20771. emits: checkboxGroupEmits,
  20772. setup(__props, { emit }) {
  20773. const props = __props;
  20774. const ns = useNamespace("checkbox");
  20775. const { formItem } = useFormItem();
  20776. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  20777. formItemContext: formItem
  20778. });
  20779. const changeEvent = async (value) => {
  20780. emit(UPDATE_MODEL_EVENT, value);
  20781. await vue.nextTick();
  20782. emit("change", value);
  20783. };
  20784. const modelValue = vue.computed({
  20785. get() {
  20786. return props.modelValue;
  20787. },
  20788. set(val) {
  20789. changeEvent(val);
  20790. }
  20791. });
  20792. vue.provide(checkboxGroupContextKey, {
  20793. ...pick(vue.toRefs(props), [
  20794. "size",
  20795. "min",
  20796. "max",
  20797. "disabled",
  20798. "validateEvent",
  20799. "fill",
  20800. "textColor"
  20801. ]),
  20802. modelValue,
  20803. changeEvent
  20804. });
  20805. vue.watch(() => props.modelValue, () => {
  20806. if (props.validateEvent) {
  20807. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  20808. }
  20809. });
  20810. return (_ctx, _cache) => {
  20811. var _a;
  20812. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  20813. id: vue.unref(groupId),
  20814. class: vue.normalizeClass(vue.unref(ns).b("group")),
  20815. role: "group",
  20816. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "checkbox-group" : void 0,
  20817. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  20818. }, {
  20819. default: vue.withCtx(() => [
  20820. vue.renderSlot(_ctx.$slots, "default")
  20821. ]),
  20822. _: 3
  20823. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  20824. };
  20825. }
  20826. });
  20827. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "checkbox-group.vue"]]);
  20828. const ElCheckbox = withInstall(Checkbox, {
  20829. CheckboxButton,
  20830. CheckboxGroup
  20831. });
  20832. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  20833. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  20834. const radioPropsBase = buildProps({
  20835. size: useSizeProp,
  20836. disabled: Boolean,
  20837. label: {
  20838. type: [String, Number, Boolean],
  20839. default: ""
  20840. }
  20841. });
  20842. const radioProps = buildProps({
  20843. ...radioPropsBase,
  20844. modelValue: {
  20845. type: [String, Number, Boolean],
  20846. default: ""
  20847. },
  20848. name: {
  20849. type: String,
  20850. default: ""
  20851. },
  20852. border: Boolean
  20853. });
  20854. const radioEmits = {
  20855. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber$1(val) || isBoolean$1(val),
  20856. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber$1(val) || isBoolean$1(val)
  20857. };
  20858. const radioGroupKey = Symbol("radioGroupKey");
  20859. const useRadio = (props, emit) => {
  20860. const radioRef = vue.ref();
  20861. const radioGroup = vue.inject(radioGroupKey, void 0);
  20862. const isGroup = vue.computed(() => !!radioGroup);
  20863. const modelValue = vue.computed({
  20864. get() {
  20865. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  20866. },
  20867. set(val) {
  20868. if (isGroup.value) {
  20869. radioGroup.changeEvent(val);
  20870. } else {
  20871. emit && emit(UPDATE_MODEL_EVENT, val);
  20872. }
  20873. radioRef.value.checked = props.modelValue === props.label;
  20874. }
  20875. });
  20876. const size = useFormSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  20877. const disabled = useFormDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  20878. const focus = vue.ref(false);
  20879. const tabIndex = vue.computed(() => {
  20880. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  20881. });
  20882. return {
  20883. radioRef,
  20884. isGroup,
  20885. radioGroup,
  20886. focus,
  20887. size,
  20888. disabled,
  20889. tabIndex,
  20890. modelValue
  20891. };
  20892. };
  20893. const _hoisted_1$R = ["value", "name", "disabled"];
  20894. const __default__$17 = vue.defineComponent({
  20895. name: "ElRadio"
  20896. });
  20897. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  20898. ...__default__$17,
  20899. props: radioProps,
  20900. emits: radioEmits,
  20901. setup(__props, { emit }) {
  20902. const props = __props;
  20903. const ns = useNamespace("radio");
  20904. const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
  20905. function handleChange() {
  20906. vue.nextTick(() => emit("change", modelValue.value));
  20907. }
  20908. return (_ctx, _cache) => {
  20909. var _a;
  20910. return vue.openBlock(), vue.createElementBlock("label", {
  20911. class: vue.normalizeClass([
  20912. vue.unref(ns).b(),
  20913. vue.unref(ns).is("disabled", vue.unref(disabled)),
  20914. vue.unref(ns).is("focus", vue.unref(focus)),
  20915. vue.unref(ns).is("bordered", _ctx.border),
  20916. vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label),
  20917. vue.unref(ns).m(vue.unref(size))
  20918. ])
  20919. }, [
  20920. vue.createElementVNode("span", {
  20921. class: vue.normalizeClass([
  20922. vue.unref(ns).e("input"),
  20923. vue.unref(ns).is("disabled", vue.unref(disabled)),
  20924. vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label)
  20925. ])
  20926. }, [
  20927. vue.withDirectives(vue.createElementVNode("input", {
  20928. ref_key: "radioRef",
  20929. ref: radioRef,
  20930. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  20931. class: vue.normalizeClass(vue.unref(ns).e("original")),
  20932. value: _ctx.label,
  20933. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  20934. disabled: vue.unref(disabled),
  20935. type: "radio",
  20936. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  20937. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  20938. onChange: handleChange
  20939. }, null, 42, _hoisted_1$R), [
  20940. [vue.vModelRadio, vue.unref(modelValue)]
  20941. ]),
  20942. vue.createElementVNode("span", {
  20943. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  20944. }, null, 2)
  20945. ], 2),
  20946. vue.createElementVNode("span", {
  20947. class: vue.normalizeClass(vue.unref(ns).e("label")),
  20948. onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  20949. }, ["stop"]))
  20950. }, [
  20951. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  20952. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  20953. ])
  20954. ], 34)
  20955. ], 2);
  20956. };
  20957. }
  20958. });
  20959. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "radio.vue"]]);
  20960. const radioButtonProps = buildProps({
  20961. ...radioPropsBase,
  20962. name: {
  20963. type: String,
  20964. default: ""
  20965. }
  20966. });
  20967. const _hoisted_1$Q = ["value", "name", "disabled"];
  20968. const __default__$16 = vue.defineComponent({
  20969. name: "ElRadioButton"
  20970. });
  20971. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  20972. ...__default__$16,
  20973. props: radioButtonProps,
  20974. setup(__props) {
  20975. const props = __props;
  20976. const ns = useNamespace("radio");
  20977. const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
  20978. const activeStyle = vue.computed(() => {
  20979. return {
  20980. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  20981. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  20982. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  20983. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  20984. };
  20985. });
  20986. return (_ctx, _cache) => {
  20987. var _a;
  20988. return vue.openBlock(), vue.createElementBlock("label", {
  20989. class: vue.normalizeClass([
  20990. vue.unref(ns).b("button"),
  20991. vue.unref(ns).is("active", vue.unref(modelValue) === _ctx.label),
  20992. vue.unref(ns).is("disabled", vue.unref(disabled)),
  20993. vue.unref(ns).is("focus", vue.unref(focus)),
  20994. vue.unref(ns).bm("button", vue.unref(size))
  20995. ])
  20996. }, [
  20997. vue.withDirectives(vue.createElementVNode("input", {
  20998. ref_key: "radioRef",
  20999. ref: radioRef,
  21000. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  21001. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  21002. value: _ctx.label,
  21003. type: "radio",
  21004. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21005. disabled: vue.unref(disabled),
  21006. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21007. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
  21008. }, null, 42, _hoisted_1$Q), [
  21009. [vue.vModelRadio, vue.unref(modelValue)]
  21010. ]),
  21011. vue.createElementVNode("span", {
  21012. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21013. style: vue.normalizeStyle(vue.unref(modelValue) === _ctx.label ? vue.unref(activeStyle) : {}),
  21014. onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  21015. }, ["stop"]))
  21016. }, [
  21017. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21018. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21019. ])
  21020. ], 38)
  21021. ], 2);
  21022. };
  21023. }
  21024. });
  21025. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "radio-button.vue"]]);
  21026. const radioGroupProps = buildProps({
  21027. id: {
  21028. type: String,
  21029. default: void 0
  21030. },
  21031. size: useSizeProp,
  21032. disabled: Boolean,
  21033. modelValue: {
  21034. type: [String, Number, Boolean],
  21035. default: ""
  21036. },
  21037. fill: {
  21038. type: String,
  21039. default: ""
  21040. },
  21041. label: {
  21042. type: String,
  21043. default: void 0
  21044. },
  21045. textColor: {
  21046. type: String,
  21047. default: ""
  21048. },
  21049. name: {
  21050. type: String,
  21051. default: void 0
  21052. },
  21053. validateEvent: {
  21054. type: Boolean,
  21055. default: true
  21056. }
  21057. });
  21058. const radioGroupEmits = radioEmits;
  21059. const _hoisted_1$P = ["id", "aria-label", "aria-labelledby"];
  21060. const __default__$15 = vue.defineComponent({
  21061. name: "ElRadioGroup"
  21062. });
  21063. const _sfc_main$1H = /* @__PURE__ */ vue.defineComponent({
  21064. ...__default__$15,
  21065. props: radioGroupProps,
  21066. emits: radioGroupEmits,
  21067. setup(__props, { emit }) {
  21068. const props = __props;
  21069. const ns = useNamespace("radio");
  21070. const radioId = useId();
  21071. const radioGroupRef = vue.ref();
  21072. const { formItem } = useFormItem();
  21073. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21074. formItemContext: formItem
  21075. });
  21076. const changeEvent = (value) => {
  21077. emit(UPDATE_MODEL_EVENT, value);
  21078. vue.nextTick(() => emit("change", value));
  21079. };
  21080. vue.onMounted(() => {
  21081. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  21082. const firstLabel = radios[0];
  21083. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  21084. firstLabel.tabIndex = 0;
  21085. }
  21086. });
  21087. const name = vue.computed(() => {
  21088. return props.name || radioId.value;
  21089. });
  21090. vue.provide(radioGroupKey, vue.reactive({
  21091. ...vue.toRefs(props),
  21092. changeEvent,
  21093. name
  21094. }));
  21095. vue.watch(() => props.modelValue, () => {
  21096. if (props.validateEvent) {
  21097. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21098. }
  21099. });
  21100. return (_ctx, _cache) => {
  21101. return vue.openBlock(), vue.createElementBlock("div", {
  21102. id: vue.unref(groupId),
  21103. ref_key: "radioGroupRef",
  21104. ref: radioGroupRef,
  21105. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21106. role: "radiogroup",
  21107. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
  21108. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  21109. }, [
  21110. vue.renderSlot(_ctx.$slots, "default")
  21111. ], 10, _hoisted_1$P);
  21112. };
  21113. }
  21114. });
  21115. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "radio-group.vue"]]);
  21116. const ElRadio = withInstall(Radio, {
  21117. RadioButton,
  21118. RadioGroup
  21119. });
  21120. const ElRadioGroup = withNoopInstall(RadioGroup);
  21121. const ElRadioButton = withNoopInstall(RadioButton);
  21122. var NodeContent$1 = vue.defineComponent({
  21123. name: "NodeContent",
  21124. setup() {
  21125. const ns = useNamespace("cascader-node");
  21126. return {
  21127. ns
  21128. };
  21129. },
  21130. render() {
  21131. const { ns } = this;
  21132. const { node, panel } = this.$parent;
  21133. const { data, label } = node;
  21134. const { renderLabelFn } = panel;
  21135. return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  21136. }
  21137. });
  21138. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  21139. const _sfc_main$1G = vue.defineComponent({
  21140. name: "ElCascaderNode",
  21141. components: {
  21142. ElCheckbox,
  21143. ElRadio,
  21144. NodeContent: NodeContent$1,
  21145. ElIcon,
  21146. Check: check_default,
  21147. Loading: loading_default,
  21148. ArrowRight: arrow_right_default
  21149. },
  21150. props: {
  21151. node: {
  21152. type: Object,
  21153. required: true
  21154. },
  21155. menuId: String
  21156. },
  21157. emits: ["expand"],
  21158. setup(props, { emit }) {
  21159. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  21160. const ns = useNamespace("cascader-node");
  21161. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  21162. const multiple = vue.computed(() => panel.config.multiple);
  21163. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  21164. const checkedNodeId = vue.computed(() => {
  21165. var _a;
  21166. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  21167. });
  21168. const isDisabled = vue.computed(() => props.node.isDisabled);
  21169. const isLeaf = vue.computed(() => props.node.isLeaf);
  21170. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  21171. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  21172. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  21173. const isInPath = (node) => {
  21174. var _a;
  21175. const { level, uid } = props.node;
  21176. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  21177. };
  21178. const doExpand = () => {
  21179. if (inExpandingPath.value)
  21180. return;
  21181. panel.expandNode(props.node);
  21182. };
  21183. const doCheck = (checked) => {
  21184. const { node } = props;
  21185. if (checked === node.checked)
  21186. return;
  21187. panel.handleCheckChange(node, checked);
  21188. };
  21189. const doLoad = () => {
  21190. panel.lazyLoad(props.node, () => {
  21191. if (!isLeaf.value)
  21192. doExpand();
  21193. });
  21194. };
  21195. const handleHoverExpand = (e) => {
  21196. if (!isHoverMenu.value)
  21197. return;
  21198. handleExpand();
  21199. !isLeaf.value && emit("expand", e);
  21200. };
  21201. const handleExpand = () => {
  21202. const { node } = props;
  21203. if (!expandable.value || node.loading)
  21204. return;
  21205. node.loaded ? doExpand() : doLoad();
  21206. };
  21207. const handleClick = () => {
  21208. if (isHoverMenu.value && !isLeaf.value)
  21209. return;
  21210. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  21211. handleCheck(true);
  21212. } else {
  21213. handleExpand();
  21214. }
  21215. };
  21216. const handleSelectCheck = (checked) => {
  21217. if (checkStrictly.value) {
  21218. doCheck(checked);
  21219. if (props.node.loaded) {
  21220. doExpand();
  21221. }
  21222. } else {
  21223. handleCheck(checked);
  21224. }
  21225. };
  21226. const handleCheck = (checked) => {
  21227. if (!props.node.loaded) {
  21228. doLoad();
  21229. } else {
  21230. doCheck(checked);
  21231. !checkStrictly.value && doExpand();
  21232. }
  21233. };
  21234. return {
  21235. panel,
  21236. isHoverMenu,
  21237. multiple,
  21238. checkStrictly,
  21239. checkedNodeId,
  21240. isDisabled,
  21241. isLeaf,
  21242. expandable,
  21243. inExpandingPath,
  21244. inCheckedPath,
  21245. ns,
  21246. handleHoverExpand,
  21247. handleExpand,
  21248. handleClick,
  21249. handleCheck,
  21250. handleSelectCheck
  21251. };
  21252. }
  21253. });
  21254. const _hoisted_1$O = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  21255. const _hoisted_2$x = /* @__PURE__ */ vue.createElementVNode("span", null, null, -1);
  21256. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  21257. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  21258. const _component_el_radio = vue.resolveComponent("el-radio");
  21259. const _component_check = vue.resolveComponent("check");
  21260. const _component_el_icon = vue.resolveComponent("el-icon");
  21261. const _component_node_content = vue.resolveComponent("node-content");
  21262. const _component_loading = vue.resolveComponent("loading");
  21263. const _component_arrow_right = vue.resolveComponent("arrow-right");
  21264. return vue.openBlock(), vue.createElementBlock("li", {
  21265. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  21266. role: "menuitem",
  21267. "aria-haspopup": !_ctx.isLeaf,
  21268. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  21269. "aria-expanded": _ctx.inExpandingPath,
  21270. tabindex: _ctx.expandable ? -1 : void 0,
  21271. class: vue.normalizeClass([
  21272. _ctx.ns.b(),
  21273. _ctx.ns.is("selectable", _ctx.checkStrictly),
  21274. _ctx.ns.is("active", _ctx.node.checked),
  21275. _ctx.ns.is("disabled", !_ctx.expandable),
  21276. _ctx.inExpandingPath && "in-active-path",
  21277. _ctx.inCheckedPath && "in-checked-path"
  21278. ]),
  21279. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  21280. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  21281. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  21282. }, [
  21283. vue.createCommentVNode(" prefix "),
  21284. _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  21285. key: 0,
  21286. "model-value": _ctx.node.checked,
  21287. indeterminate: _ctx.node.indeterminate,
  21288. disabled: _ctx.isDisabled,
  21289. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  21290. }, ["stop"])),
  21291. "onUpdate:modelValue": _ctx.handleSelectCheck
  21292. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, {
  21293. key: 1,
  21294. "model-value": _ctx.checkedNodeId,
  21295. label: _ctx.node.uid,
  21296. disabled: _ctx.isDisabled,
  21297. "onUpdate:modelValue": _ctx.handleSelectCheck,
  21298. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  21299. }, ["stop"]))
  21300. }, {
  21301. default: vue.withCtx(() => [
  21302. vue.createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
  21303. _hoisted_2$x
  21304. ]),
  21305. _: 1
  21306. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21307. key: 2,
  21308. class: vue.normalizeClass(_ctx.ns.e("prefix"))
  21309. }, {
  21310. default: vue.withCtx(() => [
  21311. vue.createVNode(_component_check)
  21312. ]),
  21313. _: 1
  21314. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  21315. vue.createCommentVNode(" content "),
  21316. vue.createVNode(_component_node_content),
  21317. vue.createCommentVNode(" postfix "),
  21318. !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  21319. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21320. key: 0,
  21321. class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  21322. }, {
  21323. default: vue.withCtx(() => [
  21324. vue.createVNode(_component_loading)
  21325. ]),
  21326. _: 1
  21327. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21328. key: 1,
  21329. class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  21330. }, {
  21331. default: vue.withCtx(() => [
  21332. vue.createVNode(_component_arrow_right)
  21333. ]),
  21334. _: 1
  21335. }, 8, ["class"]))
  21336. ], 64)) : vue.createCommentVNode("v-if", true)
  21337. ], 42, _hoisted_1$O);
  21338. }
  21339. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["render", _sfc_render$u], ["__file", "node.vue"]]);
  21340. const _sfc_main$1F = vue.defineComponent({
  21341. name: "ElCascaderMenu",
  21342. components: {
  21343. Loading: loading_default,
  21344. ElIcon,
  21345. ElScrollbar,
  21346. ElCascaderNode
  21347. },
  21348. props: {
  21349. nodes: {
  21350. type: Array,
  21351. required: true
  21352. },
  21353. index: {
  21354. type: Number,
  21355. required: true
  21356. }
  21357. },
  21358. setup(props) {
  21359. const instance = vue.getCurrentInstance();
  21360. const ns = useNamespace("cascader-menu");
  21361. const { t } = useLocale();
  21362. const id = generateId();
  21363. let activeNode = null;
  21364. let hoverTimer = null;
  21365. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  21366. const hoverZone = vue.ref(null);
  21367. const isEmpty = vue.computed(() => !props.nodes.length);
  21368. const isLoading = vue.computed(() => !panel.initialLoaded);
  21369. const menuId = vue.computed(() => `cascader-menu-${id}-${props.index}`);
  21370. const handleExpand = (e) => {
  21371. activeNode = e.target;
  21372. };
  21373. const handleMouseMove = (e) => {
  21374. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  21375. return;
  21376. if (activeNode.contains(e.target)) {
  21377. clearHoverTimer();
  21378. const el = instance.vnode.el;
  21379. const { left } = el.getBoundingClientRect();
  21380. const { offsetWidth, offsetHeight } = el;
  21381. const startX = e.clientX - left;
  21382. const top = activeNode.offsetTop;
  21383. const bottom = top + activeNode.offsetHeight;
  21384. hoverZone.value.innerHTML = `
  21385. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  21386. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  21387. `;
  21388. } else if (!hoverTimer) {
  21389. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  21390. }
  21391. };
  21392. const clearHoverTimer = () => {
  21393. if (!hoverTimer)
  21394. return;
  21395. clearTimeout(hoverTimer);
  21396. hoverTimer = null;
  21397. };
  21398. const clearHoverZone = () => {
  21399. if (!hoverZone.value)
  21400. return;
  21401. hoverZone.value.innerHTML = "";
  21402. clearHoverTimer();
  21403. };
  21404. return {
  21405. ns,
  21406. panel,
  21407. hoverZone,
  21408. isEmpty,
  21409. isLoading,
  21410. menuId,
  21411. t,
  21412. handleExpand,
  21413. handleMouseMove,
  21414. clearHoverZone
  21415. };
  21416. }
  21417. });
  21418. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  21419. const _component_el_cascader_node = vue.resolveComponent("el-cascader-node");
  21420. const _component_loading = vue.resolveComponent("loading");
  21421. const _component_el_icon = vue.resolveComponent("el-icon");
  21422. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  21423. return vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  21424. key: _ctx.menuId,
  21425. tag: "ul",
  21426. role: "menu",
  21427. class: vue.normalizeClass(_ctx.ns.b()),
  21428. "wrap-class": _ctx.ns.e("wrap"),
  21429. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  21430. onMousemove: _ctx.handleMouseMove,
  21431. onMouseleave: _ctx.clearHoverZone
  21432. }, {
  21433. default: vue.withCtx(() => {
  21434. var _a;
  21435. return [
  21436. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => {
  21437. return vue.openBlock(), vue.createBlock(_component_el_cascader_node, {
  21438. key: node.uid,
  21439. node,
  21440. "menu-id": _ctx.menuId,
  21441. onExpand: _ctx.handleExpand
  21442. }, null, 8, ["node", "menu-id", "onExpand"]);
  21443. }), 128)),
  21444. _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", {
  21445. key: 0,
  21446. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  21447. }, [
  21448. vue.createVNode(_component_el_icon, {
  21449. size: "14",
  21450. class: vue.normalizeClass(_ctx.ns.is("loading"))
  21451. }, {
  21452. default: vue.withCtx(() => [
  21453. vue.createVNode(_component_loading)
  21454. ]),
  21455. _: 1
  21456. }, 8, ["class"]),
  21457. vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1)
  21458. ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  21459. key: 1,
  21460. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  21461. }, vue.toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock("svg", {
  21462. key: 2,
  21463. ref: "hoverZone",
  21464. class: vue.normalizeClass(_ctx.ns.e("hover-zone"))
  21465. }, null, 2)) : vue.createCommentVNode("v-if", true)
  21466. ];
  21467. }),
  21468. _: 1
  21469. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  21470. }
  21471. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$t], ["__file", "menu.vue"]]);
  21472. let uid = 0;
  21473. const calculatePathNodes = (node) => {
  21474. const nodes = [node];
  21475. let { parent } = node;
  21476. while (parent) {
  21477. nodes.unshift(parent);
  21478. parent = parent.parent;
  21479. }
  21480. return nodes;
  21481. };
  21482. class Node$2 {
  21483. constructor(data, config, parent, root = false) {
  21484. this.data = data;
  21485. this.config = config;
  21486. this.parent = parent;
  21487. this.root = root;
  21488. this.uid = uid++;
  21489. this.checked = false;
  21490. this.indeterminate = false;
  21491. this.loading = false;
  21492. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  21493. const childrenData = data[childrenKey];
  21494. const pathNodes = calculatePathNodes(this);
  21495. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  21496. this.value = data[valueKey];
  21497. this.label = data[labelKey];
  21498. this.pathNodes = pathNodes;
  21499. this.pathValues = pathNodes.map((node) => node.value);
  21500. this.pathLabels = pathNodes.map((node) => node.label);
  21501. this.childrenData = childrenData;
  21502. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  21503. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  21504. }
  21505. get isDisabled() {
  21506. const { data, parent, config } = this;
  21507. const { disabled, checkStrictly } = config;
  21508. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  21509. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  21510. }
  21511. get isLeaf() {
  21512. const { data, config, childrenData, loaded } = this;
  21513. const { lazy, leaf } = config;
  21514. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  21515. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf;
  21516. }
  21517. get valueByOption() {
  21518. return this.config.emitPath ? this.pathValues : this.value;
  21519. }
  21520. appendChild(childData) {
  21521. const { childrenData, children } = this;
  21522. const node = new Node$2(childData, this.config, this);
  21523. if (Array.isArray(childrenData)) {
  21524. childrenData.push(childData);
  21525. } else {
  21526. this.childrenData = [childData];
  21527. }
  21528. children.push(node);
  21529. return node;
  21530. }
  21531. calcText(allLevels, separator) {
  21532. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  21533. this.text = text;
  21534. return text;
  21535. }
  21536. broadcast(event, ...args) {
  21537. const handlerName = `onParent${capitalize(event)}`;
  21538. this.children.forEach((child) => {
  21539. if (child) {
  21540. child.broadcast(event, ...args);
  21541. child[handlerName] && child[handlerName](...args);
  21542. }
  21543. });
  21544. }
  21545. emit(event, ...args) {
  21546. const { parent } = this;
  21547. const handlerName = `onChild${capitalize(event)}`;
  21548. if (parent) {
  21549. parent[handlerName] && parent[handlerName](...args);
  21550. parent.emit(event, ...args);
  21551. }
  21552. }
  21553. onParentCheck(checked) {
  21554. if (!this.isDisabled) {
  21555. this.setCheckState(checked);
  21556. }
  21557. }
  21558. onChildCheck() {
  21559. const { children } = this;
  21560. const validChildren = children.filter((child) => !child.isDisabled);
  21561. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  21562. this.setCheckState(checked);
  21563. }
  21564. setCheckState(checked) {
  21565. const totalNum = this.children.length;
  21566. const checkedNum = this.children.reduce((c, p) => {
  21567. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  21568. return c + num;
  21569. }, 0);
  21570. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  21571. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  21572. }
  21573. doCheck(checked) {
  21574. if (this.checked === checked)
  21575. return;
  21576. const { checkStrictly, multiple } = this.config;
  21577. if (checkStrictly || !multiple) {
  21578. this.checked = checked;
  21579. } else {
  21580. this.broadcast("check", checked);
  21581. this.setCheckState(checked);
  21582. this.emit("check");
  21583. }
  21584. }
  21585. }
  21586. var Node$3 = Node$2;
  21587. const flatNodes = (nodes, leafOnly) => {
  21588. return nodes.reduce((res, node) => {
  21589. if (node.isLeaf) {
  21590. res.push(node);
  21591. } else {
  21592. !leafOnly && res.push(node);
  21593. res = res.concat(flatNodes(node.children, leafOnly));
  21594. }
  21595. return res;
  21596. }, []);
  21597. };
  21598. class Store {
  21599. constructor(data, config) {
  21600. this.config = config;
  21601. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  21602. this.nodes = nodes;
  21603. this.allNodes = flatNodes(nodes, false);
  21604. this.leafNodes = flatNodes(nodes, true);
  21605. }
  21606. getNodes() {
  21607. return this.nodes;
  21608. }
  21609. getFlattedNodes(leafOnly) {
  21610. return leafOnly ? this.leafNodes : this.allNodes;
  21611. }
  21612. appendNode(nodeData, parentNode) {
  21613. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  21614. if (!parentNode)
  21615. this.nodes.push(node);
  21616. this.allNodes.push(node);
  21617. node.isLeaf && this.leafNodes.push(node);
  21618. }
  21619. appendNodes(nodeDataList, parentNode) {
  21620. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  21621. }
  21622. getNodeByValue(value, leafOnly = false) {
  21623. if (!value && value !== 0)
  21624. return null;
  21625. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  21626. return node || null;
  21627. }
  21628. getSameNode(node) {
  21629. if (!node)
  21630. return null;
  21631. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  21632. return node_ || null;
  21633. }
  21634. }
  21635. const CommonProps = buildProps({
  21636. modelValue: {
  21637. type: definePropType([Number, String, Array])
  21638. },
  21639. options: {
  21640. type: definePropType(Array),
  21641. default: () => []
  21642. },
  21643. props: {
  21644. type: definePropType(Object),
  21645. default: () => ({})
  21646. }
  21647. });
  21648. const DefaultProps = {
  21649. expandTrigger: "click",
  21650. multiple: false,
  21651. checkStrictly: false,
  21652. emitPath: true,
  21653. lazy: false,
  21654. lazyLoad: NOOP,
  21655. value: "value",
  21656. label: "label",
  21657. children: "children",
  21658. leaf: "leaf",
  21659. disabled: "disabled",
  21660. hoverThreshold: 500
  21661. };
  21662. const useCascaderConfig = (props) => {
  21663. return vue.computed(() => ({
  21664. ...DefaultProps,
  21665. ...props.props
  21666. }));
  21667. };
  21668. const getMenuIndex = (el) => {
  21669. if (!el)
  21670. return 0;
  21671. const pieces = el.id.split("-");
  21672. return Number(pieces[pieces.length - 2]);
  21673. };
  21674. const checkNode = (el) => {
  21675. if (!el)
  21676. return;
  21677. const input = el.querySelector("input");
  21678. if (input) {
  21679. input.click();
  21680. } else if (isLeaf(el)) {
  21681. el.click();
  21682. }
  21683. };
  21684. const sortByOriginalOrder = (oldNodes, newNodes) => {
  21685. const newNodesCopy = newNodes.slice(0);
  21686. const newIds = newNodesCopy.map((node) => node.uid);
  21687. const res = oldNodes.reduce((acc, item) => {
  21688. const index = newIds.indexOf(item.uid);
  21689. if (index > -1) {
  21690. acc.push(item);
  21691. newNodesCopy.splice(index, 1);
  21692. newIds.splice(index, 1);
  21693. }
  21694. return acc;
  21695. }, []);
  21696. res.push(...newNodesCopy);
  21697. return res;
  21698. };
  21699. const _sfc_main$1E = vue.defineComponent({
  21700. name: "ElCascaderPanel",
  21701. components: {
  21702. ElCascaderMenu
  21703. },
  21704. props: {
  21705. ...CommonProps,
  21706. border: {
  21707. type: Boolean,
  21708. default: true
  21709. },
  21710. renderLabel: Function
  21711. },
  21712. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  21713. setup(props, { emit, slots }) {
  21714. let manualChecked = false;
  21715. const ns = useNamespace("cascader");
  21716. const config = useCascaderConfig(props);
  21717. let store = null;
  21718. const initialLoaded = vue.ref(true);
  21719. const menuList = vue.ref([]);
  21720. const checkedValue = vue.ref(null);
  21721. const menus = vue.ref([]);
  21722. const expandingNode = vue.ref(null);
  21723. const checkedNodes = vue.ref([]);
  21724. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  21725. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  21726. const initStore = () => {
  21727. const { options } = props;
  21728. const cfg = config.value;
  21729. manualChecked = false;
  21730. store = new Store(options, cfg);
  21731. menus.value = [store.getNodes()];
  21732. if (cfg.lazy && isEmpty(props.options)) {
  21733. initialLoaded.value = false;
  21734. lazyLoad(void 0, (list) => {
  21735. if (list) {
  21736. store = new Store(list, cfg);
  21737. menus.value = [store.getNodes()];
  21738. }
  21739. initialLoaded.value = true;
  21740. syncCheckedValue(false, true);
  21741. });
  21742. } else {
  21743. syncCheckedValue(false, true);
  21744. }
  21745. };
  21746. const lazyLoad = (node, cb) => {
  21747. const cfg = config.value;
  21748. node = node || new Node$3({}, cfg, void 0, true);
  21749. node.loading = true;
  21750. const resolve = (dataList) => {
  21751. const _node = node;
  21752. const parent = _node.root ? null : _node;
  21753. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  21754. _node.loading = false;
  21755. _node.loaded = true;
  21756. _node.childrenData = _node.childrenData || [];
  21757. cb && cb(dataList);
  21758. };
  21759. cfg.lazyLoad(node, resolve);
  21760. };
  21761. const expandNode = (node, silent) => {
  21762. var _a;
  21763. const { level } = node;
  21764. const newMenus = menus.value.slice(0, level);
  21765. let newExpandingNode;
  21766. if (node.isLeaf) {
  21767. newExpandingNode = node.pathNodes[level - 2];
  21768. } else {
  21769. newExpandingNode = node;
  21770. newMenus.push(node.children);
  21771. }
  21772. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  21773. expandingNode.value = node;
  21774. menus.value = newMenus;
  21775. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  21776. }
  21777. };
  21778. const handleCheckChange = (node, checked, emitClose = true) => {
  21779. const { checkStrictly, multiple } = config.value;
  21780. const oldNode = checkedNodes.value[0];
  21781. manualChecked = true;
  21782. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  21783. node.doCheck(checked);
  21784. calculateCheckedValue();
  21785. emitClose && !multiple && !checkStrictly && emit("close");
  21786. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  21787. };
  21788. const expandParentNode = (node) => {
  21789. if (!node)
  21790. return;
  21791. node = node.parent;
  21792. expandParentNode(node);
  21793. node && expandNode(node);
  21794. };
  21795. const getFlattedNodes = (leafOnly) => {
  21796. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  21797. };
  21798. const getCheckedNodes = (leafOnly) => {
  21799. var _a;
  21800. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  21801. };
  21802. const clearCheckedNodes = () => {
  21803. checkedNodes.value.forEach((node) => node.doCheck(false));
  21804. calculateCheckedValue();
  21805. menus.value = menus.value.slice(0, 1);
  21806. expandingNode.value = null;
  21807. emit("expand-change", []);
  21808. };
  21809. const calculateCheckedValue = () => {
  21810. var _a;
  21811. const { checkStrictly, multiple } = config.value;
  21812. const oldNodes = checkedNodes.value;
  21813. const newNodes = getCheckedNodes(!checkStrictly);
  21814. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  21815. const values = nodes.map((node) => node.valueByOption);
  21816. checkedNodes.value = nodes;
  21817. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  21818. };
  21819. const syncCheckedValue = (loaded = false, forced = false) => {
  21820. const { modelValue } = props;
  21821. const { lazy, multiple, checkStrictly } = config.value;
  21822. const leafOnly = !checkStrictly;
  21823. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  21824. return;
  21825. if (lazy && !loaded) {
  21826. const values = unique(flattenDeep(castArray(modelValue)));
  21827. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  21828. if (nodes.length) {
  21829. nodes.forEach((node) => {
  21830. lazyLoad(node, () => syncCheckedValue(false, forced));
  21831. });
  21832. } else {
  21833. syncCheckedValue(true, forced);
  21834. }
  21835. } else {
  21836. const values = multiple ? castArray(modelValue) : [modelValue];
  21837. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  21838. syncMenuState(nodes, forced);
  21839. checkedValue.value = cloneDeep(modelValue);
  21840. }
  21841. };
  21842. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  21843. const { checkStrictly } = config.value;
  21844. const oldNodes = checkedNodes.value;
  21845. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  21846. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  21847. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  21848. if (newExpandingNode) {
  21849. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  21850. } else {
  21851. expandingNode.value = null;
  21852. }
  21853. oldNodes.forEach((node) => node.doCheck(false));
  21854. newNodes.forEach((node) => node.doCheck(true));
  21855. checkedNodes.value = newNodes;
  21856. vue.nextTick(scrollToExpandingNode);
  21857. };
  21858. const scrollToExpandingNode = () => {
  21859. if (!isClient)
  21860. return;
  21861. menuList.value.forEach((menu) => {
  21862. const menuElement = menu == null ? void 0 : menu.$el;
  21863. if (menuElement) {
  21864. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  21865. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  21866. scrollIntoView(container, activeNode);
  21867. }
  21868. });
  21869. };
  21870. const handleKeyDown = (e) => {
  21871. const target = e.target;
  21872. const { code } = e;
  21873. switch (code) {
  21874. case EVENT_CODE.up:
  21875. case EVENT_CODE.down: {
  21876. e.preventDefault();
  21877. const distance = code === EVENT_CODE.up ? -1 : 1;
  21878. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  21879. break;
  21880. }
  21881. case EVENT_CODE.left: {
  21882. e.preventDefault();
  21883. const preMenu = menuList.value[getMenuIndex(target) - 1];
  21884. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  21885. focusNode(expandedNode);
  21886. break;
  21887. }
  21888. case EVENT_CODE.right: {
  21889. e.preventDefault();
  21890. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  21891. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  21892. focusNode(firstNode);
  21893. break;
  21894. }
  21895. case EVENT_CODE.enter:
  21896. checkNode(target);
  21897. break;
  21898. }
  21899. };
  21900. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  21901. config,
  21902. expandingNode,
  21903. checkedNodes,
  21904. isHoverMenu,
  21905. initialLoaded,
  21906. renderLabelFn,
  21907. lazyLoad,
  21908. expandNode,
  21909. handleCheckChange
  21910. }));
  21911. vue.watch([config, () => props.options], initStore, {
  21912. deep: true,
  21913. immediate: true
  21914. });
  21915. vue.watch(() => props.modelValue, () => {
  21916. manualChecked = false;
  21917. syncCheckedValue();
  21918. }, {
  21919. deep: true
  21920. });
  21921. vue.watch(() => checkedValue.value, (val) => {
  21922. if (!isEqual$1(val, props.modelValue)) {
  21923. emit(UPDATE_MODEL_EVENT, val);
  21924. emit(CHANGE_EVENT, val);
  21925. }
  21926. });
  21927. vue.onBeforeUpdate(() => menuList.value = []);
  21928. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  21929. return {
  21930. ns,
  21931. menuList,
  21932. menus,
  21933. checkedNodes,
  21934. handleKeyDown,
  21935. handleCheckChange,
  21936. getFlattedNodes,
  21937. getCheckedNodes,
  21938. clearCheckedNodes,
  21939. calculateCheckedValue,
  21940. scrollToExpandingNode
  21941. };
  21942. }
  21943. });
  21944. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  21945. const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu");
  21946. return vue.openBlock(), vue.createElementBlock("div", {
  21947. class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  21948. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  21949. }, [
  21950. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => {
  21951. return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, {
  21952. key: index,
  21953. ref_for: true,
  21954. ref: (item) => _ctx.menuList[index] = item,
  21955. index,
  21956. nodes: [...menu]
  21957. }, null, 8, ["index", "nodes"]);
  21958. }), 128))
  21959. ], 34);
  21960. }
  21961. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["render", _sfc_render$s], ["__file", "index.vue"]]);
  21962. CascaderPanel.install = (app) => {
  21963. app.component(CascaderPanel.name, CascaderPanel);
  21964. };
  21965. const _CascaderPanel = CascaderPanel;
  21966. const ElCascaderPanel = _CascaderPanel;
  21967. const tagProps = buildProps({
  21968. closable: Boolean,
  21969. type: {
  21970. type: String,
  21971. values: ["success", "info", "warning", "danger", ""],
  21972. default: ""
  21973. },
  21974. hit: Boolean,
  21975. disableTransitions: Boolean,
  21976. color: {
  21977. type: String,
  21978. default: ""
  21979. },
  21980. size: {
  21981. type: String,
  21982. values: componentSizes,
  21983. default: ""
  21984. },
  21985. effect: {
  21986. type: String,
  21987. values: ["dark", "light", "plain"],
  21988. default: "light"
  21989. },
  21990. round: Boolean
  21991. });
  21992. const tagEmits = {
  21993. close: (evt) => evt instanceof MouseEvent,
  21994. click: (evt) => evt instanceof MouseEvent
  21995. };
  21996. const __default__$14 = vue.defineComponent({
  21997. name: "ElTag"
  21998. });
  21999. const _sfc_main$1D = /* @__PURE__ */ vue.defineComponent({
  22000. ...__default__$14,
  22001. props: tagProps,
  22002. emits: tagEmits,
  22003. setup(__props, { emit }) {
  22004. const props = __props;
  22005. const tagSize = useFormSize();
  22006. const ns = useNamespace("tag");
  22007. const classes = vue.computed(() => {
  22008. const { type, hit, effect, closable, round } = props;
  22009. return [
  22010. ns.b(),
  22011. ns.is("closable", closable),
  22012. ns.m(type),
  22013. ns.m(tagSize.value),
  22014. ns.m(effect),
  22015. ns.is("hit", hit),
  22016. ns.is("round", round)
  22017. ];
  22018. });
  22019. const handleClose = (event) => {
  22020. emit("close", event);
  22021. };
  22022. const handleClick = (event) => {
  22023. emit("click", event);
  22024. };
  22025. return (_ctx, _cache) => {
  22026. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  22027. key: 0,
  22028. class: vue.normalizeClass(vue.unref(classes)),
  22029. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22030. onClick: handleClick
  22031. }, [
  22032. vue.createElementVNode("span", {
  22033. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22034. }, [
  22035. vue.renderSlot(_ctx.$slots, "default")
  22036. ], 2),
  22037. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22038. key: 0,
  22039. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22040. onClick: vue.withModifiers(handleClose, ["stop"])
  22041. }, {
  22042. default: vue.withCtx(() => [
  22043. vue.createVNode(vue.unref(close_default))
  22044. ]),
  22045. _: 1
  22046. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22047. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  22048. key: 1,
  22049. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  22050. appear: ""
  22051. }, {
  22052. default: vue.withCtx(() => [
  22053. vue.createElementVNode("span", {
  22054. class: vue.normalizeClass(vue.unref(classes)),
  22055. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22056. onClick: handleClick
  22057. }, [
  22058. vue.createElementVNode("span", {
  22059. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22060. }, [
  22061. vue.renderSlot(_ctx.$slots, "default")
  22062. ], 2),
  22063. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22064. key: 0,
  22065. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22066. onClick: vue.withModifiers(handleClose, ["stop"])
  22067. }, {
  22068. default: vue.withCtx(() => [
  22069. vue.createVNode(vue.unref(close_default))
  22070. ]),
  22071. _: 1
  22072. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22073. ], 6)
  22074. ]),
  22075. _: 3
  22076. }, 8, ["name"]));
  22077. };
  22078. }
  22079. });
  22080. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "tag.vue"]]);
  22081. const ElTag = withInstall(Tag);
  22082. const cascaderProps = buildProps({
  22083. ...CommonProps,
  22084. size: useSizeProp,
  22085. placeholder: String,
  22086. disabled: Boolean,
  22087. clearable: Boolean,
  22088. filterable: Boolean,
  22089. filterMethod: {
  22090. type: definePropType(Function),
  22091. default: (node, keyword) => node.text.includes(keyword)
  22092. },
  22093. separator: {
  22094. type: String,
  22095. default: " / "
  22096. },
  22097. showAllLevels: {
  22098. type: Boolean,
  22099. default: true
  22100. },
  22101. collapseTags: Boolean,
  22102. collapseTagsTooltip: {
  22103. type: Boolean,
  22104. default: false
  22105. },
  22106. debounce: {
  22107. type: Number,
  22108. default: 300
  22109. },
  22110. beforeFilter: {
  22111. type: definePropType(Function),
  22112. default: () => true
  22113. },
  22114. popperClass: {
  22115. type: String,
  22116. default: ""
  22117. },
  22118. teleported: useTooltipContentProps.teleported,
  22119. tagType: { ...tagProps.type, default: "info" },
  22120. validateEvent: {
  22121. type: Boolean,
  22122. default: true
  22123. }
  22124. });
  22125. const cascaderEmits = {
  22126. [UPDATE_MODEL_EVENT]: (val) => !!val || val === null,
  22127. [CHANGE_EVENT]: (val) => !!val || val === null,
  22128. focus: (evt) => evt instanceof FocusEvent,
  22129. blur: (evt) => evt instanceof FocusEvent,
  22130. visibleChange: (val) => isBoolean$1(val),
  22131. expandChange: (val) => !!val,
  22132. removeTag: (val) => !!val
  22133. };
  22134. const _hoisted_1$N = { key: 0 };
  22135. const _hoisted_2$w = ["placeholder", "onKeydown"];
  22136. const _hoisted_3$i = ["onClick"];
  22137. const COMPONENT_NAME$e = "ElCascader";
  22138. const __default__$13 = vue.defineComponent({
  22139. name: COMPONENT_NAME$e
  22140. });
  22141. const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({
  22142. ...__default__$13,
  22143. props: cascaderProps,
  22144. emits: cascaderEmits,
  22145. setup(__props, { expose, emit }) {
  22146. const props = __props;
  22147. const popperOptions = {
  22148. modifiers: [
  22149. {
  22150. name: "arrowPosition",
  22151. enabled: true,
  22152. phase: "main",
  22153. fn: ({ state }) => {
  22154. const { modifiersData, placement } = state;
  22155. if (["right", "left", "bottom", "top"].includes(placement))
  22156. return;
  22157. modifiersData.arrow.x = 35;
  22158. },
  22159. requires: ["arrow"]
  22160. }
  22161. ]
  22162. };
  22163. const attrs = vue.useAttrs();
  22164. let inputInitialHeight = 0;
  22165. let pressDeleteCount = 0;
  22166. const nsCascader = useNamespace("cascader");
  22167. const nsInput = useNamespace("input");
  22168. const { t } = useLocale();
  22169. const { form, formItem } = useFormItem();
  22170. const tooltipRef = vue.ref(null);
  22171. const input = vue.ref(null);
  22172. const tagWrapper = vue.ref(null);
  22173. const cascaderPanelRef = vue.ref(null);
  22174. const suggestionPanel = vue.ref(null);
  22175. const popperVisible = vue.ref(false);
  22176. const inputHover = vue.ref(false);
  22177. const filtering = vue.ref(false);
  22178. const filterFocus = vue.ref(false);
  22179. const inputValue = vue.ref("");
  22180. const searchInputValue = vue.ref("");
  22181. const presentTags = vue.ref([]);
  22182. const allPresentTags = vue.ref([]);
  22183. const suggestions = vue.ref([]);
  22184. const isOnComposition = vue.ref(false);
  22185. const cascaderStyle = vue.computed(() => {
  22186. return attrs.style;
  22187. });
  22188. const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  22189. const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder"));
  22190. const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 || isOnComposition.value ? "" : inputPlaceholder.value);
  22191. const realSize = useFormSize();
  22192. const tagSize = vue.computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  22193. const multiple = vue.computed(() => !!props.props.multiple);
  22194. const readonly = vue.computed(() => !props.filterable || multiple.value);
  22195. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  22196. const checkedNodes = vue.computed(() => {
  22197. var _a;
  22198. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  22199. });
  22200. const clearBtnVisible = vue.computed(() => {
  22201. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  22202. return false;
  22203. return !!checkedNodes.value.length;
  22204. });
  22205. const presentText = vue.computed(() => {
  22206. const { showAllLevels, separator } = props;
  22207. const nodes = checkedNodes.value;
  22208. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  22209. });
  22210. const checkedValue = vue.computed({
  22211. get() {
  22212. return cloneDeep(props.modelValue);
  22213. },
  22214. set(val) {
  22215. emit(UPDATE_MODEL_EVENT, val);
  22216. emit(CHANGE_EVENT, val);
  22217. if (props.validateEvent) {
  22218. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22219. }
  22220. }
  22221. });
  22222. const cascaderKls = vue.computed(() => {
  22223. return [
  22224. nsCascader.b(),
  22225. nsCascader.m(realSize.value),
  22226. nsCascader.is("disabled", isDisabled.value),
  22227. attrs.class
  22228. ];
  22229. });
  22230. const cascaderIconKls = vue.computed(() => {
  22231. return [
  22232. nsInput.e("icon"),
  22233. "icon-arrow-down",
  22234. nsCascader.is("reverse", popperVisible.value)
  22235. ];
  22236. });
  22237. const inputClass = vue.computed(() => {
  22238. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  22239. });
  22240. const contentRef = vue.computed(() => {
  22241. var _a, _b;
  22242. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  22243. });
  22244. const togglePopperVisible = (visible) => {
  22245. var _a, _b, _c;
  22246. if (isDisabled.value)
  22247. return;
  22248. visible = visible != null ? visible : !popperVisible.value;
  22249. if (visible !== popperVisible.value) {
  22250. popperVisible.value = visible;
  22251. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  22252. if (visible) {
  22253. updatePopperPosition();
  22254. vue.nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  22255. } else if (props.filterable) {
  22256. syncPresentTextValue();
  22257. }
  22258. emit("visibleChange", visible);
  22259. }
  22260. };
  22261. const updatePopperPosition = () => {
  22262. vue.nextTick(() => {
  22263. var _a;
  22264. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  22265. });
  22266. };
  22267. const hideSuggestionPanel = () => {
  22268. filtering.value = false;
  22269. };
  22270. const genTag = (node) => {
  22271. const { showAllLevels, separator } = props;
  22272. return {
  22273. node,
  22274. key: node.uid,
  22275. text: node.calcText(showAllLevels, separator),
  22276. hitState: false,
  22277. closable: !isDisabled.value && !node.isDisabled,
  22278. isCollapseTag: false
  22279. };
  22280. };
  22281. const deleteTag = (tag) => {
  22282. var _a;
  22283. const node = tag.node;
  22284. node.doCheck(false);
  22285. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  22286. emit("removeTag", node.valueByOption);
  22287. };
  22288. const calculatePresentTags = () => {
  22289. if (!multiple.value)
  22290. return;
  22291. const nodes = checkedNodes.value;
  22292. const tags = [];
  22293. const allTags = [];
  22294. nodes.forEach((node) => allTags.push(genTag(node)));
  22295. allPresentTags.value = allTags;
  22296. if (nodes.length) {
  22297. const [first, ...rest] = nodes;
  22298. const restCount = rest.length;
  22299. tags.push(genTag(first));
  22300. if (restCount) {
  22301. if (props.collapseTags) {
  22302. tags.push({
  22303. key: -1,
  22304. text: `+ ${restCount}`,
  22305. closable: false,
  22306. isCollapseTag: true
  22307. });
  22308. } else {
  22309. rest.forEach((node) => tags.push(genTag(node)));
  22310. }
  22311. }
  22312. }
  22313. presentTags.value = tags;
  22314. };
  22315. const calculateSuggestions = () => {
  22316. var _a, _b;
  22317. const { filterMethod, showAllLevels, separator } = props;
  22318. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  22319. if (node.isDisabled)
  22320. return false;
  22321. node.calcText(showAllLevels, separator);
  22322. return filterMethod(node, searchKeyword.value);
  22323. });
  22324. if (multiple.value) {
  22325. presentTags.value.forEach((tag) => {
  22326. tag.hitState = false;
  22327. });
  22328. allPresentTags.value.forEach((tag) => {
  22329. tag.hitState = false;
  22330. });
  22331. }
  22332. filtering.value = true;
  22333. suggestions.value = res;
  22334. updatePopperPosition();
  22335. };
  22336. const focusFirstNode = () => {
  22337. var _a;
  22338. let firstNode;
  22339. if (filtering.value && suggestionPanel.value) {
  22340. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  22341. } else {
  22342. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  22343. }
  22344. if (firstNode) {
  22345. firstNode.focus();
  22346. !filtering.value && firstNode.click();
  22347. }
  22348. };
  22349. const updateStyle = () => {
  22350. var _a, _b;
  22351. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  22352. const tagWrapperEl = tagWrapper.value;
  22353. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  22354. if (!isClient || !inputInner)
  22355. return;
  22356. if (suggestionPanelEl) {
  22357. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  22358. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  22359. }
  22360. if (tagWrapperEl) {
  22361. const { offsetHeight } = tagWrapperEl;
  22362. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  22363. inputInner.style.height = height;
  22364. updatePopperPosition();
  22365. }
  22366. };
  22367. const getCheckedNodes = (leafOnly) => {
  22368. var _a;
  22369. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  22370. };
  22371. const handleExpandChange = (value) => {
  22372. updatePopperPosition();
  22373. emit("expandChange", value);
  22374. };
  22375. const handleComposition = (event) => {
  22376. var _a;
  22377. const text = (_a = event.target) == null ? void 0 : _a.value;
  22378. if (event.type === "compositionend") {
  22379. isOnComposition.value = false;
  22380. vue.nextTick(() => handleInput(text));
  22381. } else {
  22382. const lastCharacter = text[text.length - 1] || "";
  22383. isOnComposition.value = !isKorean(lastCharacter);
  22384. }
  22385. };
  22386. const handleKeyDown = (e) => {
  22387. if (isOnComposition.value)
  22388. return;
  22389. switch (e.code) {
  22390. case EVENT_CODE.enter:
  22391. togglePopperVisible();
  22392. break;
  22393. case EVENT_CODE.down:
  22394. togglePopperVisible(true);
  22395. vue.nextTick(focusFirstNode);
  22396. e.preventDefault();
  22397. break;
  22398. case EVENT_CODE.esc:
  22399. if (popperVisible.value === true) {
  22400. e.preventDefault();
  22401. e.stopPropagation();
  22402. togglePopperVisible(false);
  22403. }
  22404. break;
  22405. case EVENT_CODE.tab:
  22406. togglePopperVisible(false);
  22407. break;
  22408. }
  22409. };
  22410. const handleClear = () => {
  22411. var _a;
  22412. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  22413. if (!popperVisible.value && props.filterable) {
  22414. syncPresentTextValue();
  22415. }
  22416. togglePopperVisible(false);
  22417. };
  22418. const syncPresentTextValue = () => {
  22419. const { value } = presentText;
  22420. inputValue.value = value;
  22421. searchInputValue.value = value;
  22422. };
  22423. const handleSuggestionClick = (node) => {
  22424. var _a, _b;
  22425. const { checked } = node;
  22426. if (multiple.value) {
  22427. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  22428. } else {
  22429. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  22430. togglePopperVisible(false);
  22431. }
  22432. };
  22433. const handleSuggestionKeyDown = (e) => {
  22434. const target = e.target;
  22435. const { code } = e;
  22436. switch (code) {
  22437. case EVENT_CODE.up:
  22438. case EVENT_CODE.down: {
  22439. const distance = code === EVENT_CODE.up ? -1 : 1;
  22440. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  22441. break;
  22442. }
  22443. case EVENT_CODE.enter:
  22444. target.click();
  22445. break;
  22446. }
  22447. };
  22448. const handleDelete = () => {
  22449. const tags = presentTags.value;
  22450. const lastTag = tags[tags.length - 1];
  22451. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  22452. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  22453. return;
  22454. if (lastTag.hitState) {
  22455. deleteTag(lastTag);
  22456. } else {
  22457. lastTag.hitState = true;
  22458. }
  22459. };
  22460. const handleFocus = (e) => {
  22461. const el = e.target;
  22462. const name = nsCascader.e("search-input");
  22463. if (el.className === name) {
  22464. filterFocus.value = true;
  22465. }
  22466. emit("focus", e);
  22467. };
  22468. const handleBlur = (e) => {
  22469. filterFocus.value = false;
  22470. emit("blur", e);
  22471. };
  22472. const handleFilter = debounce(() => {
  22473. const { value } = searchKeyword;
  22474. if (!value)
  22475. return;
  22476. const passed = props.beforeFilter(value);
  22477. if (isPromise(passed)) {
  22478. passed.then(calculateSuggestions).catch(() => {
  22479. });
  22480. } else if (passed !== false) {
  22481. calculateSuggestions();
  22482. } else {
  22483. hideSuggestionPanel();
  22484. }
  22485. }, props.debounce);
  22486. const handleInput = (val, e) => {
  22487. !popperVisible.value && togglePopperVisible(true);
  22488. if (e == null ? void 0 : e.isComposing)
  22489. return;
  22490. val ? handleFilter() : hideSuggestionPanel();
  22491. };
  22492. vue.watch(filtering, updatePopperPosition);
  22493. vue.watch([checkedNodes, isDisabled], calculatePresentTags);
  22494. vue.watch(presentTags, () => {
  22495. vue.nextTick(() => updateStyle());
  22496. });
  22497. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  22498. vue.onMounted(() => {
  22499. const inputInner = input.value.input;
  22500. const inputInnerHeight = Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  22501. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  22502. useResizeObserver(inputInner, updateStyle);
  22503. });
  22504. expose({
  22505. getCheckedNodes,
  22506. cascaderPanelRef,
  22507. togglePopperVisible,
  22508. contentRef
  22509. });
  22510. return (_ctx, _cache) => {
  22511. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  22512. ref_key: "tooltipRef",
  22513. ref: tooltipRef,
  22514. visible: popperVisible.value,
  22515. teleported: _ctx.teleported,
  22516. "popper-class": [vue.unref(nsCascader).e("dropdown"), _ctx.popperClass],
  22517. "popper-options": popperOptions,
  22518. "fallback-placements": [
  22519. "bottom-start",
  22520. "bottom",
  22521. "top-start",
  22522. "top",
  22523. "right",
  22524. "left"
  22525. ],
  22526. "stop-popper-mouse-event": false,
  22527. "gpu-acceleration": false,
  22528. placement: "bottom-start",
  22529. transition: `${vue.unref(nsCascader).namespace.value}-zoom-in-top`,
  22530. effect: "light",
  22531. pure: "",
  22532. persistent: "",
  22533. onHide: hideSuggestionPanel
  22534. }, {
  22535. default: vue.withCtx(() => [
  22536. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  22537. class: vue.normalizeClass(vue.unref(cascaderKls)),
  22538. style: vue.normalizeStyle(vue.unref(cascaderStyle)),
  22539. onClick: _cache[5] || (_cache[5] = () => togglePopperVisible(vue.unref(readonly) ? void 0 : true)),
  22540. onKeydown: handleKeyDown,
  22541. onMouseenter: _cache[6] || (_cache[6] = ($event) => inputHover.value = true),
  22542. onMouseleave: _cache[7] || (_cache[7] = ($event) => inputHover.value = false)
  22543. }, [
  22544. vue.createVNode(vue.unref(ElInput), {
  22545. ref_key: "input",
  22546. ref: input,
  22547. modelValue: inputValue.value,
  22548. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
  22549. placeholder: vue.unref(currentPlaceholder),
  22550. readonly: vue.unref(readonly),
  22551. disabled: vue.unref(isDisabled),
  22552. "validate-event": false,
  22553. size: vue.unref(realSize),
  22554. class: vue.normalizeClass(vue.unref(inputClass)),
  22555. tabindex: vue.unref(multiple) && _ctx.filterable && !vue.unref(isDisabled) ? -1 : void 0,
  22556. onCompositionstart: handleComposition,
  22557. onCompositionupdate: handleComposition,
  22558. onCompositionend: handleComposition,
  22559. onFocus: handleFocus,
  22560. onBlur: handleBlur,
  22561. onInput: handleInput
  22562. }, {
  22563. suffix: vue.withCtx(() => [
  22564. vue.unref(clearBtnVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22565. key: "clear",
  22566. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), "icon-circle-close"]),
  22567. onClick: vue.withModifiers(handleClear, ["stop"])
  22568. }, {
  22569. default: vue.withCtx(() => [
  22570. vue.createVNode(vue.unref(circle_close_default))
  22571. ]),
  22572. _: 1
  22573. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22574. key: "arrow-down",
  22575. class: vue.normalizeClass(vue.unref(cascaderIconKls)),
  22576. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => togglePopperVisible(), ["stop"]))
  22577. }, {
  22578. default: vue.withCtx(() => [
  22579. vue.createVNode(vue.unref(arrow_down_default))
  22580. ]),
  22581. _: 1
  22582. }, 8, ["class"]))
  22583. ]),
  22584. _: 1
  22585. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex"]),
  22586. vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", {
  22587. key: 0,
  22588. ref_key: "tagWrapper",
  22589. ref: tagWrapper,
  22590. class: vue.normalizeClass(vue.unref(nsCascader).e("tags"))
  22591. }, [
  22592. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(presentTags.value, (tag) => {
  22593. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  22594. key: tag.key,
  22595. type: _ctx.tagType,
  22596. size: vue.unref(tagSize),
  22597. hit: tag.hitState,
  22598. closable: tag.closable,
  22599. "disable-transitions": "",
  22600. onClose: ($event) => deleteTag(tag)
  22601. }, {
  22602. default: vue.withCtx(() => [
  22603. tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$N, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  22604. key: 1,
  22605. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  22606. "fallback-placements": ["bottom", "top", "right", "left"],
  22607. placement: "bottom",
  22608. effect: "light"
  22609. }, {
  22610. default: vue.withCtx(() => [
  22611. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  22612. ]),
  22613. content: vue.withCtx(() => [
  22614. vue.createElementVNode("div", {
  22615. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tags"))
  22616. }, [
  22617. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(allPresentTags.value.slice(1), (tag2, idx) => {
  22618. return vue.openBlock(), vue.createElementBlock("div", {
  22619. key: idx,
  22620. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tag"))
  22621. }, [
  22622. (vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  22623. key: tag2.key,
  22624. class: "in-tooltip",
  22625. type: _ctx.tagType,
  22626. size: vue.unref(tagSize),
  22627. hit: tag2.hitState,
  22628. closable: tag2.closable,
  22629. "disable-transitions": "",
  22630. onClose: ($event) => deleteTag(tag2)
  22631. }, {
  22632. default: vue.withCtx(() => [
  22633. vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1)
  22634. ]),
  22635. _: 2
  22636. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  22637. ], 2);
  22638. }), 128))
  22639. ], 2)
  22640. ]),
  22641. _: 2
  22642. }, 1032, ["disabled"]))
  22643. ]),
  22644. _: 2
  22645. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  22646. }), 128)),
  22647. _ctx.filterable && !vue.unref(isDisabled) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  22648. key: 0,
  22649. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event),
  22650. type: "text",
  22651. class: vue.normalizeClass(vue.unref(nsCascader).e("search-input")),
  22652. placeholder: vue.unref(presentText) ? "" : vue.unref(inputPlaceholder),
  22653. onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)),
  22654. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => togglePopperVisible(true), ["stop"])),
  22655. onKeydown: vue.withKeys(handleDelete, ["delete"]),
  22656. onCompositionstart: handleComposition,
  22657. onCompositionupdate: handleComposition,
  22658. onCompositionend: handleComposition,
  22659. onFocus: handleFocus,
  22660. onBlur: handleBlur
  22661. }, null, 42, _hoisted_2$w)), [
  22662. [vue.vModelText, searchInputValue.value]
  22663. ]) : vue.createCommentVNode("v-if", true)
  22664. ], 2)) : vue.createCommentVNode("v-if", true)
  22665. ], 38)), [
  22666. [vue.unref(ClickOutside), () => togglePopperVisible(false), vue.unref(contentRef)]
  22667. ])
  22668. ]),
  22669. content: vue.withCtx(() => [
  22670. vue.withDirectives(vue.createVNode(vue.unref(_CascaderPanel), {
  22671. ref_key: "cascaderPanelRef",
  22672. ref: cascaderPanelRef,
  22673. modelValue: vue.unref(checkedValue),
  22674. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => vue.isRef(checkedValue) ? checkedValue.value = $event : null),
  22675. options: _ctx.options,
  22676. props: props.props,
  22677. border: false,
  22678. "render-label": _ctx.$slots.default,
  22679. onExpandChange: handleExpandChange,
  22680. onClose: _cache[9] || (_cache[9] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false)))
  22681. }, null, 8, ["modelValue", "options", "props", "render-label"]), [
  22682. [vue.vShow, !filtering.value]
  22683. ]),
  22684. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  22685. key: 0,
  22686. ref_key: "suggestionPanel",
  22687. ref: suggestionPanel,
  22688. tag: "ul",
  22689. class: vue.normalizeClass(vue.unref(nsCascader).e("suggestion-panel")),
  22690. "view-class": vue.unref(nsCascader).e("suggestion-list"),
  22691. onKeydown: handleSuggestionKeyDown
  22692. }, {
  22693. default: vue.withCtx(() => [
  22694. suggestions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(suggestions.value, (item) => {
  22695. return vue.openBlock(), vue.createElementBlock("li", {
  22696. key: item.uid,
  22697. class: vue.normalizeClass([
  22698. vue.unref(nsCascader).e("suggestion-item"),
  22699. vue.unref(nsCascader).is("checked", item.checked)
  22700. ]),
  22701. tabindex: -1,
  22702. onClick: ($event) => handleSuggestionClick(item)
  22703. }, [
  22704. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  22705. item.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  22706. default: vue.withCtx(() => [
  22707. vue.createVNode(vue.unref(check_default))
  22708. ]),
  22709. _: 1
  22710. })) : vue.createCommentVNode("v-if", true)
  22711. ], 10, _hoisted_3$i);
  22712. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  22713. vue.createElementVNode("li", {
  22714. class: vue.normalizeClass(vue.unref(nsCascader).e("empty-text"))
  22715. }, vue.toDisplayString(vue.unref(t)("el.cascader.noMatch")), 3)
  22716. ])
  22717. ]),
  22718. _: 3
  22719. }, 8, ["class", "view-class"])), [
  22720. [vue.vShow, filtering.value]
  22721. ]) : vue.createCommentVNode("v-if", true)
  22722. ]),
  22723. _: 3
  22724. }, 8, ["visible", "teleported", "popper-class", "transition"]);
  22725. };
  22726. }
  22727. });
  22728. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "cascader.vue"]]);
  22729. Cascader.install = (app) => {
  22730. app.component(Cascader.name, Cascader);
  22731. };
  22732. const _Cascader = Cascader;
  22733. const ElCascader = _Cascader;
  22734. const checkTagProps = buildProps({
  22735. checked: {
  22736. type: Boolean,
  22737. default: false
  22738. }
  22739. });
  22740. const checkTagEmits = {
  22741. "update:checked": (value) => isBoolean$1(value),
  22742. [CHANGE_EVENT]: (value) => isBoolean$1(value)
  22743. };
  22744. const __default__$12 = vue.defineComponent({
  22745. name: "ElCheckTag"
  22746. });
  22747. const _sfc_main$1B = /* @__PURE__ */ vue.defineComponent({
  22748. ...__default__$12,
  22749. props: checkTagProps,
  22750. emits: checkTagEmits,
  22751. setup(__props, { emit }) {
  22752. const props = __props;
  22753. const ns = useNamespace("check-tag");
  22754. const handleChange = () => {
  22755. const checked = !props.checked;
  22756. emit(CHANGE_EVENT, checked);
  22757. emit("update:checked", checked);
  22758. };
  22759. return (_ctx, _cache) => {
  22760. return vue.openBlock(), vue.createElementBlock("span", {
  22761. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("checked", _ctx.checked)]),
  22762. onClick: handleChange
  22763. }, [
  22764. vue.renderSlot(_ctx.$slots, "default")
  22765. ], 2);
  22766. };
  22767. }
  22768. });
  22769. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "check-tag.vue"]]);
  22770. const ElCheckTag = withInstall(CheckTag);
  22771. const rowContextKey = Symbol("rowContextKey");
  22772. const RowJustify = [
  22773. "start",
  22774. "center",
  22775. "end",
  22776. "space-around",
  22777. "space-between",
  22778. "space-evenly"
  22779. ];
  22780. const RowAlign = ["top", "middle", "bottom"];
  22781. const rowProps = buildProps({
  22782. tag: {
  22783. type: String,
  22784. default: "div"
  22785. },
  22786. gutter: {
  22787. type: Number,
  22788. default: 0
  22789. },
  22790. justify: {
  22791. type: String,
  22792. values: RowJustify,
  22793. default: "start"
  22794. },
  22795. align: {
  22796. type: String,
  22797. values: RowAlign,
  22798. default: "top"
  22799. }
  22800. });
  22801. const __default__$11 = vue.defineComponent({
  22802. name: "ElRow"
  22803. });
  22804. const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({
  22805. ...__default__$11,
  22806. props: rowProps,
  22807. setup(__props) {
  22808. const props = __props;
  22809. const ns = useNamespace("row");
  22810. const gutter = vue.computed(() => props.gutter);
  22811. vue.provide(rowContextKey, {
  22812. gutter
  22813. });
  22814. const style = vue.computed(() => {
  22815. const styles = {};
  22816. if (!props.gutter) {
  22817. return styles;
  22818. }
  22819. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  22820. return styles;
  22821. });
  22822. const rowKls = vue.computed(() => [
  22823. ns.b(),
  22824. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  22825. ns.is(`align-${props.align}`, props.align !== "top")
  22826. ]);
  22827. return (_ctx, _cache) => {
  22828. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  22829. class: vue.normalizeClass(vue.unref(rowKls)),
  22830. style: vue.normalizeStyle(vue.unref(style))
  22831. }, {
  22832. default: vue.withCtx(() => [
  22833. vue.renderSlot(_ctx.$slots, "default")
  22834. ]),
  22835. _: 3
  22836. }, 8, ["class", "style"]);
  22837. };
  22838. }
  22839. });
  22840. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "row.vue"]]);
  22841. const ElRow = withInstall(Row$1);
  22842. const colProps = buildProps({
  22843. tag: {
  22844. type: String,
  22845. default: "div"
  22846. },
  22847. span: {
  22848. type: Number,
  22849. default: 24
  22850. },
  22851. offset: {
  22852. type: Number,
  22853. default: 0
  22854. },
  22855. pull: {
  22856. type: Number,
  22857. default: 0
  22858. },
  22859. push: {
  22860. type: Number,
  22861. default: 0
  22862. },
  22863. xs: {
  22864. type: definePropType([Number, Object]),
  22865. default: () => mutable({})
  22866. },
  22867. sm: {
  22868. type: definePropType([Number, Object]),
  22869. default: () => mutable({})
  22870. },
  22871. md: {
  22872. type: definePropType([Number, Object]),
  22873. default: () => mutable({})
  22874. },
  22875. lg: {
  22876. type: definePropType([Number, Object]),
  22877. default: () => mutable({})
  22878. },
  22879. xl: {
  22880. type: definePropType([Number, Object]),
  22881. default: () => mutable({})
  22882. }
  22883. });
  22884. const __default__$10 = vue.defineComponent({
  22885. name: "ElCol"
  22886. });
  22887. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  22888. ...__default__$10,
  22889. props: colProps,
  22890. setup(__props) {
  22891. const props = __props;
  22892. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  22893. const ns = useNamespace("col");
  22894. const style = vue.computed(() => {
  22895. const styles = {};
  22896. if (gutter.value) {
  22897. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  22898. }
  22899. return styles;
  22900. });
  22901. const colKls = vue.computed(() => {
  22902. const classes = [];
  22903. const pos = ["span", "offset", "pull", "push"];
  22904. pos.forEach((prop) => {
  22905. const size = props[prop];
  22906. if (isNumber$1(size)) {
  22907. if (prop === "span")
  22908. classes.push(ns.b(`${props[prop]}`));
  22909. else if (size > 0)
  22910. classes.push(ns.b(`${prop}-${props[prop]}`));
  22911. }
  22912. });
  22913. const sizes = ["xs", "sm", "md", "lg", "xl"];
  22914. sizes.forEach((size) => {
  22915. if (isNumber$1(props[size])) {
  22916. classes.push(ns.b(`${size}-${props[size]}`));
  22917. } else if (isObject$1(props[size])) {
  22918. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  22919. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  22920. });
  22921. }
  22922. });
  22923. if (gutter.value) {
  22924. classes.push(ns.is("guttered"));
  22925. }
  22926. return [ns.b(), classes];
  22927. });
  22928. return (_ctx, _cache) => {
  22929. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  22930. class: vue.normalizeClass(vue.unref(colKls)),
  22931. style: vue.normalizeStyle(vue.unref(style))
  22932. }, {
  22933. default: vue.withCtx(() => [
  22934. vue.renderSlot(_ctx.$slots, "default")
  22935. ]),
  22936. _: 3
  22937. }, 8, ["class", "style"]);
  22938. };
  22939. }
  22940. });
  22941. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "col.vue"]]);
  22942. const ElCol = withInstall(Col);
  22943. const emitChangeFn = (value) => typeof isNumber$1(value);
  22944. const collapseProps = buildProps({
  22945. accordion: Boolean,
  22946. modelValue: {
  22947. type: definePropType([Array, String, Number]),
  22948. default: () => mutable([])
  22949. }
  22950. });
  22951. const collapseEmits = {
  22952. [UPDATE_MODEL_EVENT]: emitChangeFn,
  22953. [CHANGE_EVENT]: emitChangeFn
  22954. };
  22955. const collapseContextKey = Symbol("collapseContextKey");
  22956. const useCollapse = (props, emit) => {
  22957. const activeNames = vue.ref(castArray$1(props.modelValue));
  22958. const setActiveNames = (_activeNames) => {
  22959. activeNames.value = _activeNames;
  22960. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  22961. emit(UPDATE_MODEL_EVENT, value);
  22962. emit(CHANGE_EVENT, value);
  22963. };
  22964. const handleItemClick = (name) => {
  22965. if (props.accordion) {
  22966. setActiveNames([activeNames.value[0] === name ? "" : name]);
  22967. } else {
  22968. const _activeNames = [...activeNames.value];
  22969. const index = _activeNames.indexOf(name);
  22970. if (index > -1) {
  22971. _activeNames.splice(index, 1);
  22972. } else {
  22973. _activeNames.push(name);
  22974. }
  22975. setActiveNames(_activeNames);
  22976. }
  22977. };
  22978. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  22979. vue.provide(collapseContextKey, {
  22980. activeNames,
  22981. handleItemClick
  22982. });
  22983. return {
  22984. activeNames,
  22985. setActiveNames
  22986. };
  22987. };
  22988. const useCollapseDOM = () => {
  22989. const ns = useNamespace("collapse");
  22990. const rootKls = vue.computed(() => ns.b());
  22991. return {
  22992. rootKls
  22993. };
  22994. };
  22995. const __default__$$ = vue.defineComponent({
  22996. name: "ElCollapse"
  22997. });
  22998. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  22999. ...__default__$$,
  23000. props: collapseProps,
  23001. emits: collapseEmits,
  23002. setup(__props, { expose, emit }) {
  23003. const props = __props;
  23004. const { activeNames, setActiveNames } = useCollapse(props, emit);
  23005. const { rootKls } = useCollapseDOM();
  23006. expose({
  23007. activeNames,
  23008. setActiveNames
  23009. });
  23010. return (_ctx, _cache) => {
  23011. return vue.openBlock(), vue.createElementBlock("div", {
  23012. class: vue.normalizeClass(vue.unref(rootKls)),
  23013. role: "tablist",
  23014. "aria-multiselectable": "true"
  23015. }, [
  23016. vue.renderSlot(_ctx.$slots, "default")
  23017. ], 2);
  23018. };
  23019. }
  23020. });
  23021. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "collapse.vue"]]);
  23022. const __default__$_ = vue.defineComponent({
  23023. name: "ElCollapseTransition"
  23024. });
  23025. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  23026. ...__default__$_,
  23027. setup(__props) {
  23028. const ns = useNamespace("collapse-transition");
  23029. const on = {
  23030. beforeEnter(el) {
  23031. if (!el.dataset)
  23032. el.dataset = {};
  23033. el.dataset.oldPaddingTop = el.style.paddingTop;
  23034. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23035. el.style.maxHeight = 0;
  23036. el.style.paddingTop = 0;
  23037. el.style.paddingBottom = 0;
  23038. },
  23039. enter(el) {
  23040. el.dataset.oldOverflow = el.style.overflow;
  23041. if (el.scrollHeight !== 0) {
  23042. el.style.maxHeight = `${el.scrollHeight}px`;
  23043. el.style.paddingTop = el.dataset.oldPaddingTop;
  23044. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23045. } else {
  23046. el.style.maxHeight = 0;
  23047. el.style.paddingTop = el.dataset.oldPaddingTop;
  23048. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23049. }
  23050. el.style.overflow = "hidden";
  23051. },
  23052. afterEnter(el) {
  23053. el.style.maxHeight = "";
  23054. el.style.overflow = el.dataset.oldOverflow;
  23055. },
  23056. beforeLeave(el) {
  23057. if (!el.dataset)
  23058. el.dataset = {};
  23059. el.dataset.oldPaddingTop = el.style.paddingTop;
  23060. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23061. el.dataset.oldOverflow = el.style.overflow;
  23062. el.style.maxHeight = `${el.scrollHeight}px`;
  23063. el.style.overflow = "hidden";
  23064. },
  23065. leave(el) {
  23066. if (el.scrollHeight !== 0) {
  23067. el.style.maxHeight = 0;
  23068. el.style.paddingTop = 0;
  23069. el.style.paddingBottom = 0;
  23070. }
  23071. },
  23072. afterLeave(el) {
  23073. el.style.maxHeight = "";
  23074. el.style.overflow = el.dataset.oldOverflow;
  23075. el.style.paddingTop = el.dataset.oldPaddingTop;
  23076. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23077. }
  23078. };
  23079. return (_ctx, _cache) => {
  23080. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  23081. name: vue.unref(ns).b()
  23082. }, vue.toHandlers(on)), {
  23083. default: vue.withCtx(() => [
  23084. vue.renderSlot(_ctx.$slots, "default")
  23085. ]),
  23086. _: 3
  23087. }, 16, ["name"]);
  23088. };
  23089. }
  23090. });
  23091. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "collapse-transition.vue"]]);
  23092. CollapseTransition.install = (app) => {
  23093. app.component(CollapseTransition.name, CollapseTransition);
  23094. };
  23095. const _CollapseTransition = CollapseTransition;
  23096. const ElCollapseTransition = _CollapseTransition;
  23097. const collapseItemProps = buildProps({
  23098. title: {
  23099. type: String,
  23100. default: ""
  23101. },
  23102. name: {
  23103. type: definePropType([String, Number]),
  23104. default: () => generateId()
  23105. },
  23106. disabled: Boolean
  23107. });
  23108. const useCollapseItem = (props) => {
  23109. const collapse = vue.inject(collapseContextKey);
  23110. const focusing = vue.ref(false);
  23111. const isClick = vue.ref(false);
  23112. const id = vue.ref(generateId());
  23113. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
  23114. const handleFocus = () => {
  23115. setTimeout(() => {
  23116. if (!isClick.value) {
  23117. focusing.value = true;
  23118. } else {
  23119. isClick.value = false;
  23120. }
  23121. }, 50);
  23122. };
  23123. const handleHeaderClick = () => {
  23124. if (props.disabled)
  23125. return;
  23126. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  23127. focusing.value = false;
  23128. isClick.value = true;
  23129. };
  23130. const handleEnterClick = () => {
  23131. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  23132. };
  23133. return {
  23134. focusing,
  23135. id,
  23136. isActive,
  23137. handleFocus,
  23138. handleHeaderClick,
  23139. handleEnterClick
  23140. };
  23141. };
  23142. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  23143. const ns = useNamespace("collapse");
  23144. const rootKls = vue.computed(() => [
  23145. ns.b("item"),
  23146. ns.is("active", vue.unref(isActive)),
  23147. ns.is("disabled", props.disabled)
  23148. ]);
  23149. const headKls = vue.computed(() => [
  23150. ns.be("item", "header"),
  23151. ns.is("active", vue.unref(isActive)),
  23152. { focusing: vue.unref(focusing) && !props.disabled }
  23153. ]);
  23154. const arrowKls = vue.computed(() => [
  23155. ns.be("item", "arrow"),
  23156. ns.is("active", vue.unref(isActive))
  23157. ]);
  23158. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  23159. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  23160. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  23161. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  23162. return {
  23163. arrowKls,
  23164. headKls,
  23165. rootKls,
  23166. itemWrapperKls,
  23167. itemContentKls,
  23168. scopedContentId,
  23169. scopedHeadId
  23170. };
  23171. };
  23172. const _hoisted_1$M = ["aria-expanded", "aria-controls", "aria-describedby"];
  23173. const _hoisted_2$v = ["id", "tabindex"];
  23174. const _hoisted_3$h = ["id", "aria-hidden", "aria-labelledby"];
  23175. const __default__$Z = vue.defineComponent({
  23176. name: "ElCollapseItem"
  23177. });
  23178. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  23179. ...__default__$Z,
  23180. props: collapseItemProps,
  23181. setup(__props, { expose }) {
  23182. const props = __props;
  23183. const {
  23184. focusing,
  23185. id,
  23186. isActive,
  23187. handleFocus,
  23188. handleHeaderClick,
  23189. handleEnterClick
  23190. } = useCollapseItem(props);
  23191. const {
  23192. arrowKls,
  23193. headKls,
  23194. rootKls,
  23195. itemWrapperKls,
  23196. itemContentKls,
  23197. scopedContentId,
  23198. scopedHeadId
  23199. } = useCollapseItemDOM(props, { focusing, isActive, id });
  23200. expose({
  23201. isActive
  23202. });
  23203. return (_ctx, _cache) => {
  23204. return vue.openBlock(), vue.createElementBlock("div", {
  23205. class: vue.normalizeClass(vue.unref(rootKls))
  23206. }, [
  23207. vue.createElementVNode("div", {
  23208. role: "tab",
  23209. "aria-expanded": vue.unref(isActive),
  23210. "aria-controls": vue.unref(scopedContentId),
  23211. "aria-describedby": vue.unref(scopedContentId)
  23212. }, [
  23213. vue.createElementVNode("div", {
  23214. id: vue.unref(scopedHeadId),
  23215. class: vue.normalizeClass(vue.unref(headKls)),
  23216. role: "button",
  23217. tabindex: _ctx.disabled ? -1 : 0,
  23218. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleHeaderClick) && vue.unref(handleHeaderClick)(...args)),
  23219. onKeypress: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers((...args) => vue.unref(handleEnterClick) && vue.unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  23220. onFocus: _cache[2] || (_cache[2] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args)),
  23221. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  23222. }, [
  23223. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  23224. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  23225. ]),
  23226. vue.createVNode(vue.unref(ElIcon), {
  23227. class: vue.normalizeClass(vue.unref(arrowKls))
  23228. }, {
  23229. default: vue.withCtx(() => [
  23230. vue.createVNode(vue.unref(arrow_right_default))
  23231. ]),
  23232. _: 1
  23233. }, 8, ["class"])
  23234. ], 42, _hoisted_2$v)
  23235. ], 8, _hoisted_1$M),
  23236. vue.createVNode(vue.unref(_CollapseTransition), null, {
  23237. default: vue.withCtx(() => [
  23238. vue.withDirectives(vue.createElementVNode("div", {
  23239. id: vue.unref(scopedContentId),
  23240. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  23241. role: "tabpanel",
  23242. "aria-hidden": !vue.unref(isActive),
  23243. "aria-labelledby": vue.unref(scopedHeadId)
  23244. }, [
  23245. vue.createElementVNode("div", {
  23246. class: vue.normalizeClass(vue.unref(itemContentKls))
  23247. }, [
  23248. vue.renderSlot(_ctx.$slots, "default")
  23249. ], 2)
  23250. ], 10, _hoisted_3$h), [
  23251. [vue.vShow, vue.unref(isActive)]
  23252. ])
  23253. ]),
  23254. _: 3
  23255. })
  23256. ], 2);
  23257. };
  23258. }
  23259. });
  23260. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "collapse-item.vue"]]);
  23261. const ElCollapse = withInstall(Collapse, {
  23262. CollapseItem
  23263. });
  23264. const ElCollapseItem = withNoopInstall(CollapseItem);
  23265. const alphaSliderProps = buildProps({
  23266. color: {
  23267. type: definePropType(Object),
  23268. required: true
  23269. },
  23270. vertical: {
  23271. type: Boolean,
  23272. default: false
  23273. }
  23274. });
  23275. let isDragging = false;
  23276. function draggable(element, options) {
  23277. if (!isClient)
  23278. return;
  23279. const moveFn = function(event) {
  23280. var _a;
  23281. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  23282. };
  23283. const upFn = function(event) {
  23284. var _a;
  23285. document.removeEventListener("mousemove", moveFn);
  23286. document.removeEventListener("mouseup", upFn);
  23287. document.removeEventListener("touchmove", moveFn);
  23288. document.removeEventListener("touchend", upFn);
  23289. document.onselectstart = null;
  23290. document.ondragstart = null;
  23291. isDragging = false;
  23292. (_a = options.end) == null ? void 0 : _a.call(options, event);
  23293. };
  23294. const downFn = function(event) {
  23295. var _a;
  23296. if (isDragging)
  23297. return;
  23298. event.preventDefault();
  23299. document.onselectstart = () => false;
  23300. document.ondragstart = () => false;
  23301. document.addEventListener("mousemove", moveFn);
  23302. document.addEventListener("mouseup", upFn);
  23303. document.addEventListener("touchmove", moveFn);
  23304. document.addEventListener("touchend", upFn);
  23305. isDragging = true;
  23306. (_a = options.start) == null ? void 0 : _a.call(options, event);
  23307. };
  23308. element.addEventListener("mousedown", downFn);
  23309. element.addEventListener("touchstart", downFn);
  23310. }
  23311. const useAlphaSlider = (props) => {
  23312. const instance = vue.getCurrentInstance();
  23313. const thumb = vue.shallowRef();
  23314. const bar = vue.shallowRef();
  23315. function handleClick(event) {
  23316. const target = event.target;
  23317. if (target !== thumb.value) {
  23318. handleDrag(event);
  23319. }
  23320. }
  23321. function handleDrag(event) {
  23322. if (!bar.value || !thumb.value)
  23323. return;
  23324. const el = instance.vnode.el;
  23325. const rect = el.getBoundingClientRect();
  23326. const { clientX, clientY } = getClientXY(event);
  23327. if (!props.vertical) {
  23328. let left = clientX - rect.left;
  23329. left = Math.max(thumb.value.offsetWidth / 2, left);
  23330. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  23331. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  23332. } else {
  23333. let top = clientY - rect.top;
  23334. top = Math.max(thumb.value.offsetHeight / 2, top);
  23335. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  23336. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  23337. }
  23338. }
  23339. return {
  23340. thumb,
  23341. bar,
  23342. handleDrag,
  23343. handleClick
  23344. };
  23345. };
  23346. const useAlphaSliderDOM = (props, {
  23347. bar,
  23348. thumb,
  23349. handleDrag
  23350. }) => {
  23351. const instance = vue.getCurrentInstance();
  23352. const ns = useNamespace("color-alpha-slider");
  23353. const thumbLeft = vue.ref(0);
  23354. const thumbTop = vue.ref(0);
  23355. const background = vue.ref();
  23356. function getThumbLeft() {
  23357. if (!thumb.value)
  23358. return 0;
  23359. if (props.vertical)
  23360. return 0;
  23361. const el = instance.vnode.el;
  23362. const alpha = props.color.get("alpha");
  23363. if (!el)
  23364. return 0;
  23365. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  23366. }
  23367. function getThumbTop() {
  23368. if (!thumb.value)
  23369. return 0;
  23370. const el = instance.vnode.el;
  23371. if (!props.vertical)
  23372. return 0;
  23373. const alpha = props.color.get("alpha");
  23374. if (!el)
  23375. return 0;
  23376. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  23377. }
  23378. function getBackground() {
  23379. if (props.color && props.color.value) {
  23380. const { r, g, b } = props.color.toRgb();
  23381. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  23382. }
  23383. return "";
  23384. }
  23385. function update() {
  23386. thumbLeft.value = getThumbLeft();
  23387. thumbTop.value = getThumbTop();
  23388. background.value = getBackground();
  23389. }
  23390. vue.onMounted(() => {
  23391. if (!bar.value || !thumb.value)
  23392. return;
  23393. const dragConfig = {
  23394. drag: (event) => {
  23395. handleDrag(event);
  23396. },
  23397. end: (event) => {
  23398. handleDrag(event);
  23399. }
  23400. };
  23401. draggable(bar.value, dragConfig);
  23402. draggable(thumb.value, dragConfig);
  23403. update();
  23404. });
  23405. vue.watch(() => props.color.get("alpha"), () => update());
  23406. vue.watch(() => props.color.value, () => update());
  23407. const rootKls = vue.computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  23408. const barKls = vue.computed(() => ns.e("bar"));
  23409. const thumbKls = vue.computed(() => ns.e("thumb"));
  23410. const barStyle = vue.computed(() => ({ background: background.value }));
  23411. const thumbStyle = vue.computed(() => ({
  23412. left: addUnit(thumbLeft.value),
  23413. top: addUnit(thumbTop.value)
  23414. }));
  23415. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  23416. };
  23417. const COMPONENT_NAME$d = "ElColorAlphaSlider";
  23418. const __default__$Y = vue.defineComponent({
  23419. name: COMPONENT_NAME$d
  23420. });
  23421. const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({
  23422. ...__default__$Y,
  23423. props: alphaSliderProps,
  23424. setup(__props, { expose }) {
  23425. const props = __props;
  23426. const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props);
  23427. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  23428. bar,
  23429. thumb,
  23430. handleDrag
  23431. });
  23432. expose({
  23433. update,
  23434. bar,
  23435. thumb
  23436. });
  23437. return (_ctx, _cache) => {
  23438. return vue.openBlock(), vue.createElementBlock("div", {
  23439. class: vue.normalizeClass(vue.unref(rootKls))
  23440. }, [
  23441. vue.createElementVNode("div", {
  23442. ref_key: "bar",
  23443. ref: bar,
  23444. class: vue.normalizeClass(vue.unref(barKls)),
  23445. style: vue.normalizeStyle(vue.unref(barStyle)),
  23446. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args))
  23447. }, null, 6),
  23448. vue.createElementVNode("div", {
  23449. ref_key: "thumb",
  23450. ref: thumb,
  23451. class: vue.normalizeClass(vue.unref(thumbKls)),
  23452. style: vue.normalizeStyle(vue.unref(thumbStyle))
  23453. }, null, 6)
  23454. ], 2);
  23455. };
  23456. }
  23457. });
  23458. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "alpha-slider.vue"]]);
  23459. const _sfc_main$1u = vue.defineComponent({
  23460. name: "ElColorHueSlider",
  23461. props: {
  23462. color: {
  23463. type: Object,
  23464. required: true
  23465. },
  23466. vertical: Boolean
  23467. },
  23468. setup(props) {
  23469. const ns = useNamespace("color-hue-slider");
  23470. const instance = vue.getCurrentInstance();
  23471. const thumb = vue.ref();
  23472. const bar = vue.ref();
  23473. const thumbLeft = vue.ref(0);
  23474. const thumbTop = vue.ref(0);
  23475. const hueValue = vue.computed(() => {
  23476. return props.color.get("hue");
  23477. });
  23478. vue.watch(() => hueValue.value, () => {
  23479. update();
  23480. });
  23481. function handleClick(event) {
  23482. const target = event.target;
  23483. if (target !== thumb.value) {
  23484. handleDrag(event);
  23485. }
  23486. }
  23487. function handleDrag(event) {
  23488. if (!bar.value || !thumb.value)
  23489. return;
  23490. const el = instance.vnode.el;
  23491. const rect = el.getBoundingClientRect();
  23492. const { clientX, clientY } = getClientXY(event);
  23493. let hue;
  23494. if (!props.vertical) {
  23495. let left = clientX - rect.left;
  23496. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  23497. left = Math.max(thumb.value.offsetWidth / 2, left);
  23498. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  23499. } else {
  23500. let top = clientY - rect.top;
  23501. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  23502. top = Math.max(thumb.value.offsetHeight / 2, top);
  23503. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  23504. }
  23505. props.color.set("hue", hue);
  23506. }
  23507. function getThumbLeft() {
  23508. if (!thumb.value)
  23509. return 0;
  23510. const el = instance.vnode.el;
  23511. if (props.vertical)
  23512. return 0;
  23513. const hue = props.color.get("hue");
  23514. if (!el)
  23515. return 0;
  23516. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  23517. }
  23518. function getThumbTop() {
  23519. if (!thumb.value)
  23520. return 0;
  23521. const el = instance.vnode.el;
  23522. if (!props.vertical)
  23523. return 0;
  23524. const hue = props.color.get("hue");
  23525. if (!el)
  23526. return 0;
  23527. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  23528. }
  23529. function update() {
  23530. thumbLeft.value = getThumbLeft();
  23531. thumbTop.value = getThumbTop();
  23532. }
  23533. vue.onMounted(() => {
  23534. if (!bar.value || !thumb.value)
  23535. return;
  23536. const dragConfig = {
  23537. drag: (event) => {
  23538. handleDrag(event);
  23539. },
  23540. end: (event) => {
  23541. handleDrag(event);
  23542. }
  23543. };
  23544. draggable(bar.value, dragConfig);
  23545. draggable(thumb.value, dragConfig);
  23546. update();
  23547. });
  23548. return {
  23549. bar,
  23550. thumb,
  23551. thumbLeft,
  23552. thumbTop,
  23553. hueValue,
  23554. handleClick,
  23555. update,
  23556. ns
  23557. };
  23558. }
  23559. });
  23560. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  23561. return vue.openBlock(), vue.createElementBlock("div", {
  23562. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  23563. }, [
  23564. vue.createElementVNode("div", {
  23565. ref: "bar",
  23566. class: vue.normalizeClass(_ctx.ns.e("bar")),
  23567. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  23568. }, null, 2),
  23569. vue.createElementVNode("div", {
  23570. ref: "thumb",
  23571. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  23572. style: vue.normalizeStyle({
  23573. left: _ctx.thumbLeft + "px",
  23574. top: _ctx.thumbTop + "px"
  23575. })
  23576. }, null, 6)
  23577. ], 2);
  23578. }
  23579. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["render", _sfc_render$r], ["__file", "hue-slider.vue"]]);
  23580. const colorPickerProps = buildProps({
  23581. modelValue: String,
  23582. id: String,
  23583. showAlpha: Boolean,
  23584. colorFormat: String,
  23585. disabled: Boolean,
  23586. size: useSizeProp,
  23587. popperClass: {
  23588. type: String,
  23589. default: ""
  23590. },
  23591. label: {
  23592. type: String,
  23593. default: void 0
  23594. },
  23595. tabindex: {
  23596. type: [String, Number],
  23597. default: 0
  23598. },
  23599. predefine: {
  23600. type: definePropType(Array)
  23601. },
  23602. validateEvent: {
  23603. type: Boolean,
  23604. default: true
  23605. }
  23606. });
  23607. const colorPickerEmits = {
  23608. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  23609. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  23610. activeChange: (val) => isString$1(val) || isNil(val)
  23611. };
  23612. const colorPickerContextKey = Symbol("colorPickerContextKey");
  23613. const hsv2hsl = function(hue, sat, val) {
  23614. return [
  23615. hue,
  23616. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  23617. hue / 2
  23618. ];
  23619. };
  23620. const isOnePointZero = function(n) {
  23621. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  23622. };
  23623. const isPercentage = function(n) {
  23624. return typeof n === "string" && n.includes("%");
  23625. };
  23626. const bound01 = function(value, max) {
  23627. if (isOnePointZero(value))
  23628. value = "100%";
  23629. const processPercent = isPercentage(value);
  23630. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  23631. if (processPercent) {
  23632. value = Number.parseInt(`${value * max}`, 10) / 100;
  23633. }
  23634. if (Math.abs(value - max) < 1e-6) {
  23635. return 1;
  23636. }
  23637. return value % max / Number.parseFloat(max);
  23638. };
  23639. const INT_HEX_MAP = {
  23640. 10: "A",
  23641. 11: "B",
  23642. 12: "C",
  23643. 13: "D",
  23644. 14: "E",
  23645. 15: "F"
  23646. };
  23647. const hexOne = (value) => {
  23648. value = Math.min(Math.round(value), 255);
  23649. const high = Math.floor(value / 16);
  23650. const low = value % 16;
  23651. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  23652. };
  23653. const toHex = function({ r, g, b }) {
  23654. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  23655. return "";
  23656. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  23657. };
  23658. const HEX_INT_MAP = {
  23659. A: 10,
  23660. B: 11,
  23661. C: 12,
  23662. D: 13,
  23663. E: 14,
  23664. F: 15
  23665. };
  23666. const parseHexChannel = function(hex) {
  23667. if (hex.length === 2) {
  23668. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  23669. }
  23670. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  23671. };
  23672. const hsl2hsv = function(hue, sat, light) {
  23673. sat = sat / 100;
  23674. light = light / 100;
  23675. let smin = sat;
  23676. const lmin = Math.max(light, 0.01);
  23677. light *= 2;
  23678. sat *= light <= 1 ? light : 2 - light;
  23679. smin *= lmin <= 1 ? lmin : 2 - lmin;
  23680. const v = (light + sat) / 2;
  23681. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  23682. return {
  23683. h: hue,
  23684. s: sv * 100,
  23685. v: v * 100
  23686. };
  23687. };
  23688. const rgb2hsv = (r, g, b) => {
  23689. r = bound01(r, 255);
  23690. g = bound01(g, 255);
  23691. b = bound01(b, 255);
  23692. const max = Math.max(r, g, b);
  23693. const min = Math.min(r, g, b);
  23694. let h;
  23695. const v = max;
  23696. const d = max - min;
  23697. const s = max === 0 ? 0 : d / max;
  23698. if (max === min) {
  23699. h = 0;
  23700. } else {
  23701. switch (max) {
  23702. case r: {
  23703. h = (g - b) / d + (g < b ? 6 : 0);
  23704. break;
  23705. }
  23706. case g: {
  23707. h = (b - r) / d + 2;
  23708. break;
  23709. }
  23710. case b: {
  23711. h = (r - g) / d + 4;
  23712. break;
  23713. }
  23714. }
  23715. h /= 6;
  23716. }
  23717. return { h: h * 360, s: s * 100, v: v * 100 };
  23718. };
  23719. const hsv2rgb = function(h, s, v) {
  23720. h = bound01(h, 360) * 6;
  23721. s = bound01(s, 100);
  23722. v = bound01(v, 100);
  23723. const i = Math.floor(h);
  23724. const f = h - i;
  23725. const p = v * (1 - s);
  23726. const q = v * (1 - f * s);
  23727. const t = v * (1 - (1 - f) * s);
  23728. const mod = i % 6;
  23729. const r = [v, q, p, p, t, v][mod];
  23730. const g = [t, v, v, q, p, p][mod];
  23731. const b = [p, p, t, v, v, q][mod];
  23732. return {
  23733. r: Math.round(r * 255),
  23734. g: Math.round(g * 255),
  23735. b: Math.round(b * 255)
  23736. };
  23737. };
  23738. class Color {
  23739. constructor(options = {}) {
  23740. this._hue = 0;
  23741. this._saturation = 100;
  23742. this._value = 100;
  23743. this._alpha = 100;
  23744. this.enableAlpha = false;
  23745. this.format = "hex";
  23746. this.value = "";
  23747. for (const option in options) {
  23748. if (hasOwn(options, option)) {
  23749. this[option] = options[option];
  23750. }
  23751. }
  23752. if (options.value) {
  23753. this.fromString(options.value);
  23754. } else {
  23755. this.doOnChange();
  23756. }
  23757. }
  23758. set(prop, value) {
  23759. if (arguments.length === 1 && typeof prop === "object") {
  23760. for (const p in prop) {
  23761. if (hasOwn(prop, p)) {
  23762. this.set(p, prop[p]);
  23763. }
  23764. }
  23765. return;
  23766. }
  23767. this[`_${prop}`] = value;
  23768. this.doOnChange();
  23769. }
  23770. get(prop) {
  23771. if (prop === "alpha") {
  23772. return Math.floor(this[`_${prop}`]);
  23773. }
  23774. return this[`_${prop}`];
  23775. }
  23776. toRgb() {
  23777. return hsv2rgb(this._hue, this._saturation, this._value);
  23778. }
  23779. fromString(value) {
  23780. if (!value) {
  23781. this._hue = 0;
  23782. this._saturation = 100;
  23783. this._value = 100;
  23784. this.doOnChange();
  23785. return;
  23786. }
  23787. const fromHSV = (h, s, v) => {
  23788. this._hue = Math.max(0, Math.min(360, h));
  23789. this._saturation = Math.max(0, Math.min(100, s));
  23790. this._value = Math.max(0, Math.min(100, v));
  23791. this.doOnChange();
  23792. };
  23793. if (value.includes("hsl")) {
  23794. const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23795. if (parts.length === 4) {
  23796. this._alpha = Number.parseFloat(parts[3]) * 100;
  23797. } else if (parts.length === 3) {
  23798. this._alpha = 100;
  23799. }
  23800. if (parts.length >= 3) {
  23801. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  23802. fromHSV(h, s, v);
  23803. }
  23804. } else if (value.includes("hsv")) {
  23805. const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23806. if (parts.length === 4) {
  23807. this._alpha = Number.parseFloat(parts[3]) * 100;
  23808. } else if (parts.length === 3) {
  23809. this._alpha = 100;
  23810. }
  23811. if (parts.length >= 3) {
  23812. fromHSV(parts[0], parts[1], parts[2]);
  23813. }
  23814. } else if (value.includes("rgb")) {
  23815. const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23816. if (parts.length === 4) {
  23817. this._alpha = Number.parseFloat(parts[3]) * 100;
  23818. } else if (parts.length === 3) {
  23819. this._alpha = 100;
  23820. }
  23821. if (parts.length >= 3) {
  23822. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  23823. fromHSV(h, s, v);
  23824. }
  23825. } else if (value.includes("#")) {
  23826. const hex = value.replace("#", "").trim();
  23827. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  23828. return;
  23829. let r, g, b;
  23830. if (hex.length === 3) {
  23831. r = parseHexChannel(hex[0] + hex[0]);
  23832. g = parseHexChannel(hex[1] + hex[1]);
  23833. b = parseHexChannel(hex[2] + hex[2]);
  23834. } else if (hex.length === 6 || hex.length === 8) {
  23835. r = parseHexChannel(hex.slice(0, 2));
  23836. g = parseHexChannel(hex.slice(2, 4));
  23837. b = parseHexChannel(hex.slice(4, 6));
  23838. }
  23839. if (hex.length === 8) {
  23840. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  23841. } else if (hex.length === 3 || hex.length === 6) {
  23842. this._alpha = 100;
  23843. }
  23844. const { h, s, v } = rgb2hsv(r, g, b);
  23845. fromHSV(h, s, v);
  23846. }
  23847. }
  23848. compare(color) {
  23849. return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1;
  23850. }
  23851. doOnChange() {
  23852. const { _hue, _saturation, _value, _alpha, format } = this;
  23853. if (this.enableAlpha) {
  23854. switch (format) {
  23855. case "hsl": {
  23856. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23857. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  23858. break;
  23859. }
  23860. case "hsv": {
  23861. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  23862. break;
  23863. }
  23864. case "hex": {
  23865. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  23866. break;
  23867. }
  23868. default: {
  23869. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  23870. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  23871. }
  23872. }
  23873. } else {
  23874. switch (format) {
  23875. case "hsl": {
  23876. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23877. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  23878. break;
  23879. }
  23880. case "hsv": {
  23881. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  23882. break;
  23883. }
  23884. case "rgb": {
  23885. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  23886. this.value = `rgb(${r}, ${g}, ${b})`;
  23887. break;
  23888. }
  23889. default: {
  23890. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  23891. }
  23892. }
  23893. }
  23894. }
  23895. }
  23896. const _sfc_main$1t = vue.defineComponent({
  23897. props: {
  23898. colors: {
  23899. type: Array,
  23900. required: true
  23901. },
  23902. color: {
  23903. type: Object,
  23904. required: true
  23905. }
  23906. },
  23907. setup(props) {
  23908. const ns = useNamespace("color-predefine");
  23909. const { currentColor } = vue.inject(colorPickerContextKey);
  23910. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  23911. vue.watch(() => currentColor.value, (val) => {
  23912. const color = new Color();
  23913. color.fromString(val);
  23914. rgbaColors.value.forEach((item) => {
  23915. item.selected = color.compare(item);
  23916. });
  23917. });
  23918. vue.watchEffect(() => {
  23919. rgbaColors.value = parseColors(props.colors, props.color);
  23920. });
  23921. function handleSelect(index) {
  23922. props.color.fromString(props.colors[index]);
  23923. }
  23924. function parseColors(colors, color) {
  23925. return colors.map((value) => {
  23926. const c = new Color();
  23927. c.enableAlpha = true;
  23928. c.format = "rgba";
  23929. c.fromString(value);
  23930. c.selected = c.value === color.value;
  23931. return c;
  23932. });
  23933. }
  23934. return {
  23935. rgbaColors,
  23936. handleSelect,
  23937. ns
  23938. };
  23939. }
  23940. });
  23941. const _hoisted_1$L = ["onClick"];
  23942. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  23943. return vue.openBlock(), vue.createElementBlock("div", {
  23944. class: vue.normalizeClass(_ctx.ns.b())
  23945. }, [
  23946. vue.createElementVNode("div", {
  23947. class: vue.normalizeClass(_ctx.ns.e("colors"))
  23948. }, [
  23949. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => {
  23950. return vue.openBlock(), vue.createElementBlock("div", {
  23951. key: _ctx.colors[index],
  23952. class: vue.normalizeClass([
  23953. _ctx.ns.e("color-selector"),
  23954. _ctx.ns.is("alpha", item._alpha < 100),
  23955. { selected: item.selected }
  23956. ]),
  23957. onClick: ($event) => _ctx.handleSelect(index)
  23958. }, [
  23959. vue.createElementVNode("div", {
  23960. style: vue.normalizeStyle({ backgroundColor: item.value })
  23961. }, null, 4)
  23962. ], 10, _hoisted_1$L);
  23963. }), 128))
  23964. ], 2)
  23965. ], 2);
  23966. }
  23967. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["render", _sfc_render$q], ["__file", "predefine.vue"]]);
  23968. const _sfc_main$1s = vue.defineComponent({
  23969. name: "ElSlPanel",
  23970. props: {
  23971. color: {
  23972. type: Object,
  23973. required: true
  23974. }
  23975. },
  23976. setup(props) {
  23977. const ns = useNamespace("color-svpanel");
  23978. const instance = vue.getCurrentInstance();
  23979. const cursorTop = vue.ref(0);
  23980. const cursorLeft = vue.ref(0);
  23981. const background = vue.ref("hsl(0, 100%, 50%)");
  23982. const colorValue = vue.computed(() => {
  23983. const hue = props.color.get("hue");
  23984. const value = props.color.get("value");
  23985. return { hue, value };
  23986. });
  23987. function update() {
  23988. const saturation = props.color.get("saturation");
  23989. const value = props.color.get("value");
  23990. const el = instance.vnode.el;
  23991. const { clientWidth: width, clientHeight: height } = el;
  23992. cursorLeft.value = saturation * width / 100;
  23993. cursorTop.value = (100 - value) * height / 100;
  23994. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  23995. }
  23996. function handleDrag(event) {
  23997. const el = instance.vnode.el;
  23998. const rect = el.getBoundingClientRect();
  23999. const { clientX, clientY } = getClientXY(event);
  24000. let left = clientX - rect.left;
  24001. let top = clientY - rect.top;
  24002. left = Math.max(0, left);
  24003. left = Math.min(left, rect.width);
  24004. top = Math.max(0, top);
  24005. top = Math.min(top, rect.height);
  24006. cursorLeft.value = left;
  24007. cursorTop.value = top;
  24008. props.color.set({
  24009. saturation: left / rect.width * 100,
  24010. value: 100 - top / rect.height * 100
  24011. });
  24012. }
  24013. vue.watch(() => colorValue.value, () => {
  24014. update();
  24015. });
  24016. vue.onMounted(() => {
  24017. draggable(instance.vnode.el, {
  24018. drag: (event) => {
  24019. handleDrag(event);
  24020. },
  24021. end: (event) => {
  24022. handleDrag(event);
  24023. }
  24024. });
  24025. update();
  24026. });
  24027. return {
  24028. cursorTop,
  24029. cursorLeft,
  24030. background,
  24031. colorValue,
  24032. handleDrag,
  24033. update,
  24034. ns
  24035. };
  24036. }
  24037. });
  24038. const _hoisted_1$K = /* @__PURE__ */ vue.createElementVNode("div", null, null, -1);
  24039. const _hoisted_2$u = [
  24040. _hoisted_1$K
  24041. ];
  24042. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  24043. return vue.openBlock(), vue.createElementBlock("div", {
  24044. class: vue.normalizeClass(_ctx.ns.b()),
  24045. style: vue.normalizeStyle({
  24046. backgroundColor: _ctx.background
  24047. })
  24048. }, [
  24049. vue.createElementVNode("div", {
  24050. class: vue.normalizeClass(_ctx.ns.e("white"))
  24051. }, null, 2),
  24052. vue.createElementVNode("div", {
  24053. class: vue.normalizeClass(_ctx.ns.e("black"))
  24054. }, null, 2),
  24055. vue.createElementVNode("div", {
  24056. class: vue.normalizeClass(_ctx.ns.e("cursor")),
  24057. style: vue.normalizeStyle({
  24058. top: _ctx.cursorTop + "px",
  24059. left: _ctx.cursorLeft + "px"
  24060. })
  24061. }, _hoisted_2$u, 6)
  24062. ], 6);
  24063. }
  24064. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["render", _sfc_render$p], ["__file", "sv-panel.vue"]]);
  24065. const _hoisted_1$J = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"];
  24066. const __default__$X = vue.defineComponent({
  24067. name: "ElColorPicker"
  24068. });
  24069. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  24070. ...__default__$X,
  24071. props: colorPickerProps,
  24072. emits: colorPickerEmits,
  24073. setup(__props, { expose, emit }) {
  24074. const props = __props;
  24075. const { t } = useLocale();
  24076. const ns = useNamespace("color");
  24077. const { formItem } = useFormItem();
  24078. const colorSize = useFormSize();
  24079. const colorDisabled = useFormDisabled();
  24080. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  24081. formItemContext: formItem
  24082. });
  24083. const hue = vue.ref();
  24084. const sv = vue.ref();
  24085. const alpha = vue.ref();
  24086. const popper = vue.ref();
  24087. let shouldActiveChange = true;
  24088. const color = vue.reactive(new Color({
  24089. enableAlpha: props.showAlpha,
  24090. format: props.colorFormat || "",
  24091. value: props.modelValue
  24092. }));
  24093. const showPicker = vue.ref(false);
  24094. const showPanelColor = vue.ref(false);
  24095. const customInput = vue.ref("");
  24096. const displayedColor = vue.computed(() => {
  24097. if (!props.modelValue && !showPanelColor.value) {
  24098. return "transparent";
  24099. }
  24100. return displayedRgb(color, props.showAlpha);
  24101. });
  24102. const currentColor = vue.computed(() => {
  24103. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  24104. });
  24105. const buttonAriaLabel = vue.computed(() => {
  24106. return !isLabeledByFormItem.value ? props.label || t("el.colorpicker.defaultLabel") : void 0;
  24107. });
  24108. const buttonAriaLabelledby = vue.computed(() => {
  24109. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  24110. });
  24111. const btnKls = vue.computed(() => {
  24112. return [
  24113. ns.b("picker"),
  24114. ns.is("disabled", colorDisabled.value),
  24115. ns.bm("picker", colorSize.value)
  24116. ];
  24117. });
  24118. function displayedRgb(color2, showAlpha) {
  24119. if (!(color2 instanceof Color)) {
  24120. throw new TypeError("color should be instance of _color Class");
  24121. }
  24122. const { r, g, b } = color2.toRgb();
  24123. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  24124. }
  24125. function setShowPicker(value) {
  24126. showPicker.value = value;
  24127. }
  24128. const debounceSetShowPicker = debounce(setShowPicker, 100);
  24129. function show() {
  24130. if (colorDisabled.value)
  24131. return;
  24132. setShowPicker(true);
  24133. }
  24134. function hide() {
  24135. debounceSetShowPicker(false);
  24136. resetColor();
  24137. }
  24138. function resetColor() {
  24139. vue.nextTick(() => {
  24140. if (props.modelValue) {
  24141. color.fromString(props.modelValue);
  24142. } else {
  24143. color.value = "";
  24144. vue.nextTick(() => {
  24145. showPanelColor.value = false;
  24146. });
  24147. }
  24148. });
  24149. }
  24150. function handleTrigger() {
  24151. if (colorDisabled.value)
  24152. return;
  24153. debounceSetShowPicker(!showPicker.value);
  24154. }
  24155. function handleConfirm() {
  24156. color.fromString(customInput.value);
  24157. }
  24158. function confirmValue() {
  24159. const value = color.value;
  24160. emit(UPDATE_MODEL_EVENT, value);
  24161. emit("change", value);
  24162. if (props.validateEvent) {
  24163. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24164. }
  24165. debounceSetShowPicker(false);
  24166. vue.nextTick(() => {
  24167. const newColor = new Color({
  24168. enableAlpha: props.showAlpha,
  24169. format: props.colorFormat || "",
  24170. value: props.modelValue
  24171. });
  24172. if (!color.compare(newColor)) {
  24173. resetColor();
  24174. }
  24175. });
  24176. }
  24177. function clear() {
  24178. debounceSetShowPicker(false);
  24179. emit(UPDATE_MODEL_EVENT, null);
  24180. emit("change", null);
  24181. if (props.modelValue !== null && props.validateEvent) {
  24182. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24183. }
  24184. resetColor();
  24185. }
  24186. vue.onMounted(() => {
  24187. if (props.modelValue) {
  24188. customInput.value = currentColor.value;
  24189. }
  24190. });
  24191. vue.watch(() => props.modelValue, (newVal) => {
  24192. if (!newVal) {
  24193. showPanelColor.value = false;
  24194. } else if (newVal && newVal !== color.value) {
  24195. shouldActiveChange = false;
  24196. color.fromString(newVal);
  24197. }
  24198. });
  24199. vue.watch(() => currentColor.value, (val) => {
  24200. customInput.value = val;
  24201. shouldActiveChange && emit("activeChange", val);
  24202. shouldActiveChange = true;
  24203. });
  24204. vue.watch(() => color.value, () => {
  24205. if (!props.modelValue && !showPanelColor.value) {
  24206. showPanelColor.value = true;
  24207. }
  24208. });
  24209. vue.watch(() => showPicker.value, () => {
  24210. vue.nextTick(() => {
  24211. var _a, _b, _c;
  24212. (_a = hue.value) == null ? void 0 : _a.update();
  24213. (_b = sv.value) == null ? void 0 : _b.update();
  24214. (_c = alpha.value) == null ? void 0 : _c.update();
  24215. });
  24216. });
  24217. vue.provide(colorPickerContextKey, {
  24218. currentColor
  24219. });
  24220. expose({
  24221. color,
  24222. show,
  24223. hide
  24224. });
  24225. return (_ctx, _cache) => {
  24226. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  24227. ref_key: "popper",
  24228. ref: popper,
  24229. visible: showPicker.value,
  24230. "show-arrow": false,
  24231. "fallback-placements": ["bottom", "top", "right", "left"],
  24232. offset: 0,
  24233. "gpu-acceleration": false,
  24234. "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass],
  24235. "stop-popper-mouse-event": false,
  24236. effect: "light",
  24237. trigger: "click",
  24238. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  24239. persistent: ""
  24240. }, {
  24241. content: vue.withCtx(() => [
  24242. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", null, [
  24243. vue.createElementVNode("div", {
  24244. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper"))
  24245. }, [
  24246. vue.createVNode(HueSlider, {
  24247. ref_key: "hue",
  24248. ref: hue,
  24249. class: "hue-slider",
  24250. color: vue.unref(color),
  24251. vertical: ""
  24252. }, null, 8, ["color"]),
  24253. vue.createVNode(SvPanel, {
  24254. ref: "svPanel",
  24255. color: vue.unref(color)
  24256. }, null, 8, ["color"])
  24257. ], 2),
  24258. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  24259. key: 0,
  24260. ref_key: "alpha",
  24261. ref: alpha,
  24262. color: vue.unref(color)
  24263. }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
  24264. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  24265. key: 1,
  24266. ref: "predefine",
  24267. color: vue.unref(color),
  24268. colors: _ctx.predefine
  24269. }, null, 8, ["color", "colors"])) : vue.createCommentVNode("v-if", true),
  24270. vue.createElementVNode("div", {
  24271. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns"))
  24272. }, [
  24273. vue.createElementVNode("span", {
  24274. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value"))
  24275. }, [
  24276. vue.createVNode(vue.unref(ElInput), {
  24277. modelValue: customInput.value,
  24278. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  24279. "validate-event": false,
  24280. size: "small",
  24281. onKeyup: vue.withKeys(handleConfirm, ["enter"]),
  24282. onBlur: handleConfirm
  24283. }, null, 8, ["modelValue", "onKeyup"])
  24284. ], 2),
  24285. vue.createVNode(vue.unref(ElButton), {
  24286. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")),
  24287. text: "",
  24288. size: "small",
  24289. onClick: clear
  24290. }, {
  24291. default: vue.withCtx(() => [
  24292. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  24293. ]),
  24294. _: 1
  24295. }, 8, ["class"]),
  24296. vue.createVNode(vue.unref(ElButton), {
  24297. plain: "",
  24298. size: "small",
  24299. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")),
  24300. onClick: confirmValue
  24301. }, {
  24302. default: vue.withCtx(() => [
  24303. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  24304. ]),
  24305. _: 1
  24306. }, 8, ["class"])
  24307. ], 2)
  24308. ])), [
  24309. [vue.unref(ClickOutside), hide]
  24310. ])
  24311. ]),
  24312. default: vue.withCtx(() => [
  24313. vue.createElementVNode("div", {
  24314. id: vue.unref(buttonId),
  24315. class: vue.normalizeClass(vue.unref(btnKls)),
  24316. role: "button",
  24317. "aria-label": vue.unref(buttonAriaLabel),
  24318. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  24319. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  24320. tabindex: _ctx.tabindex,
  24321. onKeydown: vue.withKeys(handleTrigger, ["enter"])
  24322. }, [
  24323. vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", {
  24324. key: 0,
  24325. class: vue.normalizeClass(vue.unref(ns).be("picker", "mask"))
  24326. }, null, 2)) : vue.createCommentVNode("v-if", true),
  24327. vue.createElementVNode("div", {
  24328. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  24329. onClick: handleTrigger
  24330. }, [
  24331. vue.createElementVNode("span", {
  24332. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  24333. }, [
  24334. vue.createElementVNode("span", {
  24335. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  24336. style: vue.normalizeStyle({
  24337. backgroundColor: vue.unref(displayedColor)
  24338. })
  24339. }, [
  24340. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  24341. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  24342. }, {
  24343. default: vue.withCtx(() => [
  24344. vue.createVNode(vue.unref(arrow_down_default))
  24345. ]),
  24346. _: 1
  24347. }, 8, ["class"]), [
  24348. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  24349. ]),
  24350. !_ctx.modelValue && !showPanelColor.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  24351. key: 0,
  24352. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  24353. }, {
  24354. default: vue.withCtx(() => [
  24355. vue.createVNode(vue.unref(close_default))
  24356. ]),
  24357. _: 1
  24358. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  24359. ], 6)
  24360. ], 2)
  24361. ], 2)
  24362. ], 42, _hoisted_1$J)
  24363. ]),
  24364. _: 1
  24365. }, 8, ["visible", "popper-class", "transition"]);
  24366. };
  24367. }
  24368. });
  24369. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "color-picker.vue"]]);
  24370. const ElColorPicker = withInstall(ColorPicker);
  24371. const __default__$W = vue.defineComponent({
  24372. name: "ElContainer"
  24373. });
  24374. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  24375. ...__default__$W,
  24376. props: {
  24377. direction: {
  24378. type: String
  24379. }
  24380. },
  24381. setup(__props) {
  24382. const props = __props;
  24383. const slots = vue.useSlots();
  24384. const ns = useNamespace("container");
  24385. const isVertical = vue.computed(() => {
  24386. if (props.direction === "vertical") {
  24387. return true;
  24388. } else if (props.direction === "horizontal") {
  24389. return false;
  24390. }
  24391. if (slots && slots.default) {
  24392. const vNodes = slots.default();
  24393. return vNodes.some((vNode) => {
  24394. const tag = vNode.type.name;
  24395. return tag === "ElHeader" || tag === "ElFooter";
  24396. });
  24397. } else {
  24398. return false;
  24399. }
  24400. });
  24401. return (_ctx, _cache) => {
  24402. return vue.openBlock(), vue.createElementBlock("section", {
  24403. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  24404. }, [
  24405. vue.renderSlot(_ctx.$slots, "default")
  24406. ], 2);
  24407. };
  24408. }
  24409. });
  24410. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "container.vue"]]);
  24411. const __default__$V = vue.defineComponent({
  24412. name: "ElAside"
  24413. });
  24414. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  24415. ...__default__$V,
  24416. props: {
  24417. width: {
  24418. type: String,
  24419. default: null
  24420. }
  24421. },
  24422. setup(__props) {
  24423. const props = __props;
  24424. const ns = useNamespace("aside");
  24425. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  24426. return (_ctx, _cache) => {
  24427. return vue.openBlock(), vue.createElementBlock("aside", {
  24428. class: vue.normalizeClass(vue.unref(ns).b()),
  24429. style: vue.normalizeStyle(vue.unref(style))
  24430. }, [
  24431. vue.renderSlot(_ctx.$slots, "default")
  24432. ], 6);
  24433. };
  24434. }
  24435. });
  24436. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "aside.vue"]]);
  24437. const __default__$U = vue.defineComponent({
  24438. name: "ElFooter"
  24439. });
  24440. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  24441. ...__default__$U,
  24442. props: {
  24443. height: {
  24444. type: String,
  24445. default: null
  24446. }
  24447. },
  24448. setup(__props) {
  24449. const props = __props;
  24450. const ns = useNamespace("footer");
  24451. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  24452. return (_ctx, _cache) => {
  24453. return vue.openBlock(), vue.createElementBlock("footer", {
  24454. class: vue.normalizeClass(vue.unref(ns).b()),
  24455. style: vue.normalizeStyle(vue.unref(style))
  24456. }, [
  24457. vue.renderSlot(_ctx.$slots, "default")
  24458. ], 6);
  24459. };
  24460. }
  24461. });
  24462. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "footer.vue"]]);
  24463. const __default__$T = vue.defineComponent({
  24464. name: "ElHeader"
  24465. });
  24466. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  24467. ...__default__$T,
  24468. props: {
  24469. height: {
  24470. type: String,
  24471. default: null
  24472. }
  24473. },
  24474. setup(__props) {
  24475. const props = __props;
  24476. const ns = useNamespace("header");
  24477. const style = vue.computed(() => {
  24478. return props.height ? ns.cssVarBlock({
  24479. height: props.height
  24480. }) : {};
  24481. });
  24482. return (_ctx, _cache) => {
  24483. return vue.openBlock(), vue.createElementBlock("header", {
  24484. class: vue.normalizeClass(vue.unref(ns).b()),
  24485. style: vue.normalizeStyle(vue.unref(style))
  24486. }, [
  24487. vue.renderSlot(_ctx.$slots, "default")
  24488. ], 6);
  24489. };
  24490. }
  24491. });
  24492. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "header.vue"]]);
  24493. const __default__$S = vue.defineComponent({
  24494. name: "ElMain"
  24495. });
  24496. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  24497. ...__default__$S,
  24498. setup(__props) {
  24499. const ns = useNamespace("main");
  24500. return (_ctx, _cache) => {
  24501. return vue.openBlock(), vue.createElementBlock("main", {
  24502. class: vue.normalizeClass(vue.unref(ns).b())
  24503. }, [
  24504. vue.renderSlot(_ctx.$slots, "default")
  24505. ], 2);
  24506. };
  24507. }
  24508. });
  24509. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "main.vue"]]);
  24510. const ElContainer = withInstall(Container, {
  24511. Aside,
  24512. Footer: Footer$2,
  24513. Header: Header$1,
  24514. Main
  24515. });
  24516. const ElAside = withNoopInstall(Aside);
  24517. const ElFooter = withNoopInstall(Footer$2);
  24518. const ElHeader = withNoopInstall(Header$1);
  24519. const ElMain = withNoopInstall(Main);
  24520. var advancedFormat$1 = {exports: {}};
  24521. (function(module, exports) {
  24522. !function(e, t) {
  24523. module.exports = t() ;
  24524. }(commonjsGlobal, function() {
  24525. return function(e, t, r) {
  24526. var n = t.prototype, s = n.format;
  24527. r.en.ordinal = function(e2) {
  24528. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  24529. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  24530. }, n.format = function(e2) {
  24531. var t2 = this, r2 = this.$locale();
  24532. if (!this.isValid())
  24533. return s.bind(this)(e2);
  24534. var n2 = this.$utils(), a = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  24535. switch (e3) {
  24536. case "Q":
  24537. return Math.ceil((t2.$M + 1) / 3);
  24538. case "Do":
  24539. return r2.ordinal(t2.$D);
  24540. case "gggg":
  24541. return t2.weekYear();
  24542. case "GGGG":
  24543. return t2.isoWeekYear();
  24544. case "wo":
  24545. return r2.ordinal(t2.week(), "W");
  24546. case "w":
  24547. case "ww":
  24548. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  24549. case "W":
  24550. case "WW":
  24551. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  24552. case "k":
  24553. case "kk":
  24554. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  24555. case "X":
  24556. return Math.floor(t2.$d.getTime() / 1e3);
  24557. case "x":
  24558. return t2.$d.getTime();
  24559. case "z":
  24560. return "[" + t2.offsetName() + "]";
  24561. case "zzz":
  24562. return "[" + t2.offsetName("long") + "]";
  24563. default:
  24564. return e3;
  24565. }
  24566. });
  24567. return s.bind(this)(a);
  24568. };
  24569. };
  24570. });
  24571. })(advancedFormat$1);
  24572. var advancedFormat = advancedFormat$1.exports;
  24573. var weekOfYear$1 = {exports: {}};
  24574. (function(module, exports) {
  24575. !function(e, t) {
  24576. module.exports = t() ;
  24577. }(commonjsGlobal, function() {
  24578. var e = "week", t = "year";
  24579. return function(i, n, r) {
  24580. var f = n.prototype;
  24581. f.week = function(i2) {
  24582. if (i2 === void 0 && (i2 = null), i2 !== null)
  24583. return this.add(7 * (i2 - this.week()), "day");
  24584. var n2 = this.$locale().yearStart || 1;
  24585. if (this.month() === 11 && this.date() > 25) {
  24586. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  24587. if (f2.isBefore(s))
  24588. return 1;
  24589. }
  24590. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  24591. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  24592. }, f.weeks = function(e2) {
  24593. return e2 === void 0 && (e2 = null), this.week(e2);
  24594. };
  24595. };
  24596. });
  24597. })(weekOfYear$1);
  24598. var weekOfYear = weekOfYear$1.exports;
  24599. var weekYear$1 = {exports: {}};
  24600. (function(module, exports) {
  24601. !function(e, t) {
  24602. module.exports = t() ;
  24603. }(commonjsGlobal, function() {
  24604. return function(e, t) {
  24605. t.prototype.weekYear = function() {
  24606. var e2 = this.month(), t2 = this.week(), n = this.year();
  24607. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  24608. };
  24609. };
  24610. });
  24611. })(weekYear$1);
  24612. var weekYear = weekYear$1.exports;
  24613. var dayOfYear$1 = {exports: {}};
  24614. (function(module, exports) {
  24615. !function(e, t) {
  24616. module.exports = t() ;
  24617. }(commonjsGlobal, function() {
  24618. return function(e, t, n) {
  24619. t.prototype.dayOfYear = function(e2) {
  24620. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  24621. return e2 == null ? t2 : this.add(e2 - t2, "day");
  24622. };
  24623. };
  24624. });
  24625. })(dayOfYear$1);
  24626. var dayOfYear = dayOfYear$1.exports;
  24627. var isSameOrAfter$1 = {exports: {}};
  24628. (function(module, exports) {
  24629. !function(e, t) {
  24630. module.exports = t() ;
  24631. }(commonjsGlobal, function() {
  24632. return function(e, t) {
  24633. t.prototype.isSameOrAfter = function(e2, t2) {
  24634. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  24635. };
  24636. };
  24637. });
  24638. })(isSameOrAfter$1);
  24639. var isSameOrAfter = isSameOrAfter$1.exports;
  24640. var isSameOrBefore$1 = {exports: {}};
  24641. (function(module, exports) {
  24642. !function(e, i) {
  24643. module.exports = i() ;
  24644. }(commonjsGlobal, function() {
  24645. return function(e, i) {
  24646. i.prototype.isSameOrBefore = function(e2, i2) {
  24647. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  24648. };
  24649. };
  24650. });
  24651. })(isSameOrBefore$1);
  24652. var isSameOrBefore = isSameOrBefore$1.exports;
  24653. const ROOT_PICKER_INJECTION_KEY = Symbol();
  24654. const datePickerProps = buildProps({
  24655. type: {
  24656. type: definePropType(String),
  24657. default: "date"
  24658. }
  24659. });
  24660. const selectionModes = ["date", "dates", "year", "month", "week", "range"];
  24661. const datePickerSharedProps = buildProps({
  24662. disabledDate: {
  24663. type: definePropType(Function)
  24664. },
  24665. date: {
  24666. type: definePropType(Object),
  24667. required: true
  24668. },
  24669. minDate: {
  24670. type: definePropType(Object)
  24671. },
  24672. maxDate: {
  24673. type: definePropType(Object)
  24674. },
  24675. parsedValue: {
  24676. type: definePropType([Object, Array])
  24677. },
  24678. rangeState: {
  24679. type: definePropType(Object),
  24680. default: () => ({
  24681. endDate: null,
  24682. selecting: false
  24683. })
  24684. }
  24685. });
  24686. const panelSharedProps = buildProps({
  24687. type: {
  24688. type: definePropType(String),
  24689. required: true,
  24690. values: datePickTypes
  24691. }
  24692. });
  24693. const panelRangeSharedProps = buildProps({
  24694. unlinkPanels: Boolean,
  24695. parsedValue: {
  24696. type: definePropType(Array)
  24697. }
  24698. });
  24699. const selectionModeWithDefault = (mode) => {
  24700. return {
  24701. type: String,
  24702. values: selectionModes,
  24703. default: mode
  24704. };
  24705. };
  24706. const panelDatePickProps = buildProps({
  24707. ...panelSharedProps,
  24708. parsedValue: {
  24709. type: definePropType([Object, Array])
  24710. },
  24711. visible: {
  24712. type: Boolean
  24713. },
  24714. format: {
  24715. type: String,
  24716. default: ""
  24717. }
  24718. });
  24719. const basicDateTableProps = buildProps({
  24720. ...datePickerSharedProps,
  24721. cellClassName: {
  24722. type: definePropType(Function)
  24723. },
  24724. showWeekNumber: Boolean,
  24725. selectionMode: selectionModeWithDefault("date")
  24726. });
  24727. const isValidRange = (range) => {
  24728. if (!isArray$1(range))
  24729. return false;
  24730. const [left, right] = range;
  24731. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
  24732. };
  24733. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  24734. let start;
  24735. if (isArray$1(defaultValue)) {
  24736. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  24737. if (!unlinkPanels) {
  24738. right = left.add(1, unit);
  24739. }
  24740. return [left, right];
  24741. } else if (defaultValue) {
  24742. start = dayjs(defaultValue);
  24743. } else {
  24744. start = dayjs();
  24745. }
  24746. start = start.locale(lang);
  24747. return [start, start.add(1, unit)];
  24748. };
  24749. const buildPickerTable = (dimension, rows, {
  24750. columnIndexOffset,
  24751. startDate,
  24752. nextEndDate,
  24753. now,
  24754. unit,
  24755. relativeDateGetter,
  24756. setCellMetadata,
  24757. setRowMetadata
  24758. }) => {
  24759. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  24760. const row = rows[rowIndex];
  24761. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  24762. let cell = row[columnIndex + columnIndexOffset];
  24763. if (!cell) {
  24764. cell = {
  24765. row: rowIndex,
  24766. column: columnIndex,
  24767. type: "normal",
  24768. inRange: false,
  24769. start: false,
  24770. end: false
  24771. };
  24772. }
  24773. const index = rowIndex * dimension.column + columnIndex;
  24774. const nextStartDate = relativeDateGetter(index);
  24775. cell.dayjs = nextStartDate;
  24776. cell.date = nextStartDate.toDate();
  24777. cell.timestamp = nextStartDate.valueOf();
  24778. cell.type = "normal";
  24779. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  24780. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  24781. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  24782. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  24783. } else {
  24784. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  24785. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  24786. }
  24787. const isToday = nextStartDate.isSame(now, unit);
  24788. if (isToday) {
  24789. cell.type = "today";
  24790. }
  24791. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  24792. row[columnIndex + columnIndexOffset] = cell;
  24793. }
  24794. setRowMetadata == null ? void 0 : setRowMetadata(row);
  24795. }
  24796. };
  24797. const basicCellProps = buildProps({
  24798. cell: {
  24799. type: definePropType(Object)
  24800. }
  24801. });
  24802. var ElDatePickerCell = vue.defineComponent({
  24803. name: "ElDatePickerCell",
  24804. props: basicCellProps,
  24805. setup(props) {
  24806. const ns = useNamespace("date-table-cell");
  24807. const {
  24808. slots
  24809. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  24810. return () => {
  24811. const {
  24812. cell
  24813. } = props;
  24814. if (slots.default) {
  24815. const list = slots.default(cell).filter((item) => {
  24816. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  24817. });
  24818. if (list.length) {
  24819. return list;
  24820. }
  24821. }
  24822. return vue.createVNode("div", {
  24823. "class": ns.b()
  24824. }, [vue.createVNode("span", {
  24825. "class": ns.e("text")
  24826. }, [cell == null ? void 0 : cell.text])]);
  24827. };
  24828. }
  24829. });
  24830. const _hoisted_1$I = ["aria-label", "onMousedown"];
  24831. const _hoisted_2$t = {
  24832. key: 0,
  24833. scope: "col"
  24834. };
  24835. const _hoisted_3$g = ["aria-label"];
  24836. const _hoisted_4$b = ["aria-current", "aria-selected", "tabindex"];
  24837. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  24838. __name: "basic-date-table",
  24839. props: basicDateTableProps,
  24840. emits: ["changerange", "pick", "select"],
  24841. setup(__props, { expose, emit }) {
  24842. const props = __props;
  24843. const ns = useNamespace("date-table");
  24844. const { t, lang } = useLocale();
  24845. const tbodyRef = vue.ref();
  24846. const currentCellRef = vue.ref();
  24847. const lastRow = vue.ref();
  24848. const lastColumn = vue.ref();
  24849. const tableRows = vue.ref([[], [], [], [], [], []]);
  24850. let focusWithClick = false;
  24851. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  24852. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  24853. const offsetDay = vue.computed(() => {
  24854. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  24855. });
  24856. const startDate = vue.computed(() => {
  24857. const startDayOfMonth = props.date.startOf("month");
  24858. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  24859. });
  24860. const WEEKS = vue.computed(() => {
  24861. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  24862. });
  24863. const hasCurrent = vue.computed(() => {
  24864. return flatten(rows.value).some((row) => {
  24865. return row.isCurrent;
  24866. });
  24867. });
  24868. const days = vue.computed(() => {
  24869. const startOfMonth = props.date.startOf("month");
  24870. const startOfMonthDay = startOfMonth.day() || 7;
  24871. const dateCountOfMonth = startOfMonth.daysInMonth();
  24872. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  24873. return {
  24874. startOfMonthDay,
  24875. dateCountOfMonth,
  24876. dateCountOfLastMonth
  24877. };
  24878. });
  24879. const selectedDate = vue.computed(() => {
  24880. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  24881. });
  24882. const setDateText = (cell, {
  24883. count,
  24884. rowIndex,
  24885. columnIndex
  24886. }) => {
  24887. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  24888. const offset = vue.unref(offsetDay);
  24889. if (rowIndex >= 0 && rowIndex <= 1) {
  24890. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  24891. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  24892. cell.text = count;
  24893. return true;
  24894. } else {
  24895. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  24896. cell.type = "prev-month";
  24897. }
  24898. } else {
  24899. if (count <= dateCountOfMonth) {
  24900. cell.text = count;
  24901. } else {
  24902. cell.text = count - dateCountOfMonth;
  24903. cell.type = "next-month";
  24904. }
  24905. return true;
  24906. }
  24907. return false;
  24908. };
  24909. const setCellMetadata = (cell, {
  24910. columnIndex,
  24911. rowIndex
  24912. }, count) => {
  24913. const { disabledDate, cellClassName } = props;
  24914. const _selectedDate = vue.unref(selectedDate);
  24915. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  24916. const cellDate = cell.dayjs.toDate();
  24917. cell.selected = _selectedDate.find((d) => d.valueOf() === cell.dayjs.valueOf());
  24918. cell.isSelected = !!cell.selected;
  24919. cell.isCurrent = isCurrent(cell);
  24920. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  24921. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  24922. return shouldIncrement;
  24923. };
  24924. const setRowMetadata = (row) => {
  24925. if (props.selectionMode === "week") {
  24926. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  24927. const isActive = isWeekActive(row[start + 1]);
  24928. row[start].inRange = isActive;
  24929. row[start].start = isActive;
  24930. row[end].inRange = isActive;
  24931. row[end].end = isActive;
  24932. }
  24933. };
  24934. const rows = vue.computed(() => {
  24935. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  24936. const offset = offsetDay.value;
  24937. const rows_ = tableRows.value;
  24938. const dateUnit = "day";
  24939. let count = 1;
  24940. if (showWeekNumber) {
  24941. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  24942. if (!rows_[rowIndex][0]) {
  24943. rows_[rowIndex][0] = {
  24944. type: "week",
  24945. text: startDate.value.add(rowIndex * 7 + 1, dateUnit).week()
  24946. };
  24947. }
  24948. }
  24949. }
  24950. buildPickerTable({ row: 6, column: 7 }, rows_, {
  24951. startDate: minDate,
  24952. columnIndexOffset: showWeekNumber ? 1 : 0,
  24953. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  24954. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  24955. unit: dateUnit,
  24956. relativeDateGetter: (idx) => startDate.value.add(idx - offset, dateUnit),
  24957. setCellMetadata: (...args) => {
  24958. if (setCellMetadata(...args, count)) {
  24959. count += 1;
  24960. }
  24961. },
  24962. setRowMetadata
  24963. });
  24964. return rows_;
  24965. });
  24966. vue.watch(() => props.date, async () => {
  24967. var _a, _b;
  24968. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  24969. await vue.nextTick();
  24970. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  24971. }
  24972. });
  24973. const focus = async () => {
  24974. var _a;
  24975. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  24976. };
  24977. const isNormalDay = (type = "") => {
  24978. return ["normal", "today"].includes(type);
  24979. };
  24980. const isCurrent = (cell) => {
  24981. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  24982. };
  24983. const cellMatchesDate = (cell, date) => {
  24984. if (!date)
  24985. return false;
  24986. return dayjs(date).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  24987. };
  24988. const getCellClasses = (cell) => {
  24989. const classes = [];
  24990. if (isNormalDay(cell.type) && !cell.disabled) {
  24991. classes.push("available");
  24992. if (cell.type === "today") {
  24993. classes.push("today");
  24994. }
  24995. } else {
  24996. classes.push(cell.type);
  24997. }
  24998. if (isCurrent(cell)) {
  24999. classes.push("current");
  25000. }
  25001. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  25002. classes.push("in-range");
  25003. if (cell.start) {
  25004. classes.push("start-date");
  25005. }
  25006. if (cell.end) {
  25007. classes.push("end-date");
  25008. }
  25009. }
  25010. if (cell.disabled) {
  25011. classes.push("disabled");
  25012. }
  25013. if (cell.selected) {
  25014. classes.push("selected");
  25015. }
  25016. if (cell.customClass) {
  25017. classes.push(cell.customClass);
  25018. }
  25019. return classes.join(" ");
  25020. };
  25021. const getDateOfCell = (row, column) => {
  25022. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  25023. return startDate.value.add(offsetFromStart, "day");
  25024. };
  25025. const handleMouseMove = (event) => {
  25026. var _a;
  25027. if (!props.rangeState.selecting)
  25028. return;
  25029. let target = event.target;
  25030. if (target.tagName === "SPAN") {
  25031. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  25032. }
  25033. if (target.tagName === "DIV") {
  25034. target = target.parentNode;
  25035. }
  25036. if (target.tagName !== "TD")
  25037. return;
  25038. const row = target.parentNode.rowIndex - 1;
  25039. const column = target.cellIndex;
  25040. if (rows.value[row][column].disabled)
  25041. return;
  25042. if (row !== lastRow.value || column !== lastColumn.value) {
  25043. lastRow.value = row;
  25044. lastColumn.value = column;
  25045. emit("changerange", {
  25046. selecting: true,
  25047. endDate: getDateOfCell(row, column)
  25048. });
  25049. }
  25050. };
  25051. const isSelectedCell = (cell) => {
  25052. return !hasCurrent.value && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  25053. };
  25054. const handleFocus = (event) => {
  25055. if (focusWithClick || hasCurrent.value || props.selectionMode !== "date")
  25056. return;
  25057. handlePickDate(event, true);
  25058. };
  25059. const handleMouseDown = (event) => {
  25060. const target = event.target.closest("td");
  25061. if (!target)
  25062. return;
  25063. focusWithClick = true;
  25064. };
  25065. const handleMouseUp = (event) => {
  25066. const target = event.target.closest("td");
  25067. if (!target)
  25068. return;
  25069. focusWithClick = false;
  25070. };
  25071. const handlePickDate = (event, isKeyboardMovement = false) => {
  25072. const target = event.target.closest("td");
  25073. if (!target)
  25074. return;
  25075. const row = target.parentNode.rowIndex - 1;
  25076. const column = target.cellIndex;
  25077. const cell = rows.value[row][column];
  25078. if (cell.disabled || cell.type === "week")
  25079. return;
  25080. const newDate = getDateOfCell(row, column);
  25081. if (props.selectionMode === "range") {
  25082. if (!props.rangeState.selecting || !props.minDate) {
  25083. emit("pick", { minDate: newDate, maxDate: null });
  25084. emit("select", true);
  25085. } else {
  25086. if (newDate >= props.minDate) {
  25087. emit("pick", { minDate: props.minDate, maxDate: newDate });
  25088. } else {
  25089. emit("pick", { minDate: newDate, maxDate: props.minDate });
  25090. }
  25091. emit("select", false);
  25092. }
  25093. } else if (props.selectionMode === "date") {
  25094. emit("pick", newDate, isKeyboardMovement);
  25095. } else if (props.selectionMode === "week") {
  25096. const weekNumber = newDate.week();
  25097. const value = `${newDate.year()}w${weekNumber}`;
  25098. emit("pick", {
  25099. year: newDate.year(),
  25100. week: weekNumber,
  25101. value,
  25102. date: newDate.startOf("week")
  25103. });
  25104. } else if (props.selectionMode === "dates") {
  25105. const newValue = cell.selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  25106. emit("pick", newValue);
  25107. }
  25108. };
  25109. const isWeekActive = (cell) => {
  25110. if (props.selectionMode !== "week")
  25111. return false;
  25112. let newDate = props.date.startOf("day");
  25113. if (cell.type === "prev-month") {
  25114. newDate = newDate.subtract(1, "month");
  25115. }
  25116. if (cell.type === "next-month") {
  25117. newDate = newDate.add(1, "month");
  25118. }
  25119. newDate = newDate.date(Number.parseInt(cell.text, 10));
  25120. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  25121. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  25122. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  25123. return weekDate.isSame(newDate, "day");
  25124. }
  25125. return false;
  25126. };
  25127. expose({
  25128. focus
  25129. });
  25130. return (_ctx, _cache) => {
  25131. return vue.openBlock(), vue.createElementBlock("table", {
  25132. role: "grid",
  25133. "aria-label": vue.unref(t)("el.datepicker.dateTablePrompt"),
  25134. cellspacing: "0",
  25135. cellpadding: "0",
  25136. class: vue.normalizeClass([vue.unref(ns).b(), { "is-week-mode": _ctx.selectionMode === "week" }]),
  25137. onClick: handlePickDate,
  25138. onMousemove: handleMouseMove,
  25139. onMousedown: vue.withModifiers(handleMouseDown, ["prevent"]),
  25140. onMouseup: handleMouseUp
  25141. }, [
  25142. vue.createElementVNode("tbody", {
  25143. ref_key: "tbodyRef",
  25144. ref: tbodyRef
  25145. }, [
  25146. vue.createElementVNode("tr", null, [
  25147. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_2$t, vue.toDisplayString(vue.unref(t)("el.datepicker.week")), 1)) : vue.createCommentVNode("v-if", true),
  25148. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  25149. return vue.openBlock(), vue.createElementBlock("th", {
  25150. key,
  25151. scope: "col",
  25152. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week)
  25153. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_3$g);
  25154. }), 128))
  25155. ]),
  25156. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  25157. return vue.openBlock(), vue.createElementBlock("tr", {
  25158. key: rowKey,
  25159. class: vue.normalizeClass([vue.unref(ns).e("row"), { current: isWeekActive(row[1]) }])
  25160. }, [
  25161. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  25162. return vue.openBlock(), vue.createElementBlock("td", {
  25163. key: `${rowKey}.${columnKey}`,
  25164. ref_for: true,
  25165. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  25166. class: vue.normalizeClass(getCellClasses(cell)),
  25167. "aria-current": cell.isCurrent ? "date" : void 0,
  25168. "aria-selected": cell.isCurrent,
  25169. tabindex: isSelectedCell(cell) ? 0 : -1,
  25170. onFocus: handleFocus
  25171. }, [
  25172. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  25173. ], 42, _hoisted_4$b);
  25174. }), 128))
  25175. ], 2);
  25176. }), 128))
  25177. ], 512)
  25178. ], 42, _hoisted_1$I);
  25179. };
  25180. }
  25181. });
  25182. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "basic-date-table.vue"]]);
  25183. const basicMonthTableProps = buildProps({
  25184. ...datePickerSharedProps,
  25185. selectionMode: selectionModeWithDefault("month")
  25186. });
  25187. const _hoisted_1$H = ["aria-label"];
  25188. const _hoisted_2$s = ["aria-selected", "aria-label", "tabindex", "onKeydown"];
  25189. const _hoisted_3$f = { class: "cell" };
  25190. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  25191. __name: "basic-month-table",
  25192. props: basicMonthTableProps,
  25193. emits: ["changerange", "pick", "select"],
  25194. setup(__props, { expose, emit }) {
  25195. const props = __props;
  25196. const datesInMonth = (year, month, lang2) => {
  25197. const firstDay = dayjs().locale(lang2).startOf("month").month(month).year(year);
  25198. const numOfDays = firstDay.daysInMonth();
  25199. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25200. };
  25201. const ns = useNamespace("month-table");
  25202. const { t, lang } = useLocale();
  25203. const tbodyRef = vue.ref();
  25204. const currentCellRef = vue.ref();
  25205. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  25206. const tableRows = vue.ref([
  25207. [],
  25208. [],
  25209. []
  25210. ]);
  25211. const lastRow = vue.ref();
  25212. const lastColumn = vue.ref();
  25213. const rows = vue.computed(() => {
  25214. var _a, _b;
  25215. const rows2 = tableRows.value;
  25216. const now = dayjs().locale(lang.value).startOf("month");
  25217. for (let i = 0; i < 3; i++) {
  25218. const row = rows2[i];
  25219. for (let j = 0; j < 4; j++) {
  25220. const cell = row[j] || (row[j] = {
  25221. row: i,
  25222. column: j,
  25223. type: "normal",
  25224. inRange: false,
  25225. start: false,
  25226. end: false,
  25227. text: -1,
  25228. disabled: false
  25229. });
  25230. cell.type = "normal";
  25231. const index = i * 4 + j;
  25232. const calTime = props.date.startOf("year").month(index);
  25233. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  25234. 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"));
  25235. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  25236. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  25237. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  25238. } else {
  25239. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  25240. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  25241. }
  25242. const isToday = now.isSame(calTime);
  25243. if (isToday) {
  25244. cell.type = "today";
  25245. }
  25246. cell.text = index;
  25247. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  25248. }
  25249. }
  25250. return rows2;
  25251. });
  25252. const focus = () => {
  25253. var _a;
  25254. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  25255. };
  25256. const getCellStyle = (cell) => {
  25257. const style = {};
  25258. const year = props.date.year();
  25259. const today = new Date();
  25260. const month = cell.text;
  25261. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  25262. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  25263. style.today = today.getFullYear() === year && today.getMonth() === month;
  25264. if (cell.inRange) {
  25265. style["in-range"] = true;
  25266. if (cell.start) {
  25267. style["start-date"] = true;
  25268. }
  25269. if (cell.end) {
  25270. style["end-date"] = true;
  25271. }
  25272. }
  25273. return style;
  25274. };
  25275. const isSelectedCell = (cell) => {
  25276. const year = props.date.year();
  25277. const month = cell.text;
  25278. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  25279. };
  25280. const handleMouseMove = (event) => {
  25281. var _a;
  25282. if (!props.rangeState.selecting)
  25283. return;
  25284. let target = event.target;
  25285. if (target.tagName === "A") {
  25286. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  25287. }
  25288. if (target.tagName === "DIV") {
  25289. target = target.parentNode;
  25290. }
  25291. if (target.tagName !== "TD")
  25292. return;
  25293. const row = target.parentNode.rowIndex;
  25294. const column = target.cellIndex;
  25295. if (rows.value[row][column].disabled)
  25296. return;
  25297. if (row !== lastRow.value || column !== lastColumn.value) {
  25298. lastRow.value = row;
  25299. lastColumn.value = column;
  25300. emit("changerange", {
  25301. selecting: true,
  25302. endDate: props.date.startOf("year").month(row * 4 + column)
  25303. });
  25304. }
  25305. };
  25306. const handleMonthTableClick = (event) => {
  25307. var _a;
  25308. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  25309. if ((target == null ? void 0 : target.tagName) !== "TD")
  25310. return;
  25311. if (hasClass(target, "disabled"))
  25312. return;
  25313. const column = target.cellIndex;
  25314. const row = target.parentNode.rowIndex;
  25315. const month = row * 4 + column;
  25316. const newDate = props.date.startOf("year").month(month);
  25317. if (props.selectionMode === "range") {
  25318. if (!props.rangeState.selecting) {
  25319. emit("pick", { minDate: newDate, maxDate: null });
  25320. emit("select", true);
  25321. } else {
  25322. if (props.minDate && newDate >= props.minDate) {
  25323. emit("pick", { minDate: props.minDate, maxDate: newDate });
  25324. } else {
  25325. emit("pick", { minDate: newDate, maxDate: props.minDate });
  25326. }
  25327. emit("select", false);
  25328. }
  25329. } else {
  25330. emit("pick", month);
  25331. }
  25332. };
  25333. vue.watch(() => props.date, async () => {
  25334. var _a, _b;
  25335. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  25336. await vue.nextTick();
  25337. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  25338. }
  25339. });
  25340. expose({
  25341. focus
  25342. });
  25343. return (_ctx, _cache) => {
  25344. return vue.openBlock(), vue.createElementBlock("table", {
  25345. role: "grid",
  25346. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  25347. class: vue.normalizeClass(vue.unref(ns).b()),
  25348. onClick: handleMonthTableClick,
  25349. onMousemove: handleMouseMove
  25350. }, [
  25351. vue.createElementVNode("tbody", {
  25352. ref_key: "tbodyRef",
  25353. ref: tbodyRef
  25354. }, [
  25355. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  25356. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  25357. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  25358. return vue.openBlock(), vue.createElementBlock("td", {
  25359. key: key_,
  25360. ref_for: true,
  25361. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  25362. class: vue.normalizeClass(getCellStyle(cell)),
  25363. "aria-selected": `${isSelectedCell(cell)}`,
  25364. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  25365. tabindex: isSelectedCell(cell) ? 0 : -1,
  25366. onKeydown: [
  25367. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  25368. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  25369. ]
  25370. }, [
  25371. vue.createElementVNode("div", null, [
  25372. vue.createElementVNode("span", _hoisted_3$f, vue.toDisplayString(vue.unref(t)("el.datepicker.months." + months.value[cell.text])), 1)
  25373. ])
  25374. ], 42, _hoisted_2$s);
  25375. }), 128))
  25376. ]);
  25377. }), 128))
  25378. ], 512)
  25379. ], 42, _hoisted_1$H);
  25380. };
  25381. }
  25382. });
  25383. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "basic-month-table.vue"]]);
  25384. const { date, disabledDate, parsedValue } = datePickerSharedProps;
  25385. const basicYearTableProps = buildProps({
  25386. date,
  25387. disabledDate,
  25388. parsedValue
  25389. });
  25390. const _hoisted_1$G = ["aria-label"];
  25391. const _hoisted_2$r = ["aria-selected", "tabindex", "onKeydown"];
  25392. const _hoisted_3$e = { class: "cell" };
  25393. const _hoisted_4$a = { key: 1 };
  25394. const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
  25395. __name: "basic-year-table",
  25396. props: basicYearTableProps,
  25397. emits: ["pick"],
  25398. setup(__props, { expose, emit }) {
  25399. const props = __props;
  25400. const datesInYear = (year, lang2) => {
  25401. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  25402. const lastDay = firstDay.endOf("year");
  25403. const numOfDays = lastDay.dayOfYear();
  25404. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25405. };
  25406. const ns = useNamespace("year-table");
  25407. const { t, lang } = useLocale();
  25408. const tbodyRef = vue.ref();
  25409. const currentCellRef = vue.ref();
  25410. const startYear = vue.computed(() => {
  25411. return Math.floor(props.date.year() / 10) * 10;
  25412. });
  25413. const focus = () => {
  25414. var _a;
  25415. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  25416. };
  25417. const getCellKls = (year) => {
  25418. const kls = {};
  25419. const today = dayjs().locale(lang.value);
  25420. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  25421. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  25422. kls.today = today.year() === year;
  25423. return kls;
  25424. };
  25425. const isSelectedCell = (year) => {
  25426. return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  25427. };
  25428. const handleYearTableClick = (event) => {
  25429. const clickTarget = event.target;
  25430. const target = clickTarget.closest("td");
  25431. if (target && target.textContent) {
  25432. if (hasClass(target, "disabled"))
  25433. return;
  25434. const year = target.textContent || target.innerText;
  25435. emit("pick", Number(year));
  25436. }
  25437. };
  25438. vue.watch(() => props.date, async () => {
  25439. var _a, _b;
  25440. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  25441. await vue.nextTick();
  25442. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  25443. }
  25444. });
  25445. expose({
  25446. focus
  25447. });
  25448. return (_ctx, _cache) => {
  25449. return vue.openBlock(), vue.createElementBlock("table", {
  25450. role: "grid",
  25451. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  25452. class: vue.normalizeClass(vue.unref(ns).b()),
  25453. onClick: handleYearTableClick
  25454. }, [
  25455. vue.createElementVNode("tbody", {
  25456. ref_key: "tbodyRef",
  25457. ref: tbodyRef
  25458. }, [
  25459. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(3, (_, i) => {
  25460. return vue.createElementVNode("tr", { key: i }, [
  25461. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(4, (__, j) => {
  25462. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  25463. key: i + "_" + j
  25464. }, [
  25465. i * 4 + j < 10 ? (vue.openBlock(), vue.createElementBlock("td", {
  25466. key: 0,
  25467. ref_for: true,
  25468. ref: (el) => isSelectedCell(vue.unref(startYear) + i * 4 + j) && (currentCellRef.value = el),
  25469. class: vue.normalizeClass(["available", getCellKls(vue.unref(startYear) + i * 4 + j)]),
  25470. "aria-selected": `${isSelectedCell(vue.unref(startYear) + i * 4 + j)}`,
  25471. tabindex: isSelectedCell(vue.unref(startYear) + i * 4 + j) ? 0 : -1,
  25472. onKeydown: [
  25473. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  25474. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  25475. ]
  25476. }, [
  25477. vue.createElementVNode("span", _hoisted_3$e, vue.toDisplayString(vue.unref(startYear) + i * 4 + j), 1)
  25478. ], 42, _hoisted_2$r)) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_4$a))
  25479. ], 64);
  25480. }), 64))
  25481. ]);
  25482. }), 64))
  25483. ], 512)
  25484. ], 10, _hoisted_1$G);
  25485. };
  25486. }
  25487. });
  25488. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__file", "basic-year-table.vue"]]);
  25489. const _hoisted_1$F = ["onClick"];
  25490. const _hoisted_2$q = ["aria-label"];
  25491. const _hoisted_3$d = ["aria-label"];
  25492. const _hoisted_4$9 = ["aria-label"];
  25493. const _hoisted_5$7 = ["aria-label"];
  25494. const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
  25495. __name: "panel-date-pick",
  25496. props: panelDatePickProps,
  25497. emits: ["pick", "set-picker-option", "panel-change"],
  25498. setup(__props, { emit: contextEmit }) {
  25499. const props = __props;
  25500. const timeWithinRange = (_, __, ___) => true;
  25501. const ppNs = useNamespace("picker-panel");
  25502. const dpNs = useNamespace("date-picker");
  25503. const attrs = vue.useAttrs();
  25504. const slots = vue.useSlots();
  25505. const { t, lang } = useLocale();
  25506. const pickerBase = vue.inject("EP_PICKER_BASE");
  25507. const popper = vue.inject(TOOLTIP_INJECTION_KEY);
  25508. const { shortcuts, disabledDate, cellClassName, defaultTime, arrowControl } = pickerBase.props;
  25509. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  25510. const currentViewRef = vue.ref();
  25511. const innerDate = vue.ref(dayjs().locale(lang.value));
  25512. const isChangeToNow = vue.ref(false);
  25513. const defaultTimeD = vue.computed(() => {
  25514. return dayjs(defaultTime).locale(lang.value);
  25515. });
  25516. const month = vue.computed(() => {
  25517. return innerDate.value.month();
  25518. });
  25519. const year = vue.computed(() => {
  25520. return innerDate.value.year();
  25521. });
  25522. const selectableRange = vue.ref([]);
  25523. const userInputDate = vue.ref(null);
  25524. const userInputTime = vue.ref(null);
  25525. const checkDateWithinRange = (date) => {
  25526. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  25527. };
  25528. const formatEmit = (emitDayjs) => {
  25529. if (defaultTime && !visibleTime.value && !isChangeToNow.value) {
  25530. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  25531. }
  25532. if (showTime.value)
  25533. return emitDayjs.millisecond(0);
  25534. return emitDayjs.startOf("day");
  25535. };
  25536. const emit = (value, ...args) => {
  25537. if (!value) {
  25538. contextEmit("pick", value, ...args);
  25539. } else if (isArray$1(value)) {
  25540. const dates = value.map(formatEmit);
  25541. contextEmit("pick", dates, ...args);
  25542. } else {
  25543. contextEmit("pick", formatEmit(value), ...args);
  25544. }
  25545. userInputDate.value = null;
  25546. userInputTime.value = null;
  25547. isChangeToNow.value = false;
  25548. };
  25549. const handleDatePick = (value, keepOpen) => {
  25550. if (selectionMode.value === "date") {
  25551. value = value;
  25552. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  25553. if (!checkDateWithinRange(newDate)) {
  25554. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  25555. }
  25556. innerDate.value = newDate;
  25557. emit(newDate, showTime.value || keepOpen);
  25558. } else if (selectionMode.value === "week") {
  25559. emit(value.date);
  25560. } else if (selectionMode.value === "dates") {
  25561. emit(value, true);
  25562. }
  25563. };
  25564. const moveByMonth = (forward) => {
  25565. const action = forward ? "add" : "subtract";
  25566. innerDate.value = innerDate.value[action](1, "month");
  25567. handlePanelChange("month");
  25568. };
  25569. const moveByYear = (forward) => {
  25570. const currentDate = innerDate.value;
  25571. const action = forward ? "add" : "subtract";
  25572. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  25573. handlePanelChange("year");
  25574. };
  25575. const currentView = vue.ref("date");
  25576. const yearLabel = vue.computed(() => {
  25577. const yearTranslation = t("el.datepicker.year");
  25578. if (currentView.value === "year") {
  25579. const startYear = Math.floor(year.value / 10) * 10;
  25580. if (yearTranslation) {
  25581. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  25582. }
  25583. return `${startYear} - ${startYear + 9}`;
  25584. }
  25585. return `${year.value} ${yearTranslation}`;
  25586. });
  25587. const handleShortcutClick = (shortcut) => {
  25588. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  25589. if (shortcutValue) {
  25590. emit(dayjs(shortcutValue).locale(lang.value));
  25591. return;
  25592. }
  25593. if (shortcut.onClick) {
  25594. shortcut.onClick({
  25595. attrs,
  25596. slots,
  25597. emit: contextEmit
  25598. });
  25599. }
  25600. };
  25601. const selectionMode = vue.computed(() => {
  25602. const { type } = props;
  25603. if (["week", "month", "year", "dates"].includes(type))
  25604. return type;
  25605. return "date";
  25606. });
  25607. const keyboardMode = vue.computed(() => {
  25608. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  25609. });
  25610. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  25611. const handleMonthPick = async (month2) => {
  25612. innerDate.value = innerDate.value.startOf("month").month(month2);
  25613. if (selectionMode.value === "month") {
  25614. emit(innerDate.value, false);
  25615. } else {
  25616. currentView.value = "date";
  25617. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  25618. emit(innerDate.value, true);
  25619. await vue.nextTick();
  25620. handleFocusPicker();
  25621. }
  25622. }
  25623. handlePanelChange("month");
  25624. };
  25625. const handleYearPick = async (year2) => {
  25626. if (selectionMode.value === "year") {
  25627. innerDate.value = innerDate.value.startOf("year").year(year2);
  25628. emit(innerDate.value, false);
  25629. } else {
  25630. innerDate.value = innerDate.value.year(year2);
  25631. currentView.value = "month";
  25632. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  25633. emit(innerDate.value, true);
  25634. await vue.nextTick();
  25635. handleFocusPicker();
  25636. }
  25637. }
  25638. handlePanelChange("year");
  25639. };
  25640. const showPicker = async (view) => {
  25641. currentView.value = view;
  25642. await vue.nextTick();
  25643. handleFocusPicker();
  25644. };
  25645. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  25646. const footerVisible = vue.computed(() => {
  25647. return showTime.value || selectionMode.value === "dates";
  25648. });
  25649. const onConfirm = () => {
  25650. if (selectionMode.value === "dates") {
  25651. emit(props.parsedValue);
  25652. } else {
  25653. let result = props.parsedValue;
  25654. if (!result) {
  25655. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  25656. const defaultValueD = getDefaultValue();
  25657. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  25658. }
  25659. innerDate.value = result;
  25660. emit(result);
  25661. }
  25662. };
  25663. const changeToNow = () => {
  25664. const now = dayjs().locale(lang.value);
  25665. const nowDate = now.toDate();
  25666. isChangeToNow.value = true;
  25667. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  25668. innerDate.value = dayjs().locale(lang.value);
  25669. emit(innerDate.value);
  25670. }
  25671. };
  25672. const timeFormat = vue.computed(() => {
  25673. return extractTimeFormat(props.format);
  25674. });
  25675. const dateFormat = vue.computed(() => {
  25676. return extractDateFormat(props.format);
  25677. });
  25678. const visibleTime = vue.computed(() => {
  25679. if (userInputTime.value)
  25680. return userInputTime.value;
  25681. if (!props.parsedValue && !defaultValue.value)
  25682. return;
  25683. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  25684. });
  25685. const visibleDate = vue.computed(() => {
  25686. if (userInputDate.value)
  25687. return userInputDate.value;
  25688. if (!props.parsedValue && !defaultValue.value)
  25689. return;
  25690. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  25691. });
  25692. const timePickerVisible = vue.ref(false);
  25693. const onTimePickerInputFocus = () => {
  25694. timePickerVisible.value = true;
  25695. };
  25696. const handleTimePickClose = () => {
  25697. timePickerVisible.value = false;
  25698. };
  25699. const getUnits = (date) => {
  25700. return {
  25701. hour: date.hour(),
  25702. minute: date.minute(),
  25703. second: date.second(),
  25704. year: date.year(),
  25705. month: date.month(),
  25706. date: date.date()
  25707. };
  25708. };
  25709. const handleTimePick = (value, visible, first) => {
  25710. const { hour, minute, second } = getUnits(value);
  25711. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  25712. innerDate.value = newDate;
  25713. emit(innerDate.value, true);
  25714. if (!first) {
  25715. timePickerVisible.value = visible;
  25716. }
  25717. };
  25718. const handleVisibleTimeChange = (value) => {
  25719. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  25720. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  25721. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  25722. innerDate.value = newDate.year(year2).month(month2).date(date);
  25723. userInputTime.value = null;
  25724. timePickerVisible.value = false;
  25725. emit(innerDate.value, true);
  25726. }
  25727. };
  25728. const handleVisibleDateChange = (value) => {
  25729. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  25730. if (newDate.isValid()) {
  25731. if (disabledDate && disabledDate(newDate.toDate())) {
  25732. return;
  25733. }
  25734. const { hour, minute, second } = getUnits(innerDate.value);
  25735. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  25736. userInputDate.value = null;
  25737. emit(innerDate.value, true);
  25738. }
  25739. };
  25740. const isValidValue = (date) => {
  25741. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  25742. };
  25743. const formatToString = (value) => {
  25744. if (selectionMode.value === "dates") {
  25745. return value.map((_) => _.format(props.format));
  25746. }
  25747. return value.format(props.format);
  25748. };
  25749. const parseUserInput = (value) => {
  25750. return dayjs(value, props.format).locale(lang.value);
  25751. };
  25752. const getDefaultValue = () => {
  25753. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  25754. if (!defaultValue.value) {
  25755. const defaultTimeDValue = defaultTimeD.value;
  25756. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  25757. }
  25758. return parseDate;
  25759. };
  25760. const handleFocusPicker = async () => {
  25761. var _a;
  25762. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  25763. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  25764. if (selectionMode.value === "week") {
  25765. handleKeyControl(EVENT_CODE.down);
  25766. }
  25767. }
  25768. };
  25769. const handleKeydownTable = (event) => {
  25770. const { code } = event;
  25771. const validCode = [
  25772. EVENT_CODE.up,
  25773. EVENT_CODE.down,
  25774. EVENT_CODE.left,
  25775. EVENT_CODE.right,
  25776. EVENT_CODE.home,
  25777. EVENT_CODE.end,
  25778. EVENT_CODE.pageUp,
  25779. EVENT_CODE.pageDown
  25780. ];
  25781. if (validCode.includes(code)) {
  25782. handleKeyControl(code);
  25783. event.stopPropagation();
  25784. event.preventDefault();
  25785. }
  25786. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  25787. event.preventDefault();
  25788. emit(innerDate.value, false);
  25789. }
  25790. };
  25791. const handleKeyControl = (code) => {
  25792. var _a;
  25793. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  25794. const mapping = {
  25795. year: {
  25796. [up]: -4,
  25797. [down]: 4,
  25798. [left]: -1,
  25799. [right]: 1,
  25800. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  25801. },
  25802. month: {
  25803. [up]: -4,
  25804. [down]: 4,
  25805. [left]: -1,
  25806. [right]: 1,
  25807. offset: (date, step) => date.setMonth(date.getMonth() + step)
  25808. },
  25809. week: {
  25810. [up]: -1,
  25811. [down]: 1,
  25812. [left]: -1,
  25813. [right]: 1,
  25814. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  25815. },
  25816. date: {
  25817. [up]: -7,
  25818. [down]: 7,
  25819. [left]: -1,
  25820. [right]: 1,
  25821. [home]: (date) => -date.getDay(),
  25822. [end]: (date) => -date.getDay() + 6,
  25823. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  25824. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  25825. offset: (date, step) => date.setDate(date.getDate() + step)
  25826. }
  25827. };
  25828. const newDate = innerDate.value.toDate();
  25829. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  25830. const map = mapping[keyboardMode.value];
  25831. if (!map)
  25832. return;
  25833. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  25834. if (disabledDate && disabledDate(newDate)) {
  25835. break;
  25836. }
  25837. const result = dayjs(newDate).locale(lang.value);
  25838. innerDate.value = result;
  25839. contextEmit("pick", result, true);
  25840. break;
  25841. }
  25842. };
  25843. const handlePanelChange = (mode) => {
  25844. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  25845. };
  25846. vue.watch(() => selectionMode.value, (val) => {
  25847. if (["month", "year"].includes(val)) {
  25848. currentView.value = val;
  25849. return;
  25850. }
  25851. currentView.value = "date";
  25852. }, { immediate: true });
  25853. vue.watch(() => currentView.value, () => {
  25854. popper == null ? void 0 : popper.updatePopper();
  25855. });
  25856. vue.watch(() => defaultValue.value, (val) => {
  25857. if (val) {
  25858. innerDate.value = getDefaultValue();
  25859. }
  25860. }, { immediate: true });
  25861. vue.watch(() => props.parsedValue, (val) => {
  25862. if (val) {
  25863. if (selectionMode.value === "dates")
  25864. return;
  25865. if (Array.isArray(val))
  25866. return;
  25867. innerDate.value = val;
  25868. } else {
  25869. innerDate.value = getDefaultValue();
  25870. }
  25871. }, { immediate: true });
  25872. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  25873. contextEmit("set-picker-option", ["formatToString", formatToString]);
  25874. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  25875. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  25876. return (_ctx, _cache) => {
  25877. return vue.openBlock(), vue.createElementBlock("div", {
  25878. class: vue.normalizeClass([
  25879. vue.unref(ppNs).b(),
  25880. vue.unref(dpNs).b(),
  25881. {
  25882. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  25883. "has-time": vue.unref(showTime)
  25884. }
  25885. ])
  25886. }, [
  25887. vue.createElementVNode("div", {
  25888. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  25889. }, [
  25890. vue.renderSlot(_ctx.$slots, "sidebar", {
  25891. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  25892. }),
  25893. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  25894. key: 0,
  25895. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  25896. }, [
  25897. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  25898. return vue.openBlock(), vue.createElementBlock("button", {
  25899. key,
  25900. type: "button",
  25901. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  25902. onClick: ($event) => handleShortcutClick(shortcut)
  25903. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$F);
  25904. }), 128))
  25905. ], 2)) : vue.createCommentVNode("v-if", true),
  25906. vue.createElementVNode("div", {
  25907. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  25908. }, [
  25909. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  25910. key: 0,
  25911. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  25912. }, [
  25913. vue.createElementVNode("span", {
  25914. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  25915. }, [
  25916. vue.createVNode(vue.unref(ElInput), {
  25917. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  25918. "model-value": vue.unref(visibleDate),
  25919. size: "small",
  25920. "validate-event": false,
  25921. onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
  25922. onChange: handleVisibleDateChange
  25923. }, null, 8, ["placeholder", "model-value"])
  25924. ], 2),
  25925. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  25926. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  25927. }, [
  25928. vue.createVNode(vue.unref(ElInput), {
  25929. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  25930. "model-value": vue.unref(visibleTime),
  25931. size: "small",
  25932. "validate-event": false,
  25933. onFocus: onTimePickerInputFocus,
  25934. onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
  25935. onChange: handleVisibleTimeChange
  25936. }, null, 8, ["placeholder", "model-value"]),
  25937. vue.createVNode(vue.unref(TimePickPanel), {
  25938. visible: timePickerVisible.value,
  25939. format: vue.unref(timeFormat),
  25940. "time-arrow-control": vue.unref(arrowControl),
  25941. "parsed-value": innerDate.value,
  25942. onPick: handleTimePick
  25943. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  25944. ], 2)), [
  25945. [vue.unref(ClickOutside), handleTimePickClose]
  25946. ])
  25947. ], 2)) : vue.createCommentVNode("v-if", true),
  25948. vue.withDirectives(vue.createElementVNode("div", {
  25949. class: vue.normalizeClass([
  25950. vue.unref(dpNs).e("header"),
  25951. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered")
  25952. ])
  25953. }, [
  25954. vue.createElementVNode("span", {
  25955. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  25956. }, [
  25957. vue.createElementVNode("button", {
  25958. type: "button",
  25959. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  25960. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  25961. onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
  25962. }, [
  25963. vue.createVNode(vue.unref(ElIcon), null, {
  25964. default: vue.withCtx(() => [
  25965. vue.createVNode(vue.unref(d_arrow_left_default))
  25966. ]),
  25967. _: 1
  25968. })
  25969. ], 10, _hoisted_2$q),
  25970. vue.withDirectives(vue.createElementVNode("button", {
  25971. type: "button",
  25972. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  25973. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  25974. onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
  25975. }, [
  25976. vue.createVNode(vue.unref(ElIcon), null, {
  25977. default: vue.withCtx(() => [
  25978. vue.createVNode(vue.unref(arrow_left_default))
  25979. ]),
  25980. _: 1
  25981. })
  25982. ], 10, _hoisted_3$d), [
  25983. [vue.vShow, currentView.value === "date"]
  25984. ])
  25985. ], 2),
  25986. vue.createElementVNode("span", {
  25987. role: "button",
  25988. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  25989. "aria-live": "polite",
  25990. tabindex: "0",
  25991. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(($event) => showPicker("year"), ["enter"])),
  25992. onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
  25993. }, vue.toDisplayString(vue.unref(yearLabel)), 35),
  25994. vue.withDirectives(vue.createElementVNode("span", {
  25995. role: "button",
  25996. "aria-live": "polite",
  25997. tabindex: "0",
  25998. class: vue.normalizeClass([
  25999. vue.unref(dpNs).e("header-label"),
  26000. { active: currentView.value === "month" }
  26001. ]),
  26002. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(($event) => showPicker("month"), ["enter"])),
  26003. onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
  26004. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 35), [
  26005. [vue.vShow, currentView.value === "date"]
  26006. ]),
  26007. vue.createElementVNode("span", {
  26008. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  26009. }, [
  26010. vue.withDirectives(vue.createElementVNode("button", {
  26011. type: "button",
  26012. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  26013. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  26014. onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
  26015. }, [
  26016. vue.createVNode(vue.unref(ElIcon), null, {
  26017. default: vue.withCtx(() => [
  26018. vue.createVNode(vue.unref(arrow_right_default))
  26019. ]),
  26020. _: 1
  26021. })
  26022. ], 10, _hoisted_4$9), [
  26023. [vue.vShow, currentView.value === "date"]
  26024. ]),
  26025. vue.createElementVNode("button", {
  26026. type: "button",
  26027. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  26028. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  26029. onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
  26030. }, [
  26031. vue.createVNode(vue.unref(ElIcon), null, {
  26032. default: vue.withCtx(() => [
  26033. vue.createVNode(vue.unref(d_arrow_right_default))
  26034. ]),
  26035. _: 1
  26036. })
  26037. ], 10, _hoisted_5$7)
  26038. ], 2)
  26039. ], 2), [
  26040. [vue.vShow, currentView.value !== "time"]
  26041. ]),
  26042. vue.createElementVNode("div", {
  26043. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  26044. onKeydown: handleKeydownTable
  26045. }, [
  26046. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  26047. key: 0,
  26048. ref_key: "currentViewRef",
  26049. ref: currentViewRef,
  26050. "selection-mode": vue.unref(selectionMode),
  26051. date: innerDate.value,
  26052. "parsed-value": _ctx.parsedValue,
  26053. "disabled-date": vue.unref(disabledDate),
  26054. "cell-class-name": vue.unref(cellClassName),
  26055. onPick: handleDatePick
  26056. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  26057. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  26058. key: 1,
  26059. ref_key: "currentViewRef",
  26060. ref: currentViewRef,
  26061. date: innerDate.value,
  26062. "disabled-date": vue.unref(disabledDate),
  26063. "parsed-value": _ctx.parsedValue,
  26064. onPick: handleYearPick
  26065. }, null, 8, ["date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true),
  26066. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  26067. key: 2,
  26068. ref_key: "currentViewRef",
  26069. ref: currentViewRef,
  26070. date: innerDate.value,
  26071. "parsed-value": _ctx.parsedValue,
  26072. "disabled-date": vue.unref(disabledDate),
  26073. onPick: handleMonthPick
  26074. }, null, 8, ["date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true)
  26075. ], 34)
  26076. ], 2)
  26077. ], 2),
  26078. vue.withDirectives(vue.createElementVNode("div", {
  26079. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  26080. }, [
  26081. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  26082. text: "",
  26083. size: "small",
  26084. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  26085. onClick: changeToNow
  26086. }, {
  26087. default: vue.withCtx(() => [
  26088. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  26089. ]),
  26090. _: 1
  26091. }, 8, ["class"]), [
  26092. [vue.vShow, vue.unref(selectionMode) !== "dates"]
  26093. ]),
  26094. vue.createVNode(vue.unref(ElButton), {
  26095. plain: "",
  26096. size: "small",
  26097. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  26098. onClick: onConfirm
  26099. }, {
  26100. default: vue.withCtx(() => [
  26101. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  26102. ]),
  26103. _: 1
  26104. }, 8, ["class"])
  26105. ], 2), [
  26106. [vue.vShow, vue.unref(footerVisible) && currentView.value === "date"]
  26107. ])
  26108. ], 2);
  26109. };
  26110. }
  26111. });
  26112. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__file", "panel-date-pick.vue"]]);
  26113. const panelDateRangeProps = buildProps({
  26114. ...panelSharedProps,
  26115. ...panelRangeSharedProps
  26116. });
  26117. const useShortcut = (lang) => {
  26118. const { emit } = vue.getCurrentInstance();
  26119. const attrs = vue.useAttrs();
  26120. const slots = vue.useSlots();
  26121. const handleShortcutClick = (shortcut) => {
  26122. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26123. if (shortcutValues) {
  26124. emit("pick", [
  26125. dayjs(shortcutValues[0]).locale(lang.value),
  26126. dayjs(shortcutValues[1]).locale(lang.value)
  26127. ]);
  26128. return;
  26129. }
  26130. if (shortcut.onClick) {
  26131. shortcut.onClick({
  26132. attrs,
  26133. slots,
  26134. emit
  26135. });
  26136. }
  26137. };
  26138. return handleShortcutClick;
  26139. };
  26140. const useRangePicker = (props, {
  26141. defaultValue,
  26142. leftDate,
  26143. rightDate,
  26144. unit,
  26145. onParsedValueChanged
  26146. }) => {
  26147. const { emit } = vue.getCurrentInstance();
  26148. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  26149. const drpNs = useNamespace("date-range-picker");
  26150. const { t, lang } = useLocale();
  26151. const handleShortcutClick = useShortcut(lang);
  26152. const minDate = vue.ref();
  26153. const maxDate = vue.ref();
  26154. const rangeState = vue.ref({
  26155. endDate: null,
  26156. selecting: false
  26157. });
  26158. const handleChangeRange = (val) => {
  26159. rangeState.value = val;
  26160. };
  26161. const handleRangeConfirm = (visible = false) => {
  26162. const _minDate = vue.unref(minDate);
  26163. const _maxDate = vue.unref(maxDate);
  26164. if (isValidRange([_minDate, _maxDate])) {
  26165. emit("pick", [_minDate, _maxDate], visible);
  26166. }
  26167. };
  26168. const onSelect = (selecting) => {
  26169. rangeState.value.selecting = selecting;
  26170. if (!selecting) {
  26171. rangeState.value.endDate = null;
  26172. }
  26173. };
  26174. const restoreDefault = () => {
  26175. const [start, end] = getDefaultValue(vue.unref(defaultValue), {
  26176. lang: vue.unref(lang),
  26177. unit,
  26178. unlinkPanels: props.unlinkPanels
  26179. });
  26180. minDate.value = void 0;
  26181. maxDate.value = void 0;
  26182. leftDate.value = start;
  26183. rightDate.value = end;
  26184. };
  26185. vue.watch(defaultValue, (val) => {
  26186. if (val) {
  26187. restoreDefault();
  26188. }
  26189. }, { immediate: true });
  26190. vue.watch(() => props.parsedValue, (parsedValue) => {
  26191. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  26192. const [start, end] = parsedValue;
  26193. minDate.value = start;
  26194. leftDate.value = start;
  26195. maxDate.value = end;
  26196. onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate));
  26197. } else {
  26198. restoreDefault();
  26199. }
  26200. }, { immediate: true });
  26201. return {
  26202. minDate,
  26203. maxDate,
  26204. rangeState,
  26205. lang,
  26206. ppNs: pickerNs,
  26207. drpNs,
  26208. handleChangeRange,
  26209. handleRangeConfirm,
  26210. handleShortcutClick,
  26211. onSelect,
  26212. t
  26213. };
  26214. };
  26215. const _hoisted_1$E = ["onClick"];
  26216. const _hoisted_2$p = ["disabled"];
  26217. const _hoisted_3$c = ["disabled"];
  26218. const _hoisted_4$8 = ["disabled"];
  26219. const _hoisted_5$6 = ["disabled"];
  26220. const unit$1 = "month";
  26221. const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
  26222. __name: "panel-date-range",
  26223. props: panelDateRangeProps,
  26224. emits: [
  26225. "pick",
  26226. "set-picker-option",
  26227. "calendar-change",
  26228. "panel-change"
  26229. ],
  26230. setup(__props, { emit }) {
  26231. const props = __props;
  26232. const pickerBase = vue.inject("EP_PICKER_BASE");
  26233. const {
  26234. disabledDate,
  26235. cellClassName,
  26236. format,
  26237. defaultTime,
  26238. arrowControl,
  26239. clearable
  26240. } = pickerBase.props;
  26241. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  26242. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  26243. const { lang } = useLocale();
  26244. const leftDate = vue.ref(dayjs().locale(lang.value));
  26245. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  26246. const {
  26247. minDate,
  26248. maxDate,
  26249. rangeState,
  26250. ppNs,
  26251. drpNs,
  26252. handleChangeRange,
  26253. handleRangeConfirm,
  26254. handleShortcutClick,
  26255. onSelect,
  26256. t
  26257. } = useRangePicker(props, {
  26258. defaultValue,
  26259. leftDate,
  26260. rightDate,
  26261. unit: unit$1,
  26262. onParsedValueChanged
  26263. });
  26264. const dateUserInput = vue.ref({
  26265. min: null,
  26266. max: null
  26267. });
  26268. const timeUserInput = vue.ref({
  26269. min: null,
  26270. max: null
  26271. });
  26272. const leftLabel = vue.computed(() => {
  26273. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  26274. });
  26275. const rightLabel = vue.computed(() => {
  26276. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  26277. });
  26278. const leftYear = vue.computed(() => {
  26279. return leftDate.value.year();
  26280. });
  26281. const leftMonth = vue.computed(() => {
  26282. return leftDate.value.month();
  26283. });
  26284. const rightYear = vue.computed(() => {
  26285. return rightDate.value.year();
  26286. });
  26287. const rightMonth = vue.computed(() => {
  26288. return rightDate.value.month();
  26289. });
  26290. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  26291. const minVisibleDate = vue.computed(() => {
  26292. if (dateUserInput.value.min !== null)
  26293. return dateUserInput.value.min;
  26294. if (minDate.value)
  26295. return minDate.value.format(dateFormat.value);
  26296. return "";
  26297. });
  26298. const maxVisibleDate = vue.computed(() => {
  26299. if (dateUserInput.value.max !== null)
  26300. return dateUserInput.value.max;
  26301. if (maxDate.value || minDate.value)
  26302. return (maxDate.value || minDate.value).format(dateFormat.value);
  26303. return "";
  26304. });
  26305. const minVisibleTime = vue.computed(() => {
  26306. if (timeUserInput.value.min !== null)
  26307. return timeUserInput.value.min;
  26308. if (minDate.value)
  26309. return minDate.value.format(timeFormat.value);
  26310. return "";
  26311. });
  26312. const maxVisibleTime = vue.computed(() => {
  26313. if (timeUserInput.value.max !== null)
  26314. return timeUserInput.value.max;
  26315. if (maxDate.value || minDate.value)
  26316. return (maxDate.value || minDate.value).format(timeFormat.value);
  26317. return "";
  26318. });
  26319. const timeFormat = vue.computed(() => {
  26320. return extractTimeFormat(format);
  26321. });
  26322. const dateFormat = vue.computed(() => {
  26323. return extractDateFormat(format);
  26324. });
  26325. const leftPrevYear = () => {
  26326. leftDate.value = leftDate.value.subtract(1, "year");
  26327. if (!props.unlinkPanels) {
  26328. rightDate.value = leftDate.value.add(1, "month");
  26329. }
  26330. handlePanelChange("year");
  26331. };
  26332. const leftPrevMonth = () => {
  26333. leftDate.value = leftDate.value.subtract(1, "month");
  26334. if (!props.unlinkPanels) {
  26335. rightDate.value = leftDate.value.add(1, "month");
  26336. }
  26337. handlePanelChange("month");
  26338. };
  26339. const rightNextYear = () => {
  26340. if (!props.unlinkPanels) {
  26341. leftDate.value = leftDate.value.add(1, "year");
  26342. rightDate.value = leftDate.value.add(1, "month");
  26343. } else {
  26344. rightDate.value = rightDate.value.add(1, "year");
  26345. }
  26346. handlePanelChange("year");
  26347. };
  26348. const rightNextMonth = () => {
  26349. if (!props.unlinkPanels) {
  26350. leftDate.value = leftDate.value.add(1, "month");
  26351. rightDate.value = leftDate.value.add(1, "month");
  26352. } else {
  26353. rightDate.value = rightDate.value.add(1, "month");
  26354. }
  26355. handlePanelChange("month");
  26356. };
  26357. const leftNextYear = () => {
  26358. leftDate.value = leftDate.value.add(1, "year");
  26359. handlePanelChange("year");
  26360. };
  26361. const leftNextMonth = () => {
  26362. leftDate.value = leftDate.value.add(1, "month");
  26363. handlePanelChange("month");
  26364. };
  26365. const rightPrevYear = () => {
  26366. rightDate.value = rightDate.value.subtract(1, "year");
  26367. handlePanelChange("year");
  26368. };
  26369. const rightPrevMonth = () => {
  26370. rightDate.value = rightDate.value.subtract(1, "month");
  26371. handlePanelChange("month");
  26372. };
  26373. const handlePanelChange = (mode) => {
  26374. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  26375. };
  26376. const enableMonthArrow = vue.computed(() => {
  26377. const nextMonth = (leftMonth.value + 1) % 12;
  26378. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  26379. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  26380. });
  26381. const enableYearArrow = vue.computed(() => {
  26382. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  26383. });
  26384. const btnDisabled = vue.computed(() => {
  26385. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  26386. });
  26387. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  26388. const formatEmit = (emitDayjs, index) => {
  26389. if (!emitDayjs)
  26390. return;
  26391. if (defaultTime) {
  26392. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  26393. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  26394. }
  26395. return emitDayjs;
  26396. };
  26397. const handleRangePick = (val, close = true) => {
  26398. const min_ = val.minDate;
  26399. const max_ = val.maxDate;
  26400. const minDate_ = formatEmit(min_, 0);
  26401. const maxDate_ = formatEmit(max_, 1);
  26402. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  26403. return;
  26404. }
  26405. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  26406. maxDate.value = maxDate_;
  26407. minDate.value = minDate_;
  26408. if (!close || showTime.value)
  26409. return;
  26410. handleRangeConfirm();
  26411. };
  26412. const minTimePickerVisible = vue.ref(false);
  26413. const maxTimePickerVisible = vue.ref(false);
  26414. const handleMinTimeClose = () => {
  26415. minTimePickerVisible.value = false;
  26416. };
  26417. const handleMaxTimeClose = () => {
  26418. maxTimePickerVisible.value = false;
  26419. };
  26420. const handleDateInput = (value, type) => {
  26421. dateUserInput.value[type] = value;
  26422. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  26423. if (parsedValueD.isValid()) {
  26424. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  26425. return;
  26426. }
  26427. if (type === "min") {
  26428. leftDate.value = parsedValueD;
  26429. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  26430. if (!props.unlinkPanels) {
  26431. rightDate.value = parsedValueD.add(1, "month");
  26432. maxDate.value = minDate.value.add(1, "month");
  26433. }
  26434. } else {
  26435. rightDate.value = parsedValueD;
  26436. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  26437. if (!props.unlinkPanels) {
  26438. leftDate.value = parsedValueD.subtract(1, "month");
  26439. minDate.value = maxDate.value.subtract(1, "month");
  26440. }
  26441. }
  26442. }
  26443. };
  26444. const handleDateChange = (_, type) => {
  26445. dateUserInput.value[type] = null;
  26446. };
  26447. const handleTimeInput = (value, type) => {
  26448. timeUserInput.value[type] = value;
  26449. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  26450. if (parsedValueD.isValid()) {
  26451. if (type === "min") {
  26452. minTimePickerVisible.value = true;
  26453. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  26454. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  26455. maxDate.value = minDate.value;
  26456. }
  26457. } else {
  26458. maxTimePickerVisible.value = true;
  26459. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  26460. rightDate.value = maxDate.value;
  26461. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  26462. minDate.value = maxDate.value;
  26463. }
  26464. }
  26465. }
  26466. };
  26467. const handleTimeChange = (value, type) => {
  26468. timeUserInput.value[type] = null;
  26469. if (type === "min") {
  26470. leftDate.value = minDate.value;
  26471. minTimePickerVisible.value = false;
  26472. } else {
  26473. rightDate.value = maxDate.value;
  26474. maxTimePickerVisible.value = false;
  26475. }
  26476. };
  26477. const handleMinTimePick = (value, visible, first) => {
  26478. if (timeUserInput.value.min)
  26479. return;
  26480. if (value) {
  26481. leftDate.value = value;
  26482. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  26483. }
  26484. if (!first) {
  26485. minTimePickerVisible.value = visible;
  26486. }
  26487. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  26488. maxDate.value = minDate.value;
  26489. rightDate.value = value;
  26490. }
  26491. };
  26492. const handleMaxTimePick = (value, visible, first) => {
  26493. if (timeUserInput.value.max)
  26494. return;
  26495. if (value) {
  26496. rightDate.value = value;
  26497. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  26498. }
  26499. if (!first) {
  26500. maxTimePickerVisible.value = visible;
  26501. }
  26502. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  26503. minDate.value = maxDate.value;
  26504. }
  26505. };
  26506. const handleClear = () => {
  26507. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  26508. lang: vue.unref(lang),
  26509. unit: "month",
  26510. unlinkPanels: props.unlinkPanels
  26511. })[0];
  26512. rightDate.value = leftDate.value.add(1, "month");
  26513. emit("pick", null);
  26514. };
  26515. const formatToString = (value) => {
  26516. return isArray$1(value) ? value.map((_) => _.format(format)) : value.format(format);
  26517. };
  26518. const parseUserInput = (value) => {
  26519. return isArray$1(value) ? value.map((_) => dayjs(_, format).locale(lang.value)) : dayjs(value, format).locale(lang.value);
  26520. };
  26521. function onParsedValueChanged(minDate2, maxDate2) {
  26522. if (props.unlinkPanels && maxDate2) {
  26523. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  26524. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  26525. const maxDateYear = maxDate2.year();
  26526. const maxDateMonth = maxDate2.month();
  26527. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$1) : maxDate2;
  26528. } else {
  26529. rightDate.value = leftDate.value.add(1, unit$1);
  26530. if (maxDate2) {
  26531. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  26532. }
  26533. }
  26534. }
  26535. emit("set-picker-option", ["isValidValue", isValidRange]);
  26536. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  26537. emit("set-picker-option", ["formatToString", formatToString]);
  26538. emit("set-picker-option", ["handleClear", handleClear]);
  26539. return (_ctx, _cache) => {
  26540. return vue.openBlock(), vue.createElementBlock("div", {
  26541. class: vue.normalizeClass([
  26542. vue.unref(ppNs).b(),
  26543. vue.unref(drpNs).b(),
  26544. {
  26545. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  26546. "has-time": vue.unref(showTime)
  26547. }
  26548. ])
  26549. }, [
  26550. vue.createElementVNode("div", {
  26551. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  26552. }, [
  26553. vue.renderSlot(_ctx.$slots, "sidebar", {
  26554. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  26555. }),
  26556. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  26557. key: 0,
  26558. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  26559. }, [
  26560. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  26561. return vue.openBlock(), vue.createElementBlock("button", {
  26562. key,
  26563. type: "button",
  26564. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  26565. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  26566. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$E);
  26567. }), 128))
  26568. ], 2)) : vue.createCommentVNode("v-if", true),
  26569. vue.createElementVNode("div", {
  26570. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  26571. }, [
  26572. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  26573. key: 0,
  26574. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  26575. }, [
  26576. vue.createElementVNode("span", {
  26577. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  26578. }, [
  26579. vue.createElementVNode("span", {
  26580. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  26581. }, [
  26582. vue.createVNode(vue.unref(ElInput), {
  26583. size: "small",
  26584. disabled: vue.unref(rangeState).selecting,
  26585. placeholder: vue.unref(t)("el.datepicker.startDate"),
  26586. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  26587. "model-value": vue.unref(minVisibleDate),
  26588. "validate-event": false,
  26589. onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
  26590. onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
  26591. }, null, 8, ["disabled", "placeholder", "class", "model-value"])
  26592. ], 2),
  26593. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  26594. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  26595. }, [
  26596. vue.createVNode(vue.unref(ElInput), {
  26597. size: "small",
  26598. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  26599. disabled: vue.unref(rangeState).selecting,
  26600. placeholder: vue.unref(t)("el.datepicker.startTime"),
  26601. "model-value": vue.unref(minVisibleTime),
  26602. "validate-event": false,
  26603. onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
  26604. onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
  26605. onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
  26606. }, null, 8, ["class", "disabled", "placeholder", "model-value"]),
  26607. vue.createVNode(vue.unref(TimePickPanel), {
  26608. visible: minTimePickerVisible.value,
  26609. format: vue.unref(timeFormat),
  26610. "datetime-role": "start",
  26611. "time-arrow-control": vue.unref(arrowControl),
  26612. "parsed-value": leftDate.value,
  26613. onPick: handleMinTimePick
  26614. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  26615. ], 2)), [
  26616. [vue.unref(ClickOutside), handleMinTimeClose]
  26617. ])
  26618. ], 2),
  26619. vue.createElementVNode("span", null, [
  26620. vue.createVNode(vue.unref(ElIcon), null, {
  26621. default: vue.withCtx(() => [
  26622. vue.createVNode(vue.unref(arrow_right_default))
  26623. ]),
  26624. _: 1
  26625. })
  26626. ]),
  26627. vue.createElementVNode("span", {
  26628. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  26629. }, [
  26630. vue.createElementVNode("span", {
  26631. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  26632. }, [
  26633. vue.createVNode(vue.unref(ElInput), {
  26634. size: "small",
  26635. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  26636. disabled: vue.unref(rangeState).selecting,
  26637. placeholder: vue.unref(t)("el.datepicker.endDate"),
  26638. "model-value": vue.unref(maxVisibleDate),
  26639. readonly: !vue.unref(minDate),
  26640. "validate-event": false,
  26641. onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
  26642. onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
  26643. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"])
  26644. ], 2),
  26645. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  26646. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  26647. }, [
  26648. vue.createVNode(vue.unref(ElInput), {
  26649. size: "small",
  26650. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  26651. disabled: vue.unref(rangeState).selecting,
  26652. placeholder: vue.unref(t)("el.datepicker.endTime"),
  26653. "model-value": vue.unref(maxVisibleTime),
  26654. readonly: !vue.unref(minDate),
  26655. "validate-event": false,
  26656. onFocus: _cache[7] || (_cache[7] = ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true)),
  26657. onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
  26658. onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
  26659. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]),
  26660. vue.createVNode(vue.unref(TimePickPanel), {
  26661. "datetime-role": "end",
  26662. visible: maxTimePickerVisible.value,
  26663. format: vue.unref(timeFormat),
  26664. "time-arrow-control": vue.unref(arrowControl),
  26665. "parsed-value": rightDate.value,
  26666. onPick: handleMaxTimePick
  26667. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  26668. ], 2)), [
  26669. [vue.unref(ClickOutside), handleMaxTimeClose]
  26670. ])
  26671. ], 2)
  26672. ], 2)) : vue.createCommentVNode("v-if", true),
  26673. vue.createElementVNode("div", {
  26674. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  26675. }, [
  26676. vue.createElementVNode("div", {
  26677. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  26678. }, [
  26679. vue.createElementVNode("button", {
  26680. type: "button",
  26681. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  26682. onClick: leftPrevYear
  26683. }, [
  26684. vue.createVNode(vue.unref(ElIcon), null, {
  26685. default: vue.withCtx(() => [
  26686. vue.createVNode(vue.unref(d_arrow_left_default))
  26687. ]),
  26688. _: 1
  26689. })
  26690. ], 2),
  26691. vue.createElementVNode("button", {
  26692. type: "button",
  26693. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  26694. onClick: leftPrevMonth
  26695. }, [
  26696. vue.createVNode(vue.unref(ElIcon), null, {
  26697. default: vue.withCtx(() => [
  26698. vue.createVNode(vue.unref(arrow_left_default))
  26699. ]),
  26700. _: 1
  26701. })
  26702. ], 2),
  26703. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  26704. key: 0,
  26705. type: "button",
  26706. disabled: !vue.unref(enableYearArrow),
  26707. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]),
  26708. onClick: leftNextYear
  26709. }, [
  26710. vue.createVNode(vue.unref(ElIcon), null, {
  26711. default: vue.withCtx(() => [
  26712. vue.createVNode(vue.unref(d_arrow_right_default))
  26713. ]),
  26714. _: 1
  26715. })
  26716. ], 10, _hoisted_2$p)) : vue.createCommentVNode("v-if", true),
  26717. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  26718. key: 1,
  26719. type: "button",
  26720. disabled: !vue.unref(enableMonthArrow),
  26721. class: vue.normalizeClass([[
  26722. vue.unref(ppNs).e("icon-btn"),
  26723. { "is-disabled": !vue.unref(enableMonthArrow) }
  26724. ], "arrow-right"]),
  26725. onClick: leftNextMonth
  26726. }, [
  26727. vue.createVNode(vue.unref(ElIcon), null, {
  26728. default: vue.withCtx(() => [
  26729. vue.createVNode(vue.unref(arrow_right_default))
  26730. ]),
  26731. _: 1
  26732. })
  26733. ], 10, _hoisted_3$c)) : vue.createCommentVNode("v-if", true),
  26734. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  26735. ], 2),
  26736. vue.createVNode(DateTable, {
  26737. "selection-mode": "range",
  26738. date: leftDate.value,
  26739. "min-date": vue.unref(minDate),
  26740. "max-date": vue.unref(maxDate),
  26741. "range-state": vue.unref(rangeState),
  26742. "disabled-date": vue.unref(disabledDate),
  26743. "cell-class-name": vue.unref(cellClassName),
  26744. onChangerange: vue.unref(handleChangeRange),
  26745. onPick: handleRangePick,
  26746. onSelect: vue.unref(onSelect)
  26747. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  26748. ], 2),
  26749. vue.createElementVNode("div", {
  26750. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  26751. }, [
  26752. vue.createElementVNode("div", {
  26753. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  26754. }, [
  26755. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  26756. key: 0,
  26757. type: "button",
  26758. disabled: !vue.unref(enableYearArrow),
  26759. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  26760. onClick: rightPrevYear
  26761. }, [
  26762. vue.createVNode(vue.unref(ElIcon), null, {
  26763. default: vue.withCtx(() => [
  26764. vue.createVNode(vue.unref(d_arrow_left_default))
  26765. ]),
  26766. _: 1
  26767. })
  26768. ], 10, _hoisted_4$8)) : vue.createCommentVNode("v-if", true),
  26769. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  26770. key: 1,
  26771. type: "button",
  26772. disabled: !vue.unref(enableMonthArrow),
  26773. class: vue.normalizeClass([[
  26774. vue.unref(ppNs).e("icon-btn"),
  26775. { "is-disabled": !vue.unref(enableMonthArrow) }
  26776. ], "arrow-left"]),
  26777. onClick: rightPrevMonth
  26778. }, [
  26779. vue.createVNode(vue.unref(ElIcon), null, {
  26780. default: vue.withCtx(() => [
  26781. vue.createVNode(vue.unref(arrow_left_default))
  26782. ]),
  26783. _: 1
  26784. })
  26785. ], 10, _hoisted_5$6)) : vue.createCommentVNode("v-if", true),
  26786. vue.createElementVNode("button", {
  26787. type: "button",
  26788. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  26789. onClick: rightNextYear
  26790. }, [
  26791. vue.createVNode(vue.unref(ElIcon), null, {
  26792. default: vue.withCtx(() => [
  26793. vue.createVNode(vue.unref(d_arrow_right_default))
  26794. ]),
  26795. _: 1
  26796. })
  26797. ], 2),
  26798. vue.createElementVNode("button", {
  26799. type: "button",
  26800. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  26801. onClick: rightNextMonth
  26802. }, [
  26803. vue.createVNode(vue.unref(ElIcon), null, {
  26804. default: vue.withCtx(() => [
  26805. vue.createVNode(vue.unref(arrow_right_default))
  26806. ]),
  26807. _: 1
  26808. })
  26809. ], 2),
  26810. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  26811. ], 2),
  26812. vue.createVNode(DateTable, {
  26813. "selection-mode": "range",
  26814. date: rightDate.value,
  26815. "min-date": vue.unref(minDate),
  26816. "max-date": vue.unref(maxDate),
  26817. "range-state": vue.unref(rangeState),
  26818. "disabled-date": vue.unref(disabledDate),
  26819. "cell-class-name": vue.unref(cellClassName),
  26820. onChangerange: vue.unref(handleChangeRange),
  26821. onPick: handleRangePick,
  26822. onSelect: vue.unref(onSelect)
  26823. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  26824. ], 2)
  26825. ], 2)
  26826. ], 2),
  26827. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  26828. key: 0,
  26829. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  26830. }, [
  26831. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  26832. key: 0,
  26833. text: "",
  26834. size: "small",
  26835. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  26836. onClick: handleClear
  26837. }, {
  26838. default: vue.withCtx(() => [
  26839. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  26840. ]),
  26841. _: 1
  26842. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  26843. vue.createVNode(vue.unref(ElButton), {
  26844. plain: "",
  26845. size: "small",
  26846. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  26847. disabled: vue.unref(btnDisabled),
  26848. onClick: _cache[10] || (_cache[10] = ($event) => vue.unref(handleRangeConfirm)(false))
  26849. }, {
  26850. default: vue.withCtx(() => [
  26851. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  26852. ]),
  26853. _: 1
  26854. }, 8, ["class", "disabled"])
  26855. ], 2)) : vue.createCommentVNode("v-if", true)
  26856. ], 2);
  26857. };
  26858. }
  26859. });
  26860. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["__file", "panel-date-range.vue"]]);
  26861. const panelMonthRangeProps = buildProps({
  26862. ...panelRangeSharedProps
  26863. });
  26864. const panelMonthRangeEmits = ["pick", "set-picker-option"];
  26865. const useMonthRangeHeader = ({
  26866. unlinkPanels,
  26867. leftDate,
  26868. rightDate
  26869. }) => {
  26870. const { t } = useLocale();
  26871. const leftPrevYear = () => {
  26872. leftDate.value = leftDate.value.subtract(1, "year");
  26873. if (!unlinkPanels.value) {
  26874. rightDate.value = rightDate.value.subtract(1, "year");
  26875. }
  26876. };
  26877. const rightNextYear = () => {
  26878. if (!unlinkPanels.value) {
  26879. leftDate.value = leftDate.value.add(1, "year");
  26880. }
  26881. rightDate.value = rightDate.value.add(1, "year");
  26882. };
  26883. const leftNextYear = () => {
  26884. leftDate.value = leftDate.value.add(1, "year");
  26885. };
  26886. const rightPrevYear = () => {
  26887. rightDate.value = rightDate.value.subtract(1, "year");
  26888. };
  26889. const leftLabel = vue.computed(() => {
  26890. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  26891. });
  26892. const rightLabel = vue.computed(() => {
  26893. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  26894. });
  26895. const leftYear = vue.computed(() => {
  26896. return leftDate.value.year();
  26897. });
  26898. const rightYear = vue.computed(() => {
  26899. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  26900. });
  26901. return {
  26902. leftPrevYear,
  26903. rightNextYear,
  26904. leftNextYear,
  26905. rightPrevYear,
  26906. leftLabel,
  26907. rightLabel,
  26908. leftYear,
  26909. rightYear
  26910. };
  26911. };
  26912. const _hoisted_1$D = ["onClick"];
  26913. const _hoisted_2$o = ["disabled"];
  26914. const _hoisted_3$b = ["disabled"];
  26915. const unit = "year";
  26916. const __default__$R = vue.defineComponent({
  26917. name: "DatePickerMonthRange"
  26918. });
  26919. const _sfc_main$1g = /* @__PURE__ */ vue.defineComponent({
  26920. ...__default__$R,
  26921. props: panelMonthRangeProps,
  26922. emits: panelMonthRangeEmits,
  26923. setup(__props, { emit }) {
  26924. const props = __props;
  26925. const { lang } = useLocale();
  26926. const pickerBase = vue.inject("EP_PICKER_BASE");
  26927. const { shortcuts, disabledDate, format } = pickerBase.props;
  26928. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  26929. const leftDate = vue.ref(dayjs().locale(lang.value));
  26930. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit));
  26931. const {
  26932. minDate,
  26933. maxDate,
  26934. rangeState,
  26935. ppNs,
  26936. drpNs,
  26937. handleChangeRange,
  26938. handleRangeConfirm,
  26939. handleShortcutClick,
  26940. onSelect
  26941. } = useRangePicker(props, {
  26942. defaultValue,
  26943. leftDate,
  26944. rightDate,
  26945. unit,
  26946. onParsedValueChanged
  26947. });
  26948. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  26949. const {
  26950. leftPrevYear,
  26951. rightNextYear,
  26952. leftNextYear,
  26953. rightPrevYear,
  26954. leftLabel,
  26955. rightLabel,
  26956. leftYear,
  26957. rightYear
  26958. } = useMonthRangeHeader({
  26959. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  26960. leftDate,
  26961. rightDate
  26962. });
  26963. const enableYearArrow = vue.computed(() => {
  26964. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  26965. });
  26966. const handleRangePick = (val, close = true) => {
  26967. const minDate_ = val.minDate;
  26968. const maxDate_ = val.maxDate;
  26969. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  26970. return;
  26971. }
  26972. maxDate.value = maxDate_;
  26973. minDate.value = minDate_;
  26974. if (!close)
  26975. return;
  26976. handleRangeConfirm();
  26977. };
  26978. const formatToString = (days) => {
  26979. return days.map((day) => day.format(format));
  26980. };
  26981. function onParsedValueChanged(minDate2, maxDate2) {
  26982. if (props.unlinkPanels && maxDate2) {
  26983. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  26984. const maxDateYear = maxDate2.year();
  26985. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit) : maxDate2;
  26986. } else {
  26987. rightDate.value = leftDate.value.add(1, unit);
  26988. }
  26989. }
  26990. emit("set-picker-option", ["formatToString", formatToString]);
  26991. return (_ctx, _cache) => {
  26992. return vue.openBlock(), vue.createElementBlock("div", {
  26993. class: vue.normalizeClass([
  26994. vue.unref(ppNs).b(),
  26995. vue.unref(drpNs).b(),
  26996. {
  26997. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  26998. }
  26999. ])
  27000. }, [
  27001. vue.createElementVNode("div", {
  27002. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27003. }, [
  27004. vue.renderSlot(_ctx.$slots, "sidebar", {
  27005. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27006. }),
  27007. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27008. key: 0,
  27009. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27010. }, [
  27011. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27012. return vue.openBlock(), vue.createElementBlock("button", {
  27013. key,
  27014. type: "button",
  27015. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27016. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  27017. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$D);
  27018. }), 128))
  27019. ], 2)) : vue.createCommentVNode("v-if", true),
  27020. vue.createElementVNode("div", {
  27021. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27022. }, [
  27023. vue.createElementVNode("div", {
  27024. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  27025. }, [
  27026. vue.createElementVNode("div", {
  27027. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27028. }, [
  27029. vue.createElementVNode("button", {
  27030. type: "button",
  27031. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  27032. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(leftPrevYear) && vue.unref(leftPrevYear)(...args))
  27033. }, [
  27034. vue.createVNode(vue.unref(ElIcon), null, {
  27035. default: vue.withCtx(() => [
  27036. vue.createVNode(vue.unref(d_arrow_left_default))
  27037. ]),
  27038. _: 1
  27039. })
  27040. ], 2),
  27041. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27042. key: 0,
  27043. type: "button",
  27044. disabled: !vue.unref(enableYearArrow),
  27045. class: vue.normalizeClass([[
  27046. vue.unref(ppNs).e("icon-btn"),
  27047. { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) }
  27048. ], "d-arrow-right"]),
  27049. onClick: _cache[1] || (_cache[1] = (...args) => vue.unref(leftNextYear) && vue.unref(leftNextYear)(...args))
  27050. }, [
  27051. vue.createVNode(vue.unref(ElIcon), null, {
  27052. default: vue.withCtx(() => [
  27053. vue.createVNode(vue.unref(d_arrow_right_default))
  27054. ]),
  27055. _: 1
  27056. })
  27057. ], 10, _hoisted_2$o)) : vue.createCommentVNode("v-if", true),
  27058. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  27059. ], 2),
  27060. vue.createVNode(MonthTable, {
  27061. "selection-mode": "range",
  27062. date: leftDate.value,
  27063. "min-date": vue.unref(minDate),
  27064. "max-date": vue.unref(maxDate),
  27065. "range-state": vue.unref(rangeState),
  27066. "disabled-date": vue.unref(disabledDate),
  27067. onChangerange: vue.unref(handleChangeRange),
  27068. onPick: handleRangePick,
  27069. onSelect: vue.unref(onSelect)
  27070. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  27071. ], 2),
  27072. vue.createElementVNode("div", {
  27073. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  27074. }, [
  27075. vue.createElementVNode("div", {
  27076. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27077. }, [
  27078. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27079. key: 0,
  27080. type: "button",
  27081. disabled: !vue.unref(enableYearArrow),
  27082. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  27083. onClick: _cache[2] || (_cache[2] = (...args) => vue.unref(rightPrevYear) && vue.unref(rightPrevYear)(...args))
  27084. }, [
  27085. vue.createVNode(vue.unref(ElIcon), null, {
  27086. default: vue.withCtx(() => [
  27087. vue.createVNode(vue.unref(d_arrow_left_default))
  27088. ]),
  27089. _: 1
  27090. })
  27091. ], 10, _hoisted_3$b)) : vue.createCommentVNode("v-if", true),
  27092. vue.createElementVNode("button", {
  27093. type: "button",
  27094. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27095. onClick: _cache[3] || (_cache[3] = (...args) => vue.unref(rightNextYear) && vue.unref(rightNextYear)(...args))
  27096. }, [
  27097. vue.createVNode(vue.unref(ElIcon), null, {
  27098. default: vue.withCtx(() => [
  27099. vue.createVNode(vue.unref(d_arrow_right_default))
  27100. ]),
  27101. _: 1
  27102. })
  27103. ], 2),
  27104. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  27105. ], 2),
  27106. vue.createVNode(MonthTable, {
  27107. "selection-mode": "range",
  27108. date: rightDate.value,
  27109. "min-date": vue.unref(minDate),
  27110. "max-date": vue.unref(maxDate),
  27111. "range-state": vue.unref(rangeState),
  27112. "disabled-date": vue.unref(disabledDate),
  27113. onChangerange: vue.unref(handleChangeRange),
  27114. onPick: handleRangePick,
  27115. onSelect: vue.unref(onSelect)
  27116. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  27117. ], 2)
  27118. ], 2)
  27119. ], 2)
  27120. ], 2);
  27121. };
  27122. }
  27123. });
  27124. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__file", "panel-month-range.vue"]]);
  27125. const getPanel = function(type) {
  27126. switch (type) {
  27127. case "daterange":
  27128. case "datetimerange": {
  27129. return DateRangePickPanel;
  27130. }
  27131. case "monthrange": {
  27132. return MonthRangePickPanel;
  27133. }
  27134. default: {
  27135. return DatePickPanel;
  27136. }
  27137. }
  27138. };
  27139. dayjs.extend(localeData);
  27140. dayjs.extend(advancedFormat);
  27141. dayjs.extend(customParseFormat);
  27142. dayjs.extend(weekOfYear);
  27143. dayjs.extend(weekYear);
  27144. dayjs.extend(dayOfYear);
  27145. dayjs.extend(isSameOrAfter);
  27146. dayjs.extend(isSameOrBefore);
  27147. var DatePicker = vue.defineComponent({
  27148. name: "ElDatePicker",
  27149. install: null,
  27150. props: {
  27151. ...timePickerDefaultProps,
  27152. ...datePickerProps
  27153. },
  27154. emits: ["update:modelValue"],
  27155. setup(props, {
  27156. expose,
  27157. emit,
  27158. slots
  27159. }) {
  27160. const ns = useNamespace("picker-panel");
  27161. vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions")));
  27162. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  27163. slots,
  27164. pickerNs: ns
  27165. });
  27166. const commonPicker = vue.ref();
  27167. const refProps = {
  27168. focus: (focusStartInput = true) => {
  27169. var _a;
  27170. (_a = commonPicker.value) == null ? void 0 : _a.focus(focusStartInput);
  27171. },
  27172. handleOpen: () => {
  27173. var _a;
  27174. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  27175. },
  27176. handleClose: () => {
  27177. var _a;
  27178. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  27179. }
  27180. };
  27181. expose(refProps);
  27182. const onModelValueUpdated = (val) => {
  27183. emit("update:modelValue", val);
  27184. };
  27185. return () => {
  27186. var _a;
  27187. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  27188. const Component = getPanel(props.type);
  27189. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  27190. "format": format,
  27191. "type": props.type,
  27192. "ref": commonPicker,
  27193. "onUpdate:modelValue": onModelValueUpdated
  27194. }), {
  27195. default: (scopedProps) => vue.createVNode(Component, scopedProps, null),
  27196. "range-separator": slots["range-separator"]
  27197. });
  27198. };
  27199. }
  27200. });
  27201. const _DatePicker = DatePicker;
  27202. _DatePicker.install = (app) => {
  27203. app.component(_DatePicker.name, _DatePicker);
  27204. };
  27205. const ElDatePicker = _DatePicker;
  27206. const descriptionsKey = Symbol("elDescriptions");
  27207. var ElDescriptionsCell = vue.defineComponent({
  27208. name: "ElDescriptionsCell",
  27209. props: {
  27210. cell: {
  27211. type: Object
  27212. },
  27213. tag: {
  27214. type: String
  27215. },
  27216. type: {
  27217. type: String
  27218. }
  27219. },
  27220. setup() {
  27221. const descriptions = vue.inject(descriptionsKey, {});
  27222. return {
  27223. descriptions
  27224. };
  27225. },
  27226. render() {
  27227. var _a, _b, _c, _d, _e, _f;
  27228. const item = getNormalizedProps(this.cell);
  27229. const { border, direction } = this.descriptions;
  27230. const isVertical = direction === "vertical";
  27231. const label = ((_c = (_b = (_a = this.cell) == null ? void 0 : _a.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  27232. const content = (_f = (_e = (_d = this.cell) == null ? void 0 : _d.children) == null ? void 0 : _e.default) == null ? void 0 : _f.call(_e);
  27233. const span = item.span;
  27234. const align = item.align ? `is-${item.align}` : "";
  27235. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  27236. const className = item.className;
  27237. const labelClassName = item.labelClassName;
  27238. const style = {
  27239. width: addUnit(item.width),
  27240. minWidth: addUnit(item.minWidth)
  27241. };
  27242. const ns = useNamespace("descriptions");
  27243. switch (this.type) {
  27244. case "label":
  27245. return vue.h(this.tag, {
  27246. style,
  27247. class: [
  27248. ns.e("cell"),
  27249. ns.e("label"),
  27250. ns.is("bordered-label", border),
  27251. ns.is("vertical-label", isVertical),
  27252. labelAlign,
  27253. labelClassName
  27254. ],
  27255. colSpan: isVertical ? span : 1
  27256. }, label);
  27257. case "content":
  27258. return vue.h(this.tag, {
  27259. style,
  27260. class: [
  27261. ns.e("cell"),
  27262. ns.e("content"),
  27263. ns.is("bordered-content", border),
  27264. ns.is("vertical-content", isVertical),
  27265. align,
  27266. className
  27267. ],
  27268. colSpan: isVertical ? span : span * 2 - 1
  27269. }, content);
  27270. default:
  27271. return vue.h("td", {
  27272. style,
  27273. class: [ns.e("cell"), align],
  27274. colSpan: span
  27275. }, [
  27276. !isNil(label) ? vue.h("span", {
  27277. class: [ns.e("label"), labelClassName]
  27278. }, label) : void 0,
  27279. vue.h("span", {
  27280. class: [ns.e("content"), className]
  27281. }, content)
  27282. ]);
  27283. }
  27284. }
  27285. });
  27286. const descriptionsRowProps = buildProps({
  27287. row: {
  27288. type: Array,
  27289. default: () => []
  27290. }
  27291. });
  27292. const _hoisted_1$C = { key: 1 };
  27293. const __default__$Q = vue.defineComponent({
  27294. name: "ElDescriptionsRow"
  27295. });
  27296. const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
  27297. ...__default__$Q,
  27298. props: descriptionsRowProps,
  27299. setup(__props) {
  27300. const descriptions = vue.inject(descriptionsKey, {});
  27301. return (_ctx, _cache) => {
  27302. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  27303. vue.createElementVNode("tr", null, [
  27304. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  27305. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  27306. key: `tr1-${index}`,
  27307. cell,
  27308. tag: "th",
  27309. type: "label"
  27310. }, null, 8, ["cell"]);
  27311. }), 128))
  27312. ]),
  27313. vue.createElementVNode("tr", null, [
  27314. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  27315. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  27316. key: `tr2-${index}`,
  27317. cell,
  27318. tag: "td",
  27319. type: "content"
  27320. }, null, 8, ["cell"]);
  27321. }), 128))
  27322. ])
  27323. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", _hoisted_1$C, [
  27324. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  27325. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  27326. key: `tr3-${index}`
  27327. }, [
  27328. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  27329. vue.createVNode(vue.unref(ElDescriptionsCell), {
  27330. cell,
  27331. tag: "td",
  27332. type: "label"
  27333. }, null, 8, ["cell"]),
  27334. vue.createVNode(vue.unref(ElDescriptionsCell), {
  27335. cell,
  27336. tag: "td",
  27337. type: "content"
  27338. }, null, 8, ["cell"])
  27339. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  27340. key: 1,
  27341. cell,
  27342. tag: "td",
  27343. type: "both"
  27344. }, null, 8, ["cell"]))
  27345. ], 64);
  27346. }), 128))
  27347. ]));
  27348. };
  27349. }
  27350. });
  27351. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__file", "descriptions-row.vue"]]);
  27352. const descriptionProps = buildProps({
  27353. border: {
  27354. type: Boolean,
  27355. default: false
  27356. },
  27357. column: {
  27358. type: Number,
  27359. default: 3
  27360. },
  27361. direction: {
  27362. type: String,
  27363. values: ["horizontal", "vertical"],
  27364. default: "horizontal"
  27365. },
  27366. size: useSizeProp,
  27367. title: {
  27368. type: String,
  27369. default: ""
  27370. },
  27371. extra: {
  27372. type: String,
  27373. default: ""
  27374. }
  27375. });
  27376. const __default__$P = vue.defineComponent({
  27377. name: "ElDescriptions"
  27378. });
  27379. const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
  27380. ...__default__$P,
  27381. props: descriptionProps,
  27382. setup(__props) {
  27383. const props = __props;
  27384. const ns = useNamespace("descriptions");
  27385. const descriptionsSize = useFormSize();
  27386. const slots = vue.useSlots();
  27387. vue.provide(descriptionsKey, props);
  27388. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  27389. const filledNode = (node, span, count, isLast = false) => {
  27390. if (!node.props) {
  27391. node.props = {};
  27392. }
  27393. if (span > count) {
  27394. node.props.span = count;
  27395. }
  27396. if (isLast) {
  27397. node.props.span = span;
  27398. }
  27399. return node;
  27400. };
  27401. const getRows = () => {
  27402. var _a;
  27403. const children = flattedChildren((_a = slots.default) == null ? void 0 : _a.call(slots)).filter((node) => {
  27404. var _a2;
  27405. return ((_a2 = node == null ? void 0 : node.type) == null ? void 0 : _a2.name) === "ElDescriptionsItem";
  27406. });
  27407. const rows = [];
  27408. let temp = [];
  27409. let count = props.column;
  27410. let totalSpan = 0;
  27411. children.forEach((node, index) => {
  27412. var _a2;
  27413. const span = ((_a2 = node.props) == null ? void 0 : _a2.span) || 1;
  27414. if (index < children.length - 1) {
  27415. totalSpan += span > count ? count : span;
  27416. }
  27417. if (index === children.length - 1) {
  27418. const lastSpan = props.column - totalSpan % props.column;
  27419. temp.push(filledNode(node, lastSpan, count, true));
  27420. rows.push(temp);
  27421. return;
  27422. }
  27423. if (span < count) {
  27424. count -= span;
  27425. temp.push(node);
  27426. } else {
  27427. temp.push(filledNode(node, span, count));
  27428. rows.push(temp);
  27429. count = props.column;
  27430. temp = [];
  27431. }
  27432. });
  27433. return rows;
  27434. };
  27435. return (_ctx, _cache) => {
  27436. return vue.openBlock(), vue.createElementBlock("div", {
  27437. class: vue.normalizeClass(vue.unref(descriptionKls))
  27438. }, [
  27439. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  27440. key: 0,
  27441. class: vue.normalizeClass(vue.unref(ns).e("header"))
  27442. }, [
  27443. vue.createElementVNode("div", {
  27444. class: vue.normalizeClass(vue.unref(ns).e("title"))
  27445. }, [
  27446. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  27447. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  27448. ])
  27449. ], 2),
  27450. vue.createElementVNode("div", {
  27451. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  27452. }, [
  27453. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  27454. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  27455. ])
  27456. ], 2)
  27457. ], 2)) : vue.createCommentVNode("v-if", true),
  27458. vue.createElementVNode("div", {
  27459. class: vue.normalizeClass(vue.unref(ns).e("body"))
  27460. }, [
  27461. vue.createElementVNode("table", {
  27462. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  27463. }, [
  27464. vue.createElementVNode("tbody", null, [
  27465. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, index) => {
  27466. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  27467. key: index,
  27468. row
  27469. }, null, 8, ["row"]);
  27470. }), 128))
  27471. ])
  27472. ], 2)
  27473. ], 2)
  27474. ], 2);
  27475. };
  27476. }
  27477. });
  27478. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__file", "description.vue"]]);
  27479. var DescriptionsItem = vue.defineComponent({
  27480. name: "ElDescriptionsItem",
  27481. props: {
  27482. label: {
  27483. type: String,
  27484. default: ""
  27485. },
  27486. span: {
  27487. type: Number,
  27488. default: 1
  27489. },
  27490. width: {
  27491. type: [String, Number],
  27492. default: ""
  27493. },
  27494. minWidth: {
  27495. type: [String, Number],
  27496. default: ""
  27497. },
  27498. align: {
  27499. type: String,
  27500. default: "left"
  27501. },
  27502. labelAlign: {
  27503. type: String,
  27504. default: ""
  27505. },
  27506. className: {
  27507. type: String,
  27508. default: ""
  27509. },
  27510. labelClassName: {
  27511. type: String,
  27512. default: ""
  27513. }
  27514. }
  27515. });
  27516. const ElDescriptions = withInstall(Descriptions, {
  27517. DescriptionsItem
  27518. });
  27519. const ElDescriptionsItem = withNoopInstall(DescriptionsItem);
  27520. const overlayProps = buildProps({
  27521. mask: {
  27522. type: Boolean,
  27523. default: true
  27524. },
  27525. customMaskEvent: {
  27526. type: Boolean,
  27527. default: false
  27528. },
  27529. overlayClass: {
  27530. type: definePropType([
  27531. String,
  27532. Array,
  27533. Object
  27534. ])
  27535. },
  27536. zIndex: {
  27537. type: definePropType([String, Number])
  27538. }
  27539. });
  27540. const overlayEmits = {
  27541. click: (evt) => evt instanceof MouseEvent
  27542. };
  27543. const BLOCK = "overlay";
  27544. var Overlay$1 = vue.defineComponent({
  27545. name: "ElOverlay",
  27546. props: overlayProps,
  27547. emits: overlayEmits,
  27548. setup(props, { slots, emit }) {
  27549. const ns = useNamespace(BLOCK);
  27550. const onMaskClick = (e) => {
  27551. emit("click", e);
  27552. };
  27553. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  27554. return () => {
  27555. return props.mask ? vue.createVNode("div", {
  27556. class: [ns.b(), props.overlayClass],
  27557. style: {
  27558. zIndex: props.zIndex
  27559. },
  27560. onClick,
  27561. onMousedown,
  27562. onMouseup
  27563. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  27564. class: props.overlayClass,
  27565. style: {
  27566. zIndex: props.zIndex,
  27567. position: "fixed",
  27568. top: "0px",
  27569. right: "0px",
  27570. bottom: "0px",
  27571. left: "0px"
  27572. }
  27573. }, [vue.renderSlot(slots, "default")]);
  27574. };
  27575. }
  27576. });
  27577. const ElOverlay = Overlay$1;
  27578. const dialogInjectionKey = Symbol("dialogInjectionKey");
  27579. const dialogContentProps = buildProps({
  27580. center: {
  27581. type: Boolean,
  27582. default: false
  27583. },
  27584. alignCenter: {
  27585. type: Boolean,
  27586. default: false
  27587. },
  27588. closeIcon: {
  27589. type: iconPropType
  27590. },
  27591. customClass: {
  27592. type: String,
  27593. default: ""
  27594. },
  27595. draggable: {
  27596. type: Boolean,
  27597. default: false
  27598. },
  27599. fullscreen: {
  27600. type: Boolean,
  27601. default: false
  27602. },
  27603. showClose: {
  27604. type: Boolean,
  27605. default: true
  27606. },
  27607. title: {
  27608. type: String,
  27609. default: ""
  27610. }
  27611. });
  27612. const dialogContentEmits = {
  27613. close: () => true
  27614. };
  27615. const _hoisted_1$B = ["aria-label"];
  27616. const _hoisted_2$n = ["id"];
  27617. const __default__$O = vue.defineComponent({ name: "ElDialogContent" });
  27618. const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
  27619. ...__default__$O,
  27620. props: dialogContentProps,
  27621. emits: dialogContentEmits,
  27622. setup(__props) {
  27623. const props = __props;
  27624. const { t } = useLocale();
  27625. const { Close } = CloseComponents;
  27626. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  27627. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  27628. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  27629. const draggable = vue.computed(() => props.draggable);
  27630. useDraggable(dialogRef, headerRef, draggable);
  27631. return (_ctx, _cache) => {
  27632. return vue.openBlock(), vue.createElementBlock("div", {
  27633. ref: vue.unref(composedDialogRef),
  27634. class: vue.normalizeClass([
  27635. vue.unref(ns).b(),
  27636. vue.unref(ns).is("fullscreen", _ctx.fullscreen),
  27637. vue.unref(ns).is("draggable", vue.unref(draggable)),
  27638. vue.unref(ns).is("align-center", _ctx.alignCenter),
  27639. { [vue.unref(ns).m("center")]: _ctx.center },
  27640. _ctx.customClass
  27641. ]),
  27642. style: vue.normalizeStyle(vue.unref(style)),
  27643. tabindex: "-1"
  27644. }, [
  27645. vue.createElementVNode("header", {
  27646. ref_key: "headerRef",
  27647. ref: headerRef,
  27648. class: vue.normalizeClass(vue.unref(ns).e("header"))
  27649. }, [
  27650. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  27651. vue.createElementVNode("span", {
  27652. role: "heading",
  27653. class: vue.normalizeClass(vue.unref(ns).e("title"))
  27654. }, vue.toDisplayString(_ctx.title), 3)
  27655. ]),
  27656. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  27657. key: 0,
  27658. "aria-label": vue.unref(t)("el.dialog.close"),
  27659. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  27660. type: "button",
  27661. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  27662. }, [
  27663. vue.createVNode(vue.unref(ElIcon), {
  27664. class: vue.normalizeClass(vue.unref(ns).e("close"))
  27665. }, {
  27666. default: vue.withCtx(() => [
  27667. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  27668. ]),
  27669. _: 1
  27670. }, 8, ["class"])
  27671. ], 10, _hoisted_1$B)) : vue.createCommentVNode("v-if", true)
  27672. ], 2),
  27673. vue.createElementVNode("div", {
  27674. id: vue.unref(bodyId),
  27675. class: vue.normalizeClass(vue.unref(ns).e("body"))
  27676. }, [
  27677. vue.renderSlot(_ctx.$slots, "default")
  27678. ], 10, _hoisted_2$n),
  27679. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  27680. key: 0,
  27681. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  27682. }, [
  27683. vue.renderSlot(_ctx.$slots, "footer")
  27684. ], 2)) : vue.createCommentVNode("v-if", true)
  27685. ], 6);
  27686. };
  27687. }
  27688. });
  27689. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__file", "dialog-content.vue"]]);
  27690. const dialogProps = buildProps({
  27691. ...dialogContentProps,
  27692. appendToBody: {
  27693. type: Boolean,
  27694. default: false
  27695. },
  27696. beforeClose: {
  27697. type: definePropType(Function)
  27698. },
  27699. destroyOnClose: {
  27700. type: Boolean,
  27701. default: false
  27702. },
  27703. closeOnClickModal: {
  27704. type: Boolean,
  27705. default: true
  27706. },
  27707. closeOnPressEscape: {
  27708. type: Boolean,
  27709. default: true
  27710. },
  27711. lockScroll: {
  27712. type: Boolean,
  27713. default: true
  27714. },
  27715. modal: {
  27716. type: Boolean,
  27717. default: true
  27718. },
  27719. openDelay: {
  27720. type: Number,
  27721. default: 0
  27722. },
  27723. closeDelay: {
  27724. type: Number,
  27725. default: 0
  27726. },
  27727. top: {
  27728. type: String
  27729. },
  27730. modelValue: {
  27731. type: Boolean,
  27732. default: false
  27733. },
  27734. modalClass: String,
  27735. width: {
  27736. type: [String, Number]
  27737. },
  27738. zIndex: {
  27739. type: Number
  27740. },
  27741. trapFocus: {
  27742. type: Boolean,
  27743. default: false
  27744. }
  27745. });
  27746. const dialogEmits = {
  27747. open: () => true,
  27748. opened: () => true,
  27749. close: () => true,
  27750. closed: () => true,
  27751. [UPDATE_MODEL_EVENT]: (value) => isBoolean$1(value),
  27752. openAutoFocus: () => true,
  27753. closeAutoFocus: () => true
  27754. };
  27755. const useDialog = (props, targetRef) => {
  27756. const instance = vue.getCurrentInstance();
  27757. const emit = instance.emit;
  27758. const { nextZIndex } = useZIndex();
  27759. let lastPosition = "";
  27760. const titleId = useId();
  27761. const bodyId = useId();
  27762. const visible = vue.ref(false);
  27763. const closed = vue.ref(false);
  27764. const rendered = vue.ref(false);
  27765. const zIndex = vue.ref(props.zIndex || nextZIndex());
  27766. let openTimer = void 0;
  27767. let closeTimer = void 0;
  27768. const namespace = useGlobalConfig("namespace", defaultNamespace);
  27769. const style = vue.computed(() => {
  27770. const style2 = {};
  27771. const varPrefix = `--${namespace.value}-dialog`;
  27772. if (!props.fullscreen) {
  27773. if (props.top) {
  27774. style2[`${varPrefix}-margin-top`] = props.top;
  27775. }
  27776. if (props.width) {
  27777. style2[`${varPrefix}-width`] = addUnit(props.width);
  27778. }
  27779. }
  27780. return style2;
  27781. });
  27782. const overlayDialogStyle = vue.computed(() => {
  27783. if (props.alignCenter) {
  27784. return { display: "flex" };
  27785. }
  27786. return {};
  27787. });
  27788. function afterEnter() {
  27789. emit("opened");
  27790. }
  27791. function afterLeave() {
  27792. emit("closed");
  27793. emit(UPDATE_MODEL_EVENT, false);
  27794. if (props.destroyOnClose) {
  27795. rendered.value = false;
  27796. }
  27797. }
  27798. function beforeLeave() {
  27799. emit("close");
  27800. }
  27801. function open() {
  27802. closeTimer == null ? void 0 : closeTimer();
  27803. openTimer == null ? void 0 : openTimer();
  27804. if (props.openDelay && props.openDelay > 0) {
  27805. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  27806. } else {
  27807. doOpen();
  27808. }
  27809. }
  27810. function close() {
  27811. openTimer == null ? void 0 : openTimer();
  27812. closeTimer == null ? void 0 : closeTimer();
  27813. if (props.closeDelay && props.closeDelay > 0) {
  27814. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  27815. } else {
  27816. doClose();
  27817. }
  27818. }
  27819. function handleClose() {
  27820. function hide(shouldCancel) {
  27821. if (shouldCancel)
  27822. return;
  27823. closed.value = true;
  27824. visible.value = false;
  27825. }
  27826. if (props.beforeClose) {
  27827. props.beforeClose(hide);
  27828. } else {
  27829. close();
  27830. }
  27831. }
  27832. function onModalClick() {
  27833. if (props.closeOnClickModal) {
  27834. handleClose();
  27835. }
  27836. }
  27837. function doOpen() {
  27838. if (!isClient)
  27839. return;
  27840. visible.value = true;
  27841. }
  27842. function doClose() {
  27843. visible.value = false;
  27844. }
  27845. function onOpenAutoFocus() {
  27846. emit("openAutoFocus");
  27847. }
  27848. function onCloseAutoFocus() {
  27849. emit("closeAutoFocus");
  27850. }
  27851. function onFocusoutPrevented(event) {
  27852. var _a;
  27853. if (((_a = event.detail) == null ? void 0 : _a.focusReason) === "pointer") {
  27854. event.preventDefault();
  27855. }
  27856. }
  27857. if (props.lockScroll) {
  27858. useLockscreen(visible);
  27859. }
  27860. function onCloseRequested() {
  27861. if (props.closeOnPressEscape) {
  27862. handleClose();
  27863. }
  27864. }
  27865. vue.watch(() => props.modelValue, (val) => {
  27866. if (val) {
  27867. closed.value = false;
  27868. open();
  27869. rendered.value = true;
  27870. zIndex.value = props.zIndex ? zIndex.value++ : nextZIndex();
  27871. vue.nextTick(() => {
  27872. emit("open");
  27873. if (targetRef.value) {
  27874. targetRef.value.scrollTop = 0;
  27875. }
  27876. });
  27877. } else {
  27878. if (visible.value) {
  27879. close();
  27880. }
  27881. }
  27882. });
  27883. vue.watch(() => props.fullscreen, (val) => {
  27884. if (!targetRef.value)
  27885. return;
  27886. if (val) {
  27887. lastPosition = targetRef.value.style.transform;
  27888. targetRef.value.style.transform = "";
  27889. } else {
  27890. targetRef.value.style.transform = lastPosition;
  27891. }
  27892. });
  27893. vue.onMounted(() => {
  27894. if (props.modelValue) {
  27895. visible.value = true;
  27896. rendered.value = true;
  27897. open();
  27898. }
  27899. });
  27900. return {
  27901. afterEnter,
  27902. afterLeave,
  27903. beforeLeave,
  27904. handleClose,
  27905. onModalClick,
  27906. close,
  27907. doClose,
  27908. onOpenAutoFocus,
  27909. onCloseAutoFocus,
  27910. onCloseRequested,
  27911. onFocusoutPrevented,
  27912. titleId,
  27913. bodyId,
  27914. closed,
  27915. style,
  27916. overlayDialogStyle,
  27917. rendered,
  27918. visible,
  27919. zIndex
  27920. };
  27921. };
  27922. const _hoisted_1$A = ["aria-label", "aria-labelledby", "aria-describedby"];
  27923. const __default__$N = vue.defineComponent({
  27924. name: "ElDialog",
  27925. inheritAttrs: false
  27926. });
  27927. const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
  27928. ...__default__$N,
  27929. props: dialogProps,
  27930. emits: dialogEmits,
  27931. setup(__props, { expose }) {
  27932. const props = __props;
  27933. const slots = vue.useSlots();
  27934. useDeprecated({
  27935. scope: "el-dialog",
  27936. from: "the title slot",
  27937. replacement: "the header slot",
  27938. version: "3.0.0",
  27939. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  27940. }, vue.computed(() => !!slots.title));
  27941. useDeprecated({
  27942. scope: "el-dialog",
  27943. from: "custom-class",
  27944. replacement: "class",
  27945. version: "2.3.0",
  27946. ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
  27947. type: "Attribute"
  27948. }, vue.computed(() => !!props.customClass));
  27949. const ns = useNamespace("dialog");
  27950. const dialogRef = vue.ref();
  27951. const headerRef = vue.ref();
  27952. const dialogContentRef = vue.ref();
  27953. const {
  27954. visible,
  27955. titleId,
  27956. bodyId,
  27957. style,
  27958. overlayDialogStyle,
  27959. rendered,
  27960. zIndex,
  27961. afterEnter,
  27962. afterLeave,
  27963. beforeLeave,
  27964. handleClose,
  27965. onModalClick,
  27966. onOpenAutoFocus,
  27967. onCloseAutoFocus,
  27968. onCloseRequested,
  27969. onFocusoutPrevented
  27970. } = useDialog(props, dialogRef);
  27971. vue.provide(dialogInjectionKey, {
  27972. dialogRef,
  27973. headerRef,
  27974. bodyId,
  27975. ns,
  27976. rendered,
  27977. style
  27978. });
  27979. const overlayEvent = useSameTarget(onModalClick);
  27980. const draggable = vue.computed(() => props.draggable && !props.fullscreen);
  27981. expose({
  27982. visible,
  27983. dialogContentRef
  27984. });
  27985. return (_ctx, _cache) => {
  27986. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  27987. to: "body",
  27988. disabled: !_ctx.appendToBody
  27989. }, [
  27990. vue.createVNode(vue.Transition, {
  27991. name: "dialog-fade",
  27992. onAfterEnter: vue.unref(afterEnter),
  27993. onAfterLeave: vue.unref(afterLeave),
  27994. onBeforeLeave: vue.unref(beforeLeave),
  27995. persisted: ""
  27996. }, {
  27997. default: vue.withCtx(() => [
  27998. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  27999. "custom-mask-event": "",
  28000. mask: _ctx.modal,
  28001. "overlay-class": _ctx.modalClass,
  28002. "z-index": vue.unref(zIndex)
  28003. }, {
  28004. default: vue.withCtx(() => [
  28005. vue.createElementVNode("div", {
  28006. role: "dialog",
  28007. "aria-modal": "true",
  28008. "aria-label": _ctx.title || void 0,
  28009. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  28010. "aria-describedby": vue.unref(bodyId),
  28011. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  28012. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  28013. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(overlayEvent).onClick && vue.unref(overlayEvent).onClick(...args)),
  28014. onMousedown: _cache[1] || (_cache[1] = (...args) => vue.unref(overlayEvent).onMousedown && vue.unref(overlayEvent).onMousedown(...args)),
  28015. onMouseup: _cache[2] || (_cache[2] = (...args) => vue.unref(overlayEvent).onMouseup && vue.unref(overlayEvent).onMouseup(...args))
  28016. }, [
  28017. vue.createVNode(vue.unref(ElFocusTrap), {
  28018. loop: "",
  28019. trapped: vue.unref(visible),
  28020. "focus-start-el": "container",
  28021. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  28022. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  28023. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  28024. onReleaseRequested: vue.unref(onCloseRequested)
  28025. }, {
  28026. default: vue.withCtx(() => [
  28027. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  28028. key: 0,
  28029. ref_key: "dialogContentRef",
  28030. ref: dialogContentRef
  28031. }, _ctx.$attrs, {
  28032. "custom-class": _ctx.customClass,
  28033. center: _ctx.center,
  28034. "align-center": _ctx.alignCenter,
  28035. "close-icon": _ctx.closeIcon,
  28036. draggable: vue.unref(draggable),
  28037. fullscreen: _ctx.fullscreen,
  28038. "show-close": _ctx.showClose,
  28039. title: _ctx.title,
  28040. onClose: vue.unref(handleClose)
  28041. }), vue.createSlots({
  28042. header: vue.withCtx(() => [
  28043. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  28044. key: 0,
  28045. close: vue.unref(handleClose),
  28046. titleId: vue.unref(titleId),
  28047. titleClass: vue.unref(ns).e("title")
  28048. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  28049. ]),
  28050. default: vue.withCtx(() => [
  28051. vue.renderSlot(_ctx.$slots, "default")
  28052. ]),
  28053. _: 2
  28054. }, [
  28055. _ctx.$slots.footer ? {
  28056. name: "footer",
  28057. fn: vue.withCtx(() => [
  28058. vue.renderSlot(_ctx.$slots, "footer")
  28059. ])
  28060. } : void 0
  28061. ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : vue.createCommentVNode("v-if", true)
  28062. ]),
  28063. _: 3
  28064. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  28065. ], 46, _hoisted_1$A)
  28066. ]),
  28067. _: 3
  28068. }, 8, ["mask", "overlay-class", "z-index"]), [
  28069. [vue.vShow, vue.unref(visible)]
  28070. ])
  28071. ]),
  28072. _: 3
  28073. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  28074. ], 8, ["disabled"]);
  28075. };
  28076. }
  28077. });
  28078. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "dialog.vue"]]);
  28079. const ElDialog = withInstall(Dialog);
  28080. const dividerProps = buildProps({
  28081. direction: {
  28082. type: String,
  28083. values: ["horizontal", "vertical"],
  28084. default: "horizontal"
  28085. },
  28086. contentPosition: {
  28087. type: String,
  28088. values: ["left", "center", "right"],
  28089. default: "center"
  28090. },
  28091. borderStyle: {
  28092. type: definePropType(String),
  28093. default: "solid"
  28094. }
  28095. });
  28096. const __default__$M = vue.defineComponent({
  28097. name: "ElDivider"
  28098. });
  28099. const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
  28100. ...__default__$M,
  28101. props: dividerProps,
  28102. setup(__props) {
  28103. const props = __props;
  28104. const ns = useNamespace("divider");
  28105. const dividerStyle = vue.computed(() => {
  28106. return ns.cssVar({
  28107. "border-style": props.borderStyle
  28108. });
  28109. });
  28110. return (_ctx, _cache) => {
  28111. return vue.openBlock(), vue.createElementBlock("div", {
  28112. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  28113. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  28114. role: "separator"
  28115. }, [
  28116. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  28117. key: 0,
  28118. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  28119. }, [
  28120. vue.renderSlot(_ctx.$slots, "default")
  28121. ], 2)) : vue.createCommentVNode("v-if", true)
  28122. ], 6);
  28123. };
  28124. }
  28125. });
  28126. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "divider.vue"]]);
  28127. const ElDivider = withInstall(Divider);
  28128. const drawerProps = buildProps({
  28129. ...dialogProps,
  28130. direction: {
  28131. type: String,
  28132. default: "rtl",
  28133. values: ["ltr", "rtl", "ttb", "btt"]
  28134. },
  28135. size: {
  28136. type: [String, Number],
  28137. default: "30%"
  28138. },
  28139. withHeader: {
  28140. type: Boolean,
  28141. default: true
  28142. },
  28143. modalFade: {
  28144. type: Boolean,
  28145. default: true
  28146. }
  28147. });
  28148. const drawerEmits = dialogEmits;
  28149. const _sfc_main$1a = vue.defineComponent({
  28150. name: "ElDrawer",
  28151. components: {
  28152. ElOverlay,
  28153. ElFocusTrap,
  28154. ElIcon,
  28155. Close: close_default
  28156. },
  28157. inheritAttrs: false,
  28158. props: drawerProps,
  28159. emits: drawerEmits,
  28160. setup(props, { slots }) {
  28161. useDeprecated({
  28162. scope: "el-drawer",
  28163. from: "the title slot",
  28164. replacement: "the header slot",
  28165. version: "3.0.0",
  28166. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  28167. }, vue.computed(() => !!slots.title));
  28168. useDeprecated({
  28169. scope: "el-drawer",
  28170. from: "custom-class",
  28171. replacement: "class",
  28172. version: "2.3.0",
  28173. ref: "https://element-plus.org/en-US/component/drawer.html#attributes",
  28174. type: "Attribute"
  28175. }, vue.computed(() => !!props.customClass));
  28176. const drawerRef = vue.ref();
  28177. const focusStartRef = vue.ref();
  28178. const ns = useNamespace("drawer");
  28179. const { t } = useLocale();
  28180. const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
  28181. const drawerSize = vue.computed(() => addUnit(props.size));
  28182. return {
  28183. ...useDialog(props, drawerRef),
  28184. drawerRef,
  28185. focusStartRef,
  28186. isHorizontal,
  28187. drawerSize,
  28188. ns,
  28189. t
  28190. };
  28191. }
  28192. });
  28193. const _hoisted_1$z = ["aria-label", "aria-labelledby", "aria-describedby"];
  28194. const _hoisted_2$m = ["id"];
  28195. const _hoisted_3$a = ["aria-label"];
  28196. const _hoisted_4$7 = ["id"];
  28197. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  28198. const _component_close = vue.resolveComponent("close");
  28199. const _component_el_icon = vue.resolveComponent("el-icon");
  28200. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  28201. const _component_el_overlay = vue.resolveComponent("el-overlay");
  28202. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  28203. to: "body",
  28204. disabled: !_ctx.appendToBody
  28205. }, [
  28206. vue.createVNode(vue.Transition, {
  28207. name: _ctx.ns.b("fade"),
  28208. onAfterEnter: _ctx.afterEnter,
  28209. onAfterLeave: _ctx.afterLeave,
  28210. onBeforeLeave: _ctx.beforeLeave,
  28211. persisted: ""
  28212. }, {
  28213. default: vue.withCtx(() => [
  28214. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  28215. mask: _ctx.modal,
  28216. "overlay-class": _ctx.modalClass,
  28217. "z-index": _ctx.zIndex,
  28218. onClick: _ctx.onModalClick
  28219. }, {
  28220. default: vue.withCtx(() => [
  28221. vue.createVNode(_component_el_focus_trap, {
  28222. loop: "",
  28223. trapped: _ctx.visible,
  28224. "focus-trap-el": _ctx.drawerRef,
  28225. "focus-start-el": _ctx.focusStartRef,
  28226. onReleaseRequested: _ctx.onCloseRequested
  28227. }, {
  28228. default: vue.withCtx(() => [
  28229. vue.createElementVNode("div", vue.mergeProps({
  28230. ref: "drawerRef",
  28231. "aria-modal": "true",
  28232. "aria-label": _ctx.title || void 0,
  28233. "aria-labelledby": !_ctx.title ? _ctx.titleId : void 0,
  28234. "aria-describedby": _ctx.bodyId
  28235. }, _ctx.$attrs, {
  28236. class: [_ctx.ns.b(), _ctx.direction, _ctx.visible && "open", _ctx.customClass],
  28237. style: _ctx.isHorizontal ? "width: " + _ctx.drawerSize : "height: " + _ctx.drawerSize,
  28238. role: "dialog",
  28239. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  28240. }, ["stop"]))
  28241. }), [
  28242. vue.createElementVNode("span", {
  28243. ref: "focusStartRef",
  28244. class: vue.normalizeClass(_ctx.ns.e("sr-focus")),
  28245. tabindex: "-1"
  28246. }, null, 2),
  28247. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  28248. key: 0,
  28249. class: vue.normalizeClass(_ctx.ns.e("header"))
  28250. }, [
  28251. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  28252. key: 0,
  28253. close: _ctx.handleClose,
  28254. titleId: _ctx.titleId,
  28255. titleClass: _ctx.ns.e("title")
  28256. }, () => [
  28257. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  28258. key: 0,
  28259. id: _ctx.titleId,
  28260. role: "heading",
  28261. class: vue.normalizeClass(_ctx.ns.e("title"))
  28262. }, vue.toDisplayString(_ctx.title), 11, _hoisted_2$m)) : vue.createCommentVNode("v-if", true)
  28263. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  28264. vue.createCommentVNode(" DEPRECATED SLOT ")
  28265. ]),
  28266. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  28267. key: 2,
  28268. "aria-label": _ctx.t("el.drawer.close"),
  28269. class: vue.normalizeClass(_ctx.ns.e("close-btn")),
  28270. type: "button",
  28271. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClose && _ctx.handleClose(...args))
  28272. }, [
  28273. vue.createVNode(_component_el_icon, {
  28274. class: vue.normalizeClass(_ctx.ns.e("close"))
  28275. }, {
  28276. default: vue.withCtx(() => [
  28277. vue.createVNode(_component_close)
  28278. ]),
  28279. _: 1
  28280. }, 8, ["class"])
  28281. ], 10, _hoisted_3$a)) : vue.createCommentVNode("v-if", true)
  28282. ], 2)) : vue.createCommentVNode("v-if", true),
  28283. _ctx.rendered ? (vue.openBlock(), vue.createElementBlock("div", {
  28284. key: 1,
  28285. id: _ctx.bodyId,
  28286. class: vue.normalizeClass(_ctx.ns.e("body"))
  28287. }, [
  28288. vue.renderSlot(_ctx.$slots, "default")
  28289. ], 10, _hoisted_4$7)) : vue.createCommentVNode("v-if", true),
  28290. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  28291. key: 2,
  28292. class: vue.normalizeClass(_ctx.ns.e("footer"))
  28293. }, [
  28294. vue.renderSlot(_ctx.$slots, "footer")
  28295. ], 2)) : vue.createCommentVNode("v-if", true)
  28296. ], 16, _hoisted_1$z)
  28297. ]),
  28298. _: 3
  28299. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  28300. ]),
  28301. _: 3
  28302. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  28303. [vue.vShow, _ctx.visible]
  28304. ])
  28305. ]),
  28306. _: 3
  28307. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  28308. ], 8, ["disabled"]);
  28309. }
  28310. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$o], ["__file", "drawer.vue"]]);
  28311. const ElDrawer = withInstall(Drawer);
  28312. const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
  28313. inheritAttrs: false
  28314. });
  28315. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  28316. return vue.renderSlot(_ctx.$slots, "default");
  28317. }
  28318. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["render", _sfc_render$n], ["__file", "collection.vue"]]);
  28319. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  28320. name: "ElCollectionItem",
  28321. inheritAttrs: false
  28322. });
  28323. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  28324. return vue.renderSlot(_ctx.$slots, "default");
  28325. }
  28326. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["render", _sfc_render$m], ["__file", "collection-item.vue"]]);
  28327. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  28328. const createCollectionWithScope = (name) => {
  28329. const COLLECTION_NAME = `El${name}Collection`;
  28330. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  28331. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  28332. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  28333. const ElCollection = {
  28334. ...Collection,
  28335. name: COLLECTION_NAME,
  28336. setup() {
  28337. const collectionRef = vue.ref(null);
  28338. const itemMap = /* @__PURE__ */ new Map();
  28339. const getItems = () => {
  28340. const collectionEl = vue.unref(collectionRef);
  28341. if (!collectionEl)
  28342. return [];
  28343. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  28344. const items = [...itemMap.values()];
  28345. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  28346. };
  28347. vue.provide(COLLECTION_INJECTION_KEY, {
  28348. itemMap,
  28349. getItems,
  28350. collectionRef
  28351. });
  28352. }
  28353. };
  28354. const ElCollectionItem = {
  28355. ...CollectionItem,
  28356. name: COLLECTION_ITEM_NAME,
  28357. setup(_, { attrs }) {
  28358. const collectionItemRef = vue.ref(null);
  28359. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  28360. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  28361. collectionItemRef
  28362. });
  28363. vue.onMounted(() => {
  28364. const collectionItemEl = vue.unref(collectionItemRef);
  28365. if (collectionItemEl) {
  28366. collectionInjection.itemMap.set(collectionItemEl, {
  28367. ref: collectionItemEl,
  28368. ...attrs
  28369. });
  28370. }
  28371. });
  28372. vue.onBeforeUnmount(() => {
  28373. const collectionItemEl = vue.unref(collectionItemRef);
  28374. collectionInjection.itemMap.delete(collectionItemEl);
  28375. });
  28376. }
  28377. };
  28378. return {
  28379. COLLECTION_INJECTION_KEY,
  28380. COLLECTION_ITEM_INJECTION_KEY,
  28381. ElCollection,
  28382. ElCollectionItem
  28383. };
  28384. };
  28385. const rovingFocusGroupProps = buildProps({
  28386. style: { type: definePropType([String, Array, Object]) },
  28387. currentTabId: {
  28388. type: definePropType(String)
  28389. },
  28390. defaultCurrentTabId: String,
  28391. loop: Boolean,
  28392. dir: {
  28393. type: String,
  28394. values: ["ltr", "rtl"],
  28395. default: "ltr"
  28396. },
  28397. orientation: {
  28398. type: definePropType(String)
  28399. },
  28400. onBlur: Function,
  28401. onFocus: Function,
  28402. onMousedown: Function
  28403. });
  28404. const {
  28405. ElCollection: ElCollection$1,
  28406. ElCollectionItem: ElCollectionItem$1,
  28407. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  28408. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  28409. } = createCollectionWithScope("RovingFocusGroup");
  28410. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  28411. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  28412. const MAP_KEY_TO_FOCUS_INTENT = {
  28413. ArrowLeft: "prev",
  28414. ArrowUp: "prev",
  28415. ArrowRight: "next",
  28416. ArrowDown: "next",
  28417. PageUp: "first",
  28418. Home: "first",
  28419. PageDown: "last",
  28420. End: "last"
  28421. };
  28422. const getDirectionAwareKey = (key, dir) => {
  28423. if (dir !== "rtl")
  28424. return key;
  28425. switch (key) {
  28426. case EVENT_CODE.right:
  28427. return EVENT_CODE.left;
  28428. case EVENT_CODE.left:
  28429. return EVENT_CODE.right;
  28430. default:
  28431. return key;
  28432. }
  28433. };
  28434. const getFocusIntent = (event, orientation, dir) => {
  28435. const key = getDirectionAwareKey(event.key, dir);
  28436. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  28437. return void 0;
  28438. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  28439. return void 0;
  28440. return MAP_KEY_TO_FOCUS_INTENT[key];
  28441. };
  28442. const reorderArray = (array, atIdx) => {
  28443. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  28444. };
  28445. const focusFirst = (elements) => {
  28446. const { activeElement: prevActive } = document;
  28447. for (const element of elements) {
  28448. if (element === prevActive)
  28449. return;
  28450. element.focus();
  28451. if (prevActive !== document.activeElement)
  28452. return;
  28453. }
  28454. };
  28455. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  28456. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  28457. const EVT_OPTS = { bubbles: false, cancelable: true };
  28458. const _sfc_main$17 = vue.defineComponent({
  28459. name: "ElRovingFocusGroupImpl",
  28460. inheritAttrs: false,
  28461. props: rovingFocusGroupProps,
  28462. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  28463. setup(props, { emit }) {
  28464. var _a;
  28465. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  28466. const isBackingOut = vue.ref(false);
  28467. const isClickFocus = vue.ref(false);
  28468. const rovingFocusGroupRef = vue.ref(null);
  28469. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  28470. const rovingFocusGroupRootStyle = vue.computed(() => {
  28471. return [
  28472. {
  28473. outline: "none"
  28474. },
  28475. props.style
  28476. ];
  28477. });
  28478. const onItemFocus = (tabbedId) => {
  28479. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  28480. };
  28481. const onItemShiftTab = () => {
  28482. isBackingOut.value = true;
  28483. };
  28484. const onMousedown = composeEventHandlers((e) => {
  28485. var _a2;
  28486. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  28487. }, () => {
  28488. isClickFocus.value = true;
  28489. });
  28490. const onFocus = composeEventHandlers((e) => {
  28491. var _a2;
  28492. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  28493. }, (e) => {
  28494. const isKeyboardFocus = !vue.unref(isClickFocus);
  28495. const { target, currentTarget } = e;
  28496. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  28497. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  28498. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  28499. if (!entryFocusEvt.defaultPrevented) {
  28500. const items = getItems().filter((item) => item.focusable);
  28501. const activeItem = items.find((item) => item.active);
  28502. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  28503. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  28504. const candidateNodes = candidates.map((item) => item.ref);
  28505. focusFirst(candidateNodes);
  28506. }
  28507. }
  28508. isClickFocus.value = false;
  28509. });
  28510. const onBlur = composeEventHandlers((e) => {
  28511. var _a2;
  28512. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  28513. }, () => {
  28514. isBackingOut.value = false;
  28515. });
  28516. const handleEntryFocus = (...args) => {
  28517. emit("entryFocus", ...args);
  28518. };
  28519. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  28520. currentTabbedId: vue.readonly(currentTabbedId),
  28521. loop: vue.toRef(props, "loop"),
  28522. tabIndex: vue.computed(() => {
  28523. return vue.unref(isBackingOut) ? -1 : 0;
  28524. }),
  28525. rovingFocusGroupRef,
  28526. rovingFocusGroupRootStyle,
  28527. orientation: vue.toRef(props, "orientation"),
  28528. dir: vue.toRef(props, "dir"),
  28529. onItemFocus,
  28530. onItemShiftTab,
  28531. onBlur,
  28532. onFocus,
  28533. onMousedown
  28534. });
  28535. vue.watch(() => props.currentTabId, (val) => {
  28536. currentTabbedId.value = val != null ? val : null;
  28537. });
  28538. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  28539. }
  28540. });
  28541. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  28542. return vue.renderSlot(_ctx.$slots, "default");
  28543. }
  28544. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["render", _sfc_render$l], ["__file", "roving-focus-group-impl.vue"]]);
  28545. const _sfc_main$16 = vue.defineComponent({
  28546. name: "ElRovingFocusGroup",
  28547. components: {
  28548. ElFocusGroupCollection: ElCollection$1,
  28549. ElRovingFocusGroupImpl
  28550. }
  28551. });
  28552. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  28553. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  28554. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  28555. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  28556. default: vue.withCtx(() => [
  28557. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  28558. default: vue.withCtx(() => [
  28559. vue.renderSlot(_ctx.$slots, "default")
  28560. ]),
  28561. _: 3
  28562. }, 16)
  28563. ]),
  28564. _: 3
  28565. });
  28566. }
  28567. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["render", _sfc_render$k], ["__file", "roving-focus-group.vue"]]);
  28568. const _sfc_main$15 = vue.defineComponent({
  28569. components: {
  28570. ElRovingFocusCollectionItem: ElCollectionItem$1
  28571. },
  28572. props: {
  28573. focusable: {
  28574. type: Boolean,
  28575. default: true
  28576. },
  28577. active: {
  28578. type: Boolean,
  28579. default: false
  28580. }
  28581. },
  28582. emits: ["mousedown", "focus", "keydown"],
  28583. setup(props, { emit }) {
  28584. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  28585. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  28586. const id = useId();
  28587. const rovingFocusGroupItemRef = vue.ref(null);
  28588. const handleMousedown = composeEventHandlers((e) => {
  28589. emit("mousedown", e);
  28590. }, (e) => {
  28591. if (!props.focusable) {
  28592. e.preventDefault();
  28593. } else {
  28594. onItemFocus(vue.unref(id));
  28595. }
  28596. });
  28597. const handleFocus = composeEventHandlers((e) => {
  28598. emit("focus", e);
  28599. }, () => {
  28600. onItemFocus(vue.unref(id));
  28601. });
  28602. const handleKeydown = composeEventHandlers((e) => {
  28603. emit("keydown", e);
  28604. }, (e) => {
  28605. const { key, shiftKey, target, currentTarget } = e;
  28606. if (key === EVENT_CODE.tab && shiftKey) {
  28607. onItemShiftTab();
  28608. return;
  28609. }
  28610. if (target !== currentTarget)
  28611. return;
  28612. const focusIntent = getFocusIntent(e);
  28613. if (focusIntent) {
  28614. e.preventDefault();
  28615. const items = getItems().filter((item) => item.focusable);
  28616. let elements = items.map((item) => item.ref);
  28617. switch (focusIntent) {
  28618. case "last": {
  28619. elements.reverse();
  28620. break;
  28621. }
  28622. case "prev":
  28623. case "next": {
  28624. if (focusIntent === "prev") {
  28625. elements.reverse();
  28626. }
  28627. const currentIdx = elements.indexOf(currentTarget);
  28628. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  28629. break;
  28630. }
  28631. }
  28632. vue.nextTick(() => {
  28633. focusFirst(elements);
  28634. });
  28635. }
  28636. });
  28637. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  28638. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  28639. rovingFocusGroupItemRef,
  28640. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  28641. handleMousedown,
  28642. handleFocus,
  28643. handleKeydown
  28644. });
  28645. return {
  28646. id,
  28647. handleKeydown,
  28648. handleFocus,
  28649. handleMousedown
  28650. };
  28651. }
  28652. });
  28653. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  28654. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  28655. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  28656. id: _ctx.id,
  28657. focusable: _ctx.focusable,
  28658. active: _ctx.active
  28659. }, {
  28660. default: vue.withCtx(() => [
  28661. vue.renderSlot(_ctx.$slots, "default")
  28662. ]),
  28663. _: 3
  28664. }, 8, ["id", "focusable", "active"]);
  28665. }
  28666. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["render", _sfc_render$j], ["__file", "roving-focus-item.vue"]]);
  28667. const dropdownProps = buildProps({
  28668. trigger: useTooltipTriggerProps.trigger,
  28669. effect: {
  28670. ...useTooltipContentProps.effect,
  28671. default: "light"
  28672. },
  28673. type: {
  28674. type: definePropType(String)
  28675. },
  28676. placement: {
  28677. type: definePropType(String),
  28678. default: "bottom"
  28679. },
  28680. popperOptions: {
  28681. type: definePropType(Object),
  28682. default: () => ({})
  28683. },
  28684. id: String,
  28685. size: {
  28686. type: String,
  28687. default: ""
  28688. },
  28689. splitButton: Boolean,
  28690. hideOnClick: {
  28691. type: Boolean,
  28692. default: true
  28693. },
  28694. loop: {
  28695. type: Boolean,
  28696. default: true
  28697. },
  28698. showTimeout: {
  28699. type: Number,
  28700. default: 150
  28701. },
  28702. hideTimeout: {
  28703. type: Number,
  28704. default: 150
  28705. },
  28706. tabindex: {
  28707. type: definePropType([Number, String]),
  28708. default: 0
  28709. },
  28710. maxHeight: {
  28711. type: definePropType([Number, String]),
  28712. default: ""
  28713. },
  28714. popperClass: {
  28715. type: String,
  28716. default: ""
  28717. },
  28718. disabled: {
  28719. type: Boolean,
  28720. default: false
  28721. },
  28722. role: {
  28723. type: String,
  28724. default: "menu"
  28725. },
  28726. buttonProps: {
  28727. type: definePropType(Object)
  28728. },
  28729. teleported: useTooltipContentProps.teleported
  28730. });
  28731. const dropdownItemProps = buildProps({
  28732. command: {
  28733. type: [Object, String, Number],
  28734. default: () => ({})
  28735. },
  28736. disabled: Boolean,
  28737. divided: Boolean,
  28738. textValue: String,
  28739. icon: {
  28740. type: iconPropType
  28741. }
  28742. });
  28743. const dropdownMenuProps = buildProps({
  28744. onKeydown: { type: definePropType(Function) }
  28745. });
  28746. const FIRST_KEYS = [
  28747. EVENT_CODE.down,
  28748. EVENT_CODE.pageDown,
  28749. EVENT_CODE.home
  28750. ];
  28751. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  28752. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  28753. const {
  28754. ElCollection,
  28755. ElCollectionItem,
  28756. COLLECTION_INJECTION_KEY,
  28757. COLLECTION_ITEM_INJECTION_KEY
  28758. } = createCollectionWithScope("Dropdown");
  28759. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  28760. const { ButtonGroup: ElButtonGroup } = ElButton;
  28761. const _sfc_main$14 = vue.defineComponent({
  28762. name: "ElDropdown",
  28763. components: {
  28764. ElButton,
  28765. ElButtonGroup,
  28766. ElScrollbar,
  28767. ElDropdownCollection: ElCollection,
  28768. ElTooltip,
  28769. ElRovingFocusGroup,
  28770. ElOnlyChild: OnlyChild,
  28771. ElIcon,
  28772. ArrowDown: arrow_down_default
  28773. },
  28774. props: dropdownProps,
  28775. emits: ["visible-change", "click", "command"],
  28776. setup(props, { emit }) {
  28777. const _instance = vue.getCurrentInstance();
  28778. const ns = useNamespace("dropdown");
  28779. const { t } = useLocale();
  28780. const triggeringElementRef = vue.ref();
  28781. const referenceElementRef = vue.ref();
  28782. const popperRef = vue.ref(null);
  28783. const contentRef = vue.ref(null);
  28784. const scrollbar = vue.ref(null);
  28785. const currentTabId = vue.ref(null);
  28786. const isUsingKeyboard = vue.ref(false);
  28787. const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down];
  28788. const wrapStyle = vue.computed(() => ({
  28789. maxHeight: addUnit(props.maxHeight)
  28790. }));
  28791. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  28792. const defaultTriggerId = useId().value;
  28793. const triggerId = vue.computed(() => {
  28794. return props.id || defaultTriggerId;
  28795. });
  28796. vue.watch([triggeringElementRef, vue.toRef(props, "trigger")], ([triggeringElement, trigger], [prevTriggeringElement]) => {
  28797. var _a, _b, _c;
  28798. const triggerArray = isArray$1(trigger) ? trigger : [trigger];
  28799. if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) {
  28800. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  28801. }
  28802. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  28803. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  28804. }
  28805. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && triggerArray.includes("hover")) {
  28806. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  28807. }
  28808. }, { immediate: true });
  28809. vue.onBeforeUnmount(() => {
  28810. var _a, _b;
  28811. if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) {
  28812. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  28813. }
  28814. });
  28815. function handleClick() {
  28816. handleClose();
  28817. }
  28818. function handleClose() {
  28819. var _a;
  28820. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  28821. }
  28822. function handleOpen() {
  28823. var _a;
  28824. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  28825. }
  28826. const dropdownSize = useFormSize();
  28827. function commandHandler(...args) {
  28828. emit("command", ...args);
  28829. }
  28830. function onAutofocusTriggerEnter() {
  28831. var _a, _b;
  28832. (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus();
  28833. }
  28834. function onItemEnter() {
  28835. }
  28836. function onItemLeave() {
  28837. const contentEl = vue.unref(contentRef);
  28838. contentEl == null ? void 0 : contentEl.focus();
  28839. currentTabId.value = null;
  28840. }
  28841. function handleCurrentTabIdChange(id) {
  28842. currentTabId.value = id;
  28843. }
  28844. function handleEntryFocus(e) {
  28845. if (!isUsingKeyboard.value) {
  28846. e.preventDefault();
  28847. e.stopImmediatePropagation();
  28848. }
  28849. }
  28850. function handleBeforeShowTooltip() {
  28851. emit("visible-change", true);
  28852. }
  28853. function handleShowTooltip(event) {
  28854. if ((event == null ? void 0 : event.type) === "keydown") {
  28855. contentRef.value.focus();
  28856. }
  28857. }
  28858. function handleBeforeHideTooltip() {
  28859. emit("visible-change", false);
  28860. }
  28861. vue.provide(DROPDOWN_INJECTION_KEY, {
  28862. contentRef,
  28863. role: vue.computed(() => props.role),
  28864. triggerId,
  28865. isUsingKeyboard,
  28866. onItemEnter,
  28867. onItemLeave
  28868. });
  28869. vue.provide("elDropdown", {
  28870. instance: _instance,
  28871. dropdownSize,
  28872. handleClick,
  28873. commandHandler,
  28874. trigger: vue.toRef(props, "trigger"),
  28875. hideOnClick: vue.toRef(props, "hideOnClick")
  28876. });
  28877. const onFocusAfterTrapped = (e) => {
  28878. var _a, _b;
  28879. e.preventDefault();
  28880. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  28881. preventScroll: true
  28882. });
  28883. };
  28884. const handlerMainButtonClick = (event) => {
  28885. emit("click", event);
  28886. };
  28887. return {
  28888. t,
  28889. ns,
  28890. scrollbar,
  28891. wrapStyle,
  28892. dropdownTriggerKls,
  28893. dropdownSize,
  28894. triggerId,
  28895. triggerKeys,
  28896. currentTabId,
  28897. handleCurrentTabIdChange,
  28898. handlerMainButtonClick,
  28899. handleEntryFocus,
  28900. handleClose,
  28901. handleOpen,
  28902. handleBeforeShowTooltip,
  28903. handleShowTooltip,
  28904. handleBeforeHideTooltip,
  28905. onFocusAfterTrapped,
  28906. popperRef,
  28907. contentRef,
  28908. triggeringElementRef,
  28909. referenceElementRef
  28910. };
  28911. }
  28912. });
  28913. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  28914. var _a;
  28915. const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection");
  28916. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  28917. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  28918. const _component_el_only_child = vue.resolveComponent("el-only-child");
  28919. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  28920. const _component_el_button = vue.resolveComponent("el-button");
  28921. const _component_arrow_down = vue.resolveComponent("arrow-down");
  28922. const _component_el_icon = vue.resolveComponent("el-icon");
  28923. const _component_el_button_group = vue.resolveComponent("el-button-group");
  28924. return vue.openBlock(), vue.createElementBlock("div", {
  28925. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  28926. }, [
  28927. vue.createVNode(_component_el_tooltip, {
  28928. ref: "popperRef",
  28929. role: _ctx.role,
  28930. effect: _ctx.effect,
  28931. "fallback-placements": ["bottom", "top"],
  28932. "popper-options": _ctx.popperOptions,
  28933. "gpu-acceleration": false,
  28934. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  28935. "manual-mode": true,
  28936. placement: _ctx.placement,
  28937. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  28938. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  28939. trigger: _ctx.trigger,
  28940. "trigger-keys": _ctx.triggerKeys,
  28941. "trigger-target-el": _ctx.contentRef,
  28942. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  28943. "stop-popper-mouse-event": false,
  28944. "virtual-ref": _ctx.triggeringElementRef,
  28945. "virtual-triggering": _ctx.splitButton,
  28946. disabled: _ctx.disabled,
  28947. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  28948. teleported: _ctx.teleported,
  28949. pure: "",
  28950. persistent: "",
  28951. onBeforeShow: _ctx.handleBeforeShowTooltip,
  28952. onShow: _ctx.handleShowTooltip,
  28953. onBeforeHide: _ctx.handleBeforeHideTooltip
  28954. }, vue.createSlots({
  28955. content: vue.withCtx(() => [
  28956. vue.createVNode(_component_el_scrollbar, {
  28957. ref: "scrollbar",
  28958. "wrap-style": _ctx.wrapStyle,
  28959. tag: "div",
  28960. "view-class": _ctx.ns.e("list")
  28961. }, {
  28962. default: vue.withCtx(() => [
  28963. vue.createVNode(_component_el_roving_focus_group, {
  28964. loop: _ctx.loop,
  28965. "current-tab-id": _ctx.currentTabId,
  28966. orientation: "horizontal",
  28967. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  28968. onEntryFocus: _ctx.handleEntryFocus
  28969. }, {
  28970. default: vue.withCtx(() => [
  28971. vue.createVNode(_component_el_dropdown_collection, null, {
  28972. default: vue.withCtx(() => [
  28973. vue.renderSlot(_ctx.$slots, "dropdown")
  28974. ]),
  28975. _: 3
  28976. })
  28977. ]),
  28978. _: 3
  28979. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  28980. ]),
  28981. _: 3
  28982. }, 8, ["wrap-style", "view-class"])
  28983. ]),
  28984. _: 2
  28985. }, [
  28986. !_ctx.splitButton ? {
  28987. name: "default",
  28988. fn: vue.withCtx(() => [
  28989. vue.createVNode(_component_el_only_child, {
  28990. id: _ctx.triggerId,
  28991. ref: "triggeringElementRef",
  28992. role: "button",
  28993. tabindex: _ctx.tabindex
  28994. }, {
  28995. default: vue.withCtx(() => [
  28996. vue.renderSlot(_ctx.$slots, "default")
  28997. ]),
  28998. _: 3
  28999. }, 8, ["id", "tabindex"])
  29000. ])
  29001. } : void 0
  29002. ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "onBeforeShow", "onShow", "onBeforeHide"]),
  29003. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  29004. default: vue.withCtx(() => [
  29005. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  29006. size: _ctx.dropdownSize,
  29007. type: _ctx.type,
  29008. disabled: _ctx.disabled,
  29009. tabindex: _ctx.tabindex,
  29010. onClick: _ctx.handlerMainButtonClick
  29011. }), {
  29012. default: vue.withCtx(() => [
  29013. vue.renderSlot(_ctx.$slots, "default")
  29014. ]),
  29015. _: 3
  29016. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  29017. vue.createVNode(_component_el_button, vue.mergeProps({
  29018. id: _ctx.triggerId,
  29019. ref: "triggeringElementRef"
  29020. }, _ctx.buttonProps, {
  29021. role: "button",
  29022. size: _ctx.dropdownSize,
  29023. type: _ctx.type,
  29024. class: _ctx.ns.e("caret-button"),
  29025. disabled: _ctx.disabled,
  29026. tabindex: _ctx.tabindex,
  29027. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  29028. }), {
  29029. default: vue.withCtx(() => [
  29030. vue.createVNode(_component_el_icon, {
  29031. class: vue.normalizeClass(_ctx.ns.e("icon"))
  29032. }, {
  29033. default: vue.withCtx(() => [
  29034. vue.createVNode(_component_arrow_down)
  29035. ]),
  29036. _: 1
  29037. }, 8, ["class"])
  29038. ]),
  29039. _: 1
  29040. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  29041. ]),
  29042. _: 3
  29043. })) : vue.createCommentVNode("v-if", true)
  29044. ], 2);
  29045. }
  29046. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$i], ["__file", "dropdown.vue"]]);
  29047. const _sfc_main$13 = vue.defineComponent({
  29048. name: "DropdownItemImpl",
  29049. components: {
  29050. ElIcon
  29051. },
  29052. props: dropdownItemProps,
  29053. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  29054. setup(_, { emit }) {
  29055. const ns = useNamespace("dropdown");
  29056. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  29057. const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  29058. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  29059. const {
  29060. rovingFocusGroupItemRef,
  29061. tabIndex,
  29062. handleFocus,
  29063. handleKeydown: handleItemKeydown,
  29064. handleMousedown
  29065. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  29066. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  29067. const role = vue.computed(() => {
  29068. if (menuRole.value === "menu") {
  29069. return "menuitem";
  29070. } else if (menuRole.value === "navigation") {
  29071. return "link";
  29072. }
  29073. return "button";
  29074. });
  29075. const handleKeydown = composeEventHandlers((e) => {
  29076. const { code } = e;
  29077. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  29078. e.preventDefault();
  29079. e.stopImmediatePropagation();
  29080. emit("clickimpl", e);
  29081. return true;
  29082. }
  29083. }, handleItemKeydown);
  29084. return {
  29085. ns,
  29086. itemRef,
  29087. dataset: {
  29088. [COLLECTION_ITEM_SIGN]: ""
  29089. },
  29090. role,
  29091. tabIndex,
  29092. handleFocus,
  29093. handleKeydown,
  29094. handleMousedown
  29095. };
  29096. }
  29097. });
  29098. const _hoisted_1$y = ["aria-disabled", "tabindex", "role"];
  29099. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  29100. const _component_el_icon = vue.resolveComponent("el-icon");
  29101. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  29102. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", vue.mergeProps({
  29103. key: 0,
  29104. role: "separator",
  29105. class: _ctx.ns.bem("menu", "item", "divided")
  29106. }, _ctx.$attrs), null, 16)) : vue.createCommentVNode("v-if", true),
  29107. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  29108. "aria-disabled": _ctx.disabled,
  29109. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  29110. tabindex: _ctx.tabIndex,
  29111. role: _ctx.role,
  29112. onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)),
  29113. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  29114. onKeydown: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  29115. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  29116. onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)),
  29117. onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e))
  29118. }), [
  29119. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  29120. default: vue.withCtx(() => [
  29121. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  29122. ]),
  29123. _: 1
  29124. })) : vue.createCommentVNode("v-if", true),
  29125. vue.renderSlot(_ctx.$slots, "default")
  29126. ], 16, _hoisted_1$y)
  29127. ], 64);
  29128. }
  29129. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$h], ["__file", "dropdown-item-impl.vue"]]);
  29130. const useDropdown = () => {
  29131. const elDropdown = vue.inject("elDropdown", {});
  29132. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  29133. return {
  29134. elDropdown,
  29135. _elDropdownSize
  29136. };
  29137. };
  29138. const _sfc_main$12 = vue.defineComponent({
  29139. name: "ElDropdownItem",
  29140. components: {
  29141. ElDropdownCollectionItem: ElCollectionItem,
  29142. ElRovingFocusItem,
  29143. ElDropdownItemImpl
  29144. },
  29145. inheritAttrs: false,
  29146. props: dropdownItemProps,
  29147. emits: ["pointermove", "pointerleave", "click"],
  29148. setup(props, { emit, attrs }) {
  29149. const { elDropdown } = useDropdown();
  29150. const _instance = vue.getCurrentInstance();
  29151. const itemRef = vue.ref(null);
  29152. const textContent = vue.computed(() => {
  29153. var _a, _b;
  29154. return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  29155. });
  29156. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  29157. const handlePointerMove = composeEventHandlers((e) => {
  29158. emit("pointermove", e);
  29159. return e.defaultPrevented;
  29160. }, whenMouse((e) => {
  29161. if (props.disabled) {
  29162. onItemLeave(e);
  29163. return;
  29164. }
  29165. const target = e.currentTarget;
  29166. if (target === document.activeElement || target.contains(document.activeElement)) {
  29167. return;
  29168. }
  29169. onItemEnter(e);
  29170. if (!e.defaultPrevented) {
  29171. target == null ? void 0 : target.focus();
  29172. }
  29173. }));
  29174. const handlePointerLeave = composeEventHandlers((e) => {
  29175. emit("pointerleave", e);
  29176. return e.defaultPrevented;
  29177. }, whenMouse((e) => {
  29178. onItemLeave(e);
  29179. }));
  29180. const handleClick = composeEventHandlers((e) => {
  29181. if (props.disabled) {
  29182. return;
  29183. }
  29184. emit("click", e);
  29185. return e.type !== "keydown" && e.defaultPrevented;
  29186. }, (e) => {
  29187. var _a, _b, _c;
  29188. if (props.disabled) {
  29189. e.stopImmediatePropagation();
  29190. return;
  29191. }
  29192. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  29193. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  29194. }
  29195. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  29196. });
  29197. const propsAndAttrs = vue.computed(() => {
  29198. return { ...props, ...attrs };
  29199. });
  29200. return {
  29201. handleClick,
  29202. handlePointerMove,
  29203. handlePointerLeave,
  29204. textContent,
  29205. propsAndAttrs
  29206. };
  29207. }
  29208. });
  29209. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  29210. var _a;
  29211. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  29212. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  29213. const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item");
  29214. return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, {
  29215. disabled: _ctx.disabled,
  29216. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  29217. }, {
  29218. default: vue.withCtx(() => [
  29219. vue.createVNode(_component_el_roving_focus_item, {
  29220. focusable: !_ctx.disabled
  29221. }, {
  29222. default: vue.withCtx(() => [
  29223. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  29224. onPointerleave: _ctx.handlePointerLeave,
  29225. onPointermove: _ctx.handlePointerMove,
  29226. onClickimpl: _ctx.handleClick
  29227. }), {
  29228. default: vue.withCtx(() => [
  29229. vue.renderSlot(_ctx.$slots, "default")
  29230. ]),
  29231. _: 3
  29232. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  29233. ]),
  29234. _: 3
  29235. }, 8, ["focusable"])
  29236. ]),
  29237. _: 3
  29238. }, 8, ["disabled", "text-value"]);
  29239. }
  29240. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$g], ["__file", "dropdown-item.vue"]]);
  29241. const _sfc_main$11 = vue.defineComponent({
  29242. name: "ElDropdownMenu",
  29243. props: dropdownMenuProps,
  29244. setup(props) {
  29245. const ns = useNamespace("dropdown");
  29246. const { _elDropdownSize } = useDropdown();
  29247. const size = _elDropdownSize.value;
  29248. const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  29249. const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  29250. const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  29251. const {
  29252. rovingFocusGroupRef,
  29253. rovingFocusGroupRootStyle,
  29254. tabIndex,
  29255. onBlur,
  29256. onFocus,
  29257. onMousedown
  29258. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  29259. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  29260. const dropdownKls = vue.computed(() => {
  29261. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  29262. });
  29263. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  29264. const composedKeydown = composeEventHandlers((e) => {
  29265. var _a;
  29266. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  29267. }, (e) => {
  29268. const { currentTarget, code, target } = e;
  29269. currentTarget.contains(target);
  29270. if (EVENT_CODE.tab === code) {
  29271. e.stopImmediatePropagation();
  29272. }
  29273. e.preventDefault();
  29274. if (target !== vue.unref(contentRef))
  29275. return;
  29276. if (!FIRST_LAST_KEYS.includes(code))
  29277. return;
  29278. const items = getItems().filter((item) => !item.disabled);
  29279. const targets = items.map((item) => item.ref);
  29280. if (LAST_KEYS.includes(code)) {
  29281. targets.reverse();
  29282. }
  29283. focusFirst(targets);
  29284. });
  29285. const handleKeydown = (e) => {
  29286. composedKeydown(e);
  29287. onKeydown(e);
  29288. };
  29289. return {
  29290. size,
  29291. rovingFocusGroupRootStyle,
  29292. tabIndex,
  29293. dropdownKls,
  29294. role,
  29295. triggerId,
  29296. dropdownListWrapperRef,
  29297. handleKeydown,
  29298. onBlur,
  29299. onFocus,
  29300. onMousedown
  29301. };
  29302. }
  29303. });
  29304. const _hoisted_1$x = ["role", "aria-labelledby"];
  29305. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  29306. return vue.openBlock(), vue.createElementBlock("ul", {
  29307. ref: _ctx.dropdownListWrapperRef,
  29308. class: vue.normalizeClass(_ctx.dropdownKls),
  29309. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  29310. tabindex: -1,
  29311. role: _ctx.role,
  29312. "aria-labelledby": _ctx.triggerId,
  29313. onBlur: _cache[0] || (_cache[0] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
  29314. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
  29315. onKeydown: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  29316. onMousedown: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.onMousedown && _ctx.onMousedown(...args), ["self"]))
  29317. }, [
  29318. vue.renderSlot(_ctx.$slots, "default")
  29319. ], 46, _hoisted_1$x);
  29320. }
  29321. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["render", _sfc_render$f], ["__file", "dropdown-menu.vue"]]);
  29322. const ElDropdown = withInstall(Dropdown, {
  29323. DropdownItem,
  29324. DropdownMenu
  29325. });
  29326. const ElDropdownItem = withNoopInstall(DropdownItem);
  29327. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  29328. const _hoisted_1$w = {
  29329. viewBox: "0 0 79 86",
  29330. version: "1.1",
  29331. xmlns: "http://www.w3.org/2000/svg",
  29332. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  29333. };
  29334. const _hoisted_2$l = ["id"];
  29335. const _hoisted_3$9 = ["stop-color"];
  29336. const _hoisted_4$6 = ["stop-color"];
  29337. const _hoisted_5$5 = ["id"];
  29338. const _hoisted_6$1 = ["stop-color"];
  29339. const _hoisted_7 = ["stop-color"];
  29340. const _hoisted_8 = ["id"];
  29341. const _hoisted_9 = {
  29342. id: "Illustrations",
  29343. stroke: "none",
  29344. "stroke-width": "1",
  29345. fill: "none",
  29346. "fill-rule": "evenodd"
  29347. };
  29348. const _hoisted_10 = {
  29349. id: "B-type",
  29350. transform: "translate(-1268.000000, -535.000000)"
  29351. };
  29352. const _hoisted_11 = {
  29353. id: "Group-2",
  29354. transform: "translate(1268.000000, 535.000000)"
  29355. };
  29356. const _hoisted_12 = ["fill"];
  29357. const _hoisted_13 = ["fill"];
  29358. const _hoisted_14 = {
  29359. id: "Group-Copy",
  29360. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  29361. };
  29362. const _hoisted_15 = ["fill"];
  29363. const _hoisted_16 = ["fill"];
  29364. const _hoisted_17 = ["fill"];
  29365. const _hoisted_18 = ["fill"];
  29366. const _hoisted_19 = ["fill"];
  29367. const _hoisted_20 = {
  29368. id: "Rectangle-Copy-17",
  29369. transform: "translate(53.000000, 45.000000)"
  29370. };
  29371. const _hoisted_21 = ["fill", "xlink:href"];
  29372. const _hoisted_22 = ["fill", "mask"];
  29373. const _hoisted_23 = ["fill"];
  29374. const __default__$L = vue.defineComponent({
  29375. name: "ImgEmpty"
  29376. });
  29377. const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
  29378. ...__default__$L,
  29379. setup(__props) {
  29380. const ns = useNamespace("empty");
  29381. const id = useId();
  29382. return (_ctx, _cache) => {
  29383. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$w, [
  29384. vue.createElementVNode("defs", null, [
  29385. vue.createElementVNode("linearGradient", {
  29386. id: `linearGradient-1-${vue.unref(id)}`,
  29387. x1: "38.8503086%",
  29388. y1: "0%",
  29389. x2: "61.1496914%",
  29390. y2: "100%"
  29391. }, [
  29392. vue.createElementVNode("stop", {
  29393. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  29394. offset: "0%"
  29395. }, null, 8, _hoisted_3$9),
  29396. vue.createElementVNode("stop", {
  29397. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-4")})`,
  29398. offset: "100%"
  29399. }, null, 8, _hoisted_4$6)
  29400. ], 8, _hoisted_2$l),
  29401. vue.createElementVNode("linearGradient", {
  29402. id: `linearGradient-2-${vue.unref(id)}`,
  29403. x1: "0%",
  29404. y1: "9.5%",
  29405. x2: "100%",
  29406. y2: "90.5%"
  29407. }, [
  29408. vue.createElementVNode("stop", {
  29409. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  29410. offset: "0%"
  29411. }, null, 8, _hoisted_6$1),
  29412. vue.createElementVNode("stop", {
  29413. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-6")})`,
  29414. offset: "100%"
  29415. }, null, 8, _hoisted_7)
  29416. ], 8, _hoisted_5$5),
  29417. vue.createElementVNode("rect", {
  29418. id: `path-3-${vue.unref(id)}`,
  29419. x: "0",
  29420. y: "0",
  29421. width: "17",
  29422. height: "36"
  29423. }, null, 8, _hoisted_8)
  29424. ]),
  29425. vue.createElementVNode("g", _hoisted_9, [
  29426. vue.createElementVNode("g", _hoisted_10, [
  29427. vue.createElementVNode("g", _hoisted_11, [
  29428. vue.createElementVNode("path", {
  29429. id: "Oval-Copy-2",
  29430. 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",
  29431. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-3")})`
  29432. }, null, 8, _hoisted_12),
  29433. vue.createElementVNode("polygon", {
  29434. id: "Rectangle-Copy-14",
  29435. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  29436. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  29437. points: "13 58 53 58 42 45 2 45"
  29438. }, null, 8, _hoisted_13),
  29439. vue.createElementVNode("g", _hoisted_14, [
  29440. vue.createElementVNode("polygon", {
  29441. id: "Rectangle-Copy-10",
  29442. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  29443. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  29444. points: "2.84078316e-14 3 18 3 23 7 5 7"
  29445. }, null, 8, _hoisted_15),
  29446. vue.createElementVNode("polygon", {
  29447. id: "Rectangle-Copy-11",
  29448. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-5")})`,
  29449. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  29450. }, null, 8, _hoisted_16),
  29451. vue.createElementVNode("rect", {
  29452. id: "Rectangle-Copy-12",
  29453. fill: `url(#linearGradient-1-${vue.unref(id)})`,
  29454. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  29455. x: "38",
  29456. y: "7",
  29457. width: "17",
  29458. height: "36"
  29459. }, null, 8, _hoisted_17),
  29460. vue.createElementVNode("polygon", {
  29461. id: "Rectangle-Copy-13",
  29462. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  29463. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  29464. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  29465. }, null, 8, _hoisted_18)
  29466. ]),
  29467. vue.createElementVNode("rect", {
  29468. id: "Rectangle-Copy-15",
  29469. fill: `url(#linearGradient-2-${vue.unref(id)})`,
  29470. x: "13",
  29471. y: "45",
  29472. width: "40",
  29473. height: "36"
  29474. }, null, 8, _hoisted_19),
  29475. vue.createElementVNode("g", _hoisted_20, [
  29476. vue.createElementVNode("use", {
  29477. id: "Mask",
  29478. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-8")})`,
  29479. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  29480. "xlink:href": `#path-3-${vue.unref(id)}`
  29481. }, null, 8, _hoisted_21),
  29482. vue.createElementVNode("polygon", {
  29483. id: "Rectangle-Copy",
  29484. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-9")})`,
  29485. mask: `url(#mask-4-${vue.unref(id)})`,
  29486. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  29487. points: "7 0 24 0 20 18 7 16.5"
  29488. }, null, 8, _hoisted_22)
  29489. ]),
  29490. vue.createElementVNode("polygon", {
  29491. id: "Rectangle-Copy-18",
  29492. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  29493. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  29494. points: "62 45 79 45 70 58 53 58"
  29495. }, null, 8, _hoisted_23)
  29496. ])
  29497. ])
  29498. ])
  29499. ]);
  29500. };
  29501. }
  29502. });
  29503. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "img-empty.vue"]]);
  29504. const emptyProps = buildProps({
  29505. image: {
  29506. type: String,
  29507. default: ""
  29508. },
  29509. imageSize: Number,
  29510. description: {
  29511. type: String,
  29512. default: ""
  29513. }
  29514. });
  29515. const _hoisted_1$v = ["src"];
  29516. const _hoisted_2$k = { key: 1 };
  29517. const __default__$K = vue.defineComponent({
  29518. name: "ElEmpty"
  29519. });
  29520. const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
  29521. ...__default__$K,
  29522. props: emptyProps,
  29523. setup(__props) {
  29524. const props = __props;
  29525. const { t } = useLocale();
  29526. const ns = useNamespace("empty");
  29527. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  29528. const imageStyle = vue.computed(() => ({
  29529. width: addUnit(props.imageSize)
  29530. }));
  29531. return (_ctx, _cache) => {
  29532. return vue.openBlock(), vue.createElementBlock("div", {
  29533. class: vue.normalizeClass(vue.unref(ns).b())
  29534. }, [
  29535. vue.createElementVNode("div", {
  29536. class: vue.normalizeClass(vue.unref(ns).e("image")),
  29537. style: vue.normalizeStyle(vue.unref(imageStyle))
  29538. }, [
  29539. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  29540. key: 0,
  29541. src: _ctx.image,
  29542. ondragstart: "return false"
  29543. }, null, 8, _hoisted_1$v)) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  29544. vue.createVNode(ImgEmpty)
  29545. ])
  29546. ], 6),
  29547. vue.createElementVNode("div", {
  29548. class: vue.normalizeClass(vue.unref(ns).e("description"))
  29549. }, [
  29550. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", _hoisted_2$k, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  29551. ], 2),
  29552. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  29553. key: 0,
  29554. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  29555. }, [
  29556. vue.renderSlot(_ctx.$slots, "default")
  29557. ], 2)) : vue.createCommentVNode("v-if", true)
  29558. ], 2);
  29559. };
  29560. }
  29561. });
  29562. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "empty.vue"]]);
  29563. const ElEmpty = withInstall(Empty);
  29564. const imageViewerProps = buildProps({
  29565. urlList: {
  29566. type: definePropType(Array),
  29567. default: () => mutable([])
  29568. },
  29569. zIndex: {
  29570. type: Number
  29571. },
  29572. initialIndex: {
  29573. type: Number,
  29574. default: 0
  29575. },
  29576. infinite: {
  29577. type: Boolean,
  29578. default: true
  29579. },
  29580. hideOnClickModal: {
  29581. type: Boolean,
  29582. default: false
  29583. },
  29584. teleported: {
  29585. type: Boolean,
  29586. default: false
  29587. },
  29588. closeOnPressEscape: {
  29589. type: Boolean,
  29590. default: true
  29591. },
  29592. zoomRate: {
  29593. type: Number,
  29594. default: 1.2
  29595. }
  29596. });
  29597. const imageViewerEmits = {
  29598. close: () => true,
  29599. switch: (index) => isNumber$1(index)
  29600. };
  29601. const _hoisted_1$u = ["src"];
  29602. const __default__$J = vue.defineComponent({
  29603. name: "ElImageViewer"
  29604. });
  29605. const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
  29606. ...__default__$J,
  29607. props: imageViewerProps,
  29608. emits: imageViewerEmits,
  29609. setup(__props, { expose, emit }) {
  29610. const props = __props;
  29611. const modes = {
  29612. CONTAIN: {
  29613. name: "contain",
  29614. icon: vue.markRaw(full_screen_default)
  29615. },
  29616. ORIGINAL: {
  29617. name: "original",
  29618. icon: vue.markRaw(scale_to_original_default)
  29619. }
  29620. };
  29621. const { t } = useLocale();
  29622. const ns = useNamespace("image-viewer");
  29623. const { nextZIndex } = useZIndex();
  29624. const wrapper = vue.ref();
  29625. const imgRefs = vue.ref([]);
  29626. const scopeEventListener = vue.effectScope();
  29627. const loading = vue.ref(true);
  29628. const activeIndex = vue.ref(props.initialIndex);
  29629. const mode = vue.shallowRef(modes.CONTAIN);
  29630. const transform = vue.ref({
  29631. scale: 1,
  29632. deg: 0,
  29633. offsetX: 0,
  29634. offsetY: 0,
  29635. enableTransition: false
  29636. });
  29637. const isSingle = vue.computed(() => {
  29638. const { urlList } = props;
  29639. return urlList.length <= 1;
  29640. });
  29641. const isFirst = vue.computed(() => {
  29642. return activeIndex.value === 0;
  29643. });
  29644. const isLast = vue.computed(() => {
  29645. return activeIndex.value === props.urlList.length - 1;
  29646. });
  29647. const currentImg = vue.computed(() => {
  29648. return props.urlList[activeIndex.value];
  29649. });
  29650. const imgStyle = vue.computed(() => {
  29651. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  29652. let translateX = offsetX / scale;
  29653. let translateY = offsetY / scale;
  29654. switch (deg % 360) {
  29655. case 90:
  29656. case -270:
  29657. [translateX, translateY] = [translateY, -translateX];
  29658. break;
  29659. case 180:
  29660. case -180:
  29661. [translateX, translateY] = [-translateX, -translateY];
  29662. break;
  29663. case 270:
  29664. case -90:
  29665. [translateX, translateY] = [-translateY, translateX];
  29666. break;
  29667. }
  29668. const style = {
  29669. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  29670. transition: enableTransition ? "transform .3s" : ""
  29671. };
  29672. if (mode.value.name === modes.CONTAIN.name) {
  29673. style.maxWidth = style.maxHeight = "100%";
  29674. }
  29675. return style;
  29676. });
  29677. const computedZIndex = vue.computed(() => {
  29678. return isNumber$1(props.zIndex) ? props.zIndex : nextZIndex();
  29679. });
  29680. function hide() {
  29681. unregisterEventListener();
  29682. emit("close");
  29683. }
  29684. function registerEventListener() {
  29685. const keydownHandler = throttle((e) => {
  29686. switch (e.code) {
  29687. case EVENT_CODE.esc:
  29688. props.closeOnPressEscape && hide();
  29689. break;
  29690. case EVENT_CODE.space:
  29691. toggleMode();
  29692. break;
  29693. case EVENT_CODE.left:
  29694. prev();
  29695. break;
  29696. case EVENT_CODE.up:
  29697. handleActions("zoomIn");
  29698. break;
  29699. case EVENT_CODE.right:
  29700. next();
  29701. break;
  29702. case EVENT_CODE.down:
  29703. handleActions("zoomOut");
  29704. break;
  29705. }
  29706. });
  29707. const mousewheelHandler = throttle((e) => {
  29708. const delta = e.deltaY || e.deltaX;
  29709. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  29710. zoomRate: props.zoomRate,
  29711. enableTransition: false
  29712. });
  29713. });
  29714. scopeEventListener.run(() => {
  29715. useEventListener(document, "keydown", keydownHandler);
  29716. useEventListener(document, "wheel", mousewheelHandler);
  29717. });
  29718. }
  29719. function unregisterEventListener() {
  29720. scopeEventListener.stop();
  29721. }
  29722. function handleImgLoad() {
  29723. loading.value = false;
  29724. }
  29725. function handleImgError(e) {
  29726. loading.value = false;
  29727. e.target.alt = t("el.image.error");
  29728. }
  29729. function handleMouseDown(e) {
  29730. if (loading.value || e.button !== 0 || !wrapper.value)
  29731. return;
  29732. transform.value.enableTransition = false;
  29733. const { offsetX, offsetY } = transform.value;
  29734. const startX = e.pageX;
  29735. const startY = e.pageY;
  29736. const dragHandler = throttle((ev) => {
  29737. transform.value = {
  29738. ...transform.value,
  29739. offsetX: offsetX + ev.pageX - startX,
  29740. offsetY: offsetY + ev.pageY - startY
  29741. };
  29742. });
  29743. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  29744. useEventListener(document, "mouseup", () => {
  29745. removeMousemove();
  29746. });
  29747. e.preventDefault();
  29748. }
  29749. function reset() {
  29750. transform.value = {
  29751. scale: 1,
  29752. deg: 0,
  29753. offsetX: 0,
  29754. offsetY: 0,
  29755. enableTransition: false
  29756. };
  29757. }
  29758. function toggleMode() {
  29759. if (loading.value)
  29760. return;
  29761. const modeNames = keysOf(modes);
  29762. const modeValues = Object.values(modes);
  29763. const currentMode = mode.value.name;
  29764. const index = modeValues.findIndex((i) => i.name === currentMode);
  29765. const nextIndex = (index + 1) % modeNames.length;
  29766. mode.value = modes[modeNames[nextIndex]];
  29767. reset();
  29768. }
  29769. function setActiveItem(index) {
  29770. const len = props.urlList.length;
  29771. activeIndex.value = (index + len) % len;
  29772. }
  29773. function prev() {
  29774. if (isFirst.value && !props.infinite)
  29775. return;
  29776. setActiveItem(activeIndex.value - 1);
  29777. }
  29778. function next() {
  29779. if (isLast.value && !props.infinite)
  29780. return;
  29781. setActiveItem(activeIndex.value + 1);
  29782. }
  29783. function handleActions(action, options = {}) {
  29784. if (loading.value)
  29785. return;
  29786. const { zoomRate, rotateDeg, enableTransition } = {
  29787. zoomRate: props.zoomRate,
  29788. rotateDeg: 90,
  29789. enableTransition: true,
  29790. ...options
  29791. };
  29792. switch (action) {
  29793. case "zoomOut":
  29794. if (transform.value.scale > 0.2) {
  29795. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  29796. }
  29797. break;
  29798. case "zoomIn":
  29799. if (transform.value.scale < 7) {
  29800. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  29801. }
  29802. break;
  29803. case "clockwise":
  29804. transform.value.deg += rotateDeg;
  29805. break;
  29806. case "anticlockwise":
  29807. transform.value.deg -= rotateDeg;
  29808. break;
  29809. }
  29810. transform.value.enableTransition = enableTransition;
  29811. }
  29812. vue.watch(currentImg, () => {
  29813. vue.nextTick(() => {
  29814. const $img = imgRefs.value[0];
  29815. if (!($img == null ? void 0 : $img.complete)) {
  29816. loading.value = true;
  29817. }
  29818. });
  29819. });
  29820. vue.watch(activeIndex, (val) => {
  29821. reset();
  29822. emit("switch", val);
  29823. });
  29824. vue.onMounted(() => {
  29825. var _a, _b;
  29826. registerEventListener();
  29827. (_b = (_a = wrapper.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  29828. });
  29829. expose({
  29830. setActiveItem
  29831. });
  29832. return (_ctx, _cache) => {
  29833. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  29834. to: "body",
  29835. disabled: !_ctx.teleported
  29836. }, [
  29837. vue.createVNode(vue.Transition, {
  29838. name: "viewer-fade",
  29839. appear: ""
  29840. }, {
  29841. default: vue.withCtx(() => [
  29842. vue.createElementVNode("div", {
  29843. ref_key: "wrapper",
  29844. ref: wrapper,
  29845. tabindex: -1,
  29846. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  29847. style: vue.normalizeStyle({ zIndex: vue.unref(computedZIndex) })
  29848. }, [
  29849. vue.createElementVNode("div", {
  29850. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  29851. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"]))
  29852. }, null, 2),
  29853. vue.createCommentVNode(" CLOSE "),
  29854. vue.createElementVNode("span", {
  29855. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  29856. onClick: hide
  29857. }, [
  29858. vue.createVNode(vue.unref(ElIcon), null, {
  29859. default: vue.withCtx(() => [
  29860. vue.createVNode(vue.unref(close_default))
  29861. ]),
  29862. _: 1
  29863. })
  29864. ], 2),
  29865. vue.createCommentVNode(" ARROW "),
  29866. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  29867. vue.createElementVNode("span", {
  29868. class: vue.normalizeClass([
  29869. vue.unref(ns).e("btn"),
  29870. vue.unref(ns).e("prev"),
  29871. vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isFirst))
  29872. ]),
  29873. onClick: prev
  29874. }, [
  29875. vue.createVNode(vue.unref(ElIcon), null, {
  29876. default: vue.withCtx(() => [
  29877. vue.createVNode(vue.unref(arrow_left_default))
  29878. ]),
  29879. _: 1
  29880. })
  29881. ], 2),
  29882. vue.createElementVNode("span", {
  29883. class: vue.normalizeClass([
  29884. vue.unref(ns).e("btn"),
  29885. vue.unref(ns).e("next"),
  29886. vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isLast))
  29887. ]),
  29888. onClick: next
  29889. }, [
  29890. vue.createVNode(vue.unref(ElIcon), null, {
  29891. default: vue.withCtx(() => [
  29892. vue.createVNode(vue.unref(arrow_right_default))
  29893. ]),
  29894. _: 1
  29895. })
  29896. ], 2)
  29897. ], 64)) : vue.createCommentVNode("v-if", true),
  29898. vue.createCommentVNode(" ACTIONS "),
  29899. vue.createElementVNode("div", {
  29900. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  29901. }, [
  29902. vue.createElementVNode("div", {
  29903. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  29904. }, [
  29905. vue.createVNode(vue.unref(ElIcon), {
  29906. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  29907. }, {
  29908. default: vue.withCtx(() => [
  29909. vue.createVNode(vue.unref(zoom_out_default))
  29910. ]),
  29911. _: 1
  29912. }),
  29913. vue.createVNode(vue.unref(ElIcon), {
  29914. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  29915. }, {
  29916. default: vue.withCtx(() => [
  29917. vue.createVNode(vue.unref(zoom_in_default))
  29918. ]),
  29919. _: 1
  29920. }),
  29921. vue.createElementVNode("i", {
  29922. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  29923. }, null, 2),
  29924. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  29925. default: vue.withCtx(() => [
  29926. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  29927. ]),
  29928. _: 1
  29929. }),
  29930. vue.createElementVNode("i", {
  29931. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  29932. }, null, 2),
  29933. vue.createVNode(vue.unref(ElIcon), {
  29934. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  29935. }, {
  29936. default: vue.withCtx(() => [
  29937. vue.createVNode(vue.unref(refresh_left_default))
  29938. ]),
  29939. _: 1
  29940. }),
  29941. vue.createVNode(vue.unref(ElIcon), {
  29942. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  29943. }, {
  29944. default: vue.withCtx(() => [
  29945. vue.createVNode(vue.unref(refresh_right_default))
  29946. ]),
  29947. _: 1
  29948. })
  29949. ], 2)
  29950. ], 2),
  29951. vue.createCommentVNode(" CANVAS "),
  29952. vue.createElementVNode("div", {
  29953. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  29954. }, [
  29955. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => {
  29956. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", {
  29957. ref_for: true,
  29958. ref: (el) => imgRefs.value[i] = el,
  29959. key: url,
  29960. src: url,
  29961. style: vue.normalizeStyle(vue.unref(imgStyle)),
  29962. class: vue.normalizeClass(vue.unref(ns).e("img")),
  29963. onLoad: handleImgLoad,
  29964. onError: handleImgError,
  29965. onMousedown: handleMouseDown
  29966. }, null, 46, _hoisted_1$u)), [
  29967. [vue.vShow, i === activeIndex.value]
  29968. ]);
  29969. }), 128))
  29970. ], 2),
  29971. vue.renderSlot(_ctx.$slots, "default")
  29972. ], 6)
  29973. ]),
  29974. _: 3
  29975. })
  29976. ], 8, ["disabled"]);
  29977. };
  29978. }
  29979. });
  29980. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__file", "image-viewer.vue"]]);
  29981. const ElImageViewer = withInstall(ImageViewer);
  29982. const imageProps = buildProps({
  29983. hideOnClickModal: {
  29984. type: Boolean,
  29985. default: false
  29986. },
  29987. src: {
  29988. type: String,
  29989. default: ""
  29990. },
  29991. fit: {
  29992. type: String,
  29993. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  29994. default: ""
  29995. },
  29996. loading: {
  29997. type: String,
  29998. values: ["eager", "lazy"]
  29999. },
  30000. lazy: {
  30001. type: Boolean,
  30002. default: false
  30003. },
  30004. scrollContainer: {
  30005. type: definePropType([String, Object])
  30006. },
  30007. previewSrcList: {
  30008. type: definePropType(Array),
  30009. default: () => mutable([])
  30010. },
  30011. previewTeleported: {
  30012. type: Boolean,
  30013. default: false
  30014. },
  30015. zIndex: {
  30016. type: Number
  30017. },
  30018. initialIndex: {
  30019. type: Number,
  30020. default: 0
  30021. },
  30022. infinite: {
  30023. type: Boolean,
  30024. default: true
  30025. },
  30026. closeOnPressEscape: {
  30027. type: Boolean,
  30028. default: true
  30029. },
  30030. zoomRate: {
  30031. type: Number,
  30032. default: 1.2
  30033. }
  30034. });
  30035. const imageEmits = {
  30036. load: (evt) => evt instanceof Event,
  30037. error: (evt) => evt instanceof Event,
  30038. switch: (val) => isNumber$1(val),
  30039. close: () => true,
  30040. show: () => true
  30041. };
  30042. const _hoisted_1$t = ["src", "loading"];
  30043. const _hoisted_2$j = { key: 0 };
  30044. const __default__$I = vue.defineComponent({
  30045. name: "ElImage",
  30046. inheritAttrs: false
  30047. });
  30048. const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
  30049. ...__default__$I,
  30050. props: imageProps,
  30051. emits: imageEmits,
  30052. setup(__props, { emit }) {
  30053. const props = __props;
  30054. let prevOverflow = "";
  30055. const { t } = useLocale();
  30056. const ns = useNamespace("image");
  30057. const rawAttrs = vue.useAttrs();
  30058. const attrs = useAttrs();
  30059. const imageSrc = vue.ref();
  30060. const hasLoadError = vue.ref(false);
  30061. const isLoading = vue.ref(true);
  30062. const showViewer = vue.ref(false);
  30063. const container = vue.ref();
  30064. const _scrollContainer = vue.ref();
  30065. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  30066. let stopScrollListener;
  30067. let stopWheelListener;
  30068. const containerStyle = vue.computed(() => rawAttrs.style);
  30069. const imageStyle = vue.computed(() => {
  30070. const { fit } = props;
  30071. if (isClient && fit) {
  30072. return { objectFit: fit };
  30073. }
  30074. return {};
  30075. });
  30076. const preview = vue.computed(() => {
  30077. const { previewSrcList } = props;
  30078. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  30079. });
  30080. const imageIndex = vue.computed(() => {
  30081. const { previewSrcList, initialIndex } = props;
  30082. let previewIndex = initialIndex;
  30083. if (initialIndex > previewSrcList.length - 1) {
  30084. previewIndex = 0;
  30085. }
  30086. return previewIndex;
  30087. });
  30088. const isManual = vue.computed(() => {
  30089. if (props.loading === "eager")
  30090. return false;
  30091. return !supportLoading && props.loading === "lazy" || props.lazy;
  30092. });
  30093. const loadImage = () => {
  30094. if (!isClient)
  30095. return;
  30096. isLoading.value = true;
  30097. hasLoadError.value = false;
  30098. imageSrc.value = props.src;
  30099. };
  30100. function handleLoad(event) {
  30101. isLoading.value = false;
  30102. hasLoadError.value = false;
  30103. emit("load", event);
  30104. }
  30105. function handleError(event) {
  30106. isLoading.value = false;
  30107. hasLoadError.value = true;
  30108. emit("error", event);
  30109. }
  30110. function handleLazyLoad() {
  30111. if (isInContainer(container.value, _scrollContainer.value)) {
  30112. loadImage();
  30113. removeLazyLoadListener();
  30114. }
  30115. }
  30116. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  30117. async function addLazyLoadListener() {
  30118. var _a;
  30119. if (!isClient)
  30120. return;
  30121. await vue.nextTick();
  30122. const { scrollContainer } = props;
  30123. if (isElement$1(scrollContainer)) {
  30124. _scrollContainer.value = scrollContainer;
  30125. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  30126. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  30127. } else if (container.value) {
  30128. _scrollContainer.value = getScrollContainer(container.value);
  30129. }
  30130. if (_scrollContainer.value) {
  30131. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  30132. setTimeout(() => handleLazyLoad(), 100);
  30133. }
  30134. }
  30135. function removeLazyLoadListener() {
  30136. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  30137. return;
  30138. stopScrollListener == null ? void 0 : stopScrollListener();
  30139. _scrollContainer.value = void 0;
  30140. }
  30141. function wheelHandler(e) {
  30142. if (!e.ctrlKey)
  30143. return;
  30144. if (e.deltaY < 0) {
  30145. e.preventDefault();
  30146. return false;
  30147. } else if (e.deltaY > 0) {
  30148. e.preventDefault();
  30149. return false;
  30150. }
  30151. }
  30152. function clickHandler() {
  30153. if (!preview.value)
  30154. return;
  30155. stopWheelListener = useEventListener("wheel", wheelHandler, {
  30156. passive: false
  30157. });
  30158. prevOverflow = document.body.style.overflow;
  30159. document.body.style.overflow = "hidden";
  30160. showViewer.value = true;
  30161. emit("show");
  30162. }
  30163. function closeViewer() {
  30164. stopWheelListener == null ? void 0 : stopWheelListener();
  30165. document.body.style.overflow = prevOverflow;
  30166. showViewer.value = false;
  30167. emit("close");
  30168. }
  30169. function switchViewer(val) {
  30170. emit("switch", val);
  30171. }
  30172. vue.watch(() => props.src, () => {
  30173. if (isManual.value) {
  30174. isLoading.value = true;
  30175. hasLoadError.value = false;
  30176. removeLazyLoadListener();
  30177. addLazyLoadListener();
  30178. } else {
  30179. loadImage();
  30180. }
  30181. });
  30182. vue.onMounted(() => {
  30183. if (isManual.value) {
  30184. addLazyLoadListener();
  30185. } else {
  30186. loadImage();
  30187. }
  30188. });
  30189. return (_ctx, _cache) => {
  30190. return vue.openBlock(), vue.createElementBlock("div", {
  30191. ref_key: "container",
  30192. ref: container,
  30193. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  30194. style: vue.normalizeStyle(vue.unref(containerStyle))
  30195. }, [
  30196. imageSrc.value !== void 0 && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(attrs), {
  30197. src: imageSrc.value,
  30198. loading: _ctx.loading,
  30199. style: vue.unref(imageStyle),
  30200. class: [
  30201. vue.unref(ns).e("inner"),
  30202. vue.unref(preview) && vue.unref(ns).e("preview"),
  30203. isLoading.value && vue.unref(ns).is("loading")
  30204. ],
  30205. onClick: clickHandler,
  30206. onLoad: handleLoad,
  30207. onError: handleError
  30208. }), null, 16, _hoisted_1$t)) : vue.createCommentVNode("v-if", true),
  30209. isLoading.value || hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("div", {
  30210. key: 1,
  30211. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  30212. }, [
  30213. isLoading.value ? vue.renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  30214. vue.createElementVNode("div", {
  30215. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  30216. }, null, 2)
  30217. ]) : hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  30218. vue.createElementVNode("div", {
  30219. class: vue.normalizeClass(vue.unref(ns).e("error"))
  30220. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  30221. ]) : vue.createCommentVNode("v-if", true)
  30222. ], 2)) : vue.createCommentVNode("v-if", true),
  30223. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  30224. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  30225. key: 0,
  30226. "z-index": _ctx.zIndex,
  30227. "initial-index": vue.unref(imageIndex),
  30228. infinite: _ctx.infinite,
  30229. "zoom-rate": _ctx.zoomRate,
  30230. "url-list": _ctx.previewSrcList,
  30231. "hide-on-click-modal": _ctx.hideOnClickModal,
  30232. teleported: _ctx.previewTeleported,
  30233. "close-on-press-escape": _ctx.closeOnPressEscape,
  30234. onClose: closeViewer,
  30235. onSwitch: switchViewer
  30236. }, {
  30237. default: vue.withCtx(() => [
  30238. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$j, [
  30239. vue.renderSlot(_ctx.$slots, "viewer")
  30240. ])) : vue.createCommentVNode("v-if", true)
  30241. ]),
  30242. _: 3
  30243. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "url-list", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  30244. ], 64)) : vue.createCommentVNode("v-if", true)
  30245. ], 6);
  30246. };
  30247. }
  30248. });
  30249. var Image = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__file", "image.vue"]]);
  30250. const ElImage = withInstall(Image);
  30251. const inputNumberProps = buildProps({
  30252. id: {
  30253. type: String,
  30254. default: void 0
  30255. },
  30256. step: {
  30257. type: Number,
  30258. default: 1
  30259. },
  30260. stepStrictly: Boolean,
  30261. max: {
  30262. type: Number,
  30263. default: Number.POSITIVE_INFINITY
  30264. },
  30265. min: {
  30266. type: Number,
  30267. default: Number.NEGATIVE_INFINITY
  30268. },
  30269. modelValue: Number,
  30270. readonly: Boolean,
  30271. disabled: Boolean,
  30272. size: useSizeProp,
  30273. controls: {
  30274. type: Boolean,
  30275. default: true
  30276. },
  30277. controlsPosition: {
  30278. type: String,
  30279. default: "",
  30280. values: ["", "right"]
  30281. },
  30282. valueOnClear: {
  30283. type: [String, Number, null],
  30284. validator: (val) => val === null || isNumber$1(val) || ["min", "max"].includes(val),
  30285. default: null
  30286. },
  30287. name: String,
  30288. label: String,
  30289. placeholder: String,
  30290. precision: {
  30291. type: Number,
  30292. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  30293. },
  30294. validateEvent: {
  30295. type: Boolean,
  30296. default: true
  30297. }
  30298. });
  30299. const inputNumberEmits = {
  30300. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  30301. blur: (e) => e instanceof FocusEvent,
  30302. focus: (e) => e instanceof FocusEvent,
  30303. [INPUT_EVENT]: (val) => isNumber$1(val) || isNil(val),
  30304. [UPDATE_MODEL_EVENT]: (val) => isNumber$1(val) || isNil(val)
  30305. };
  30306. const _hoisted_1$s = ["aria-label", "onKeydown"];
  30307. const _hoisted_2$i = ["aria-label", "onKeydown"];
  30308. const __default__$H = vue.defineComponent({
  30309. name: "ElInputNumber"
  30310. });
  30311. const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
  30312. ...__default__$H,
  30313. props: inputNumberProps,
  30314. emits: inputNumberEmits,
  30315. setup(__props, { expose, emit }) {
  30316. const props = __props;
  30317. const { t } = useLocale();
  30318. const ns = useNamespace("input-number");
  30319. const input = vue.ref();
  30320. const data = vue.reactive({
  30321. currentValue: props.modelValue,
  30322. userInput: null
  30323. });
  30324. const { formItem } = useFormItem();
  30325. const minDisabled = vue.computed(() => isNumber$1(props.modelValue) && props.modelValue <= props.min);
  30326. const maxDisabled = vue.computed(() => isNumber$1(props.modelValue) && props.modelValue >= props.max);
  30327. const numPrecision = vue.computed(() => {
  30328. const stepPrecision = getPrecision(props.step);
  30329. if (!isUndefined(props.precision)) {
  30330. if (stepPrecision > props.precision) ;
  30331. return props.precision;
  30332. } else {
  30333. return Math.max(getPrecision(props.modelValue), stepPrecision);
  30334. }
  30335. });
  30336. const controlsAtRight = vue.computed(() => {
  30337. return props.controls && props.controlsPosition === "right";
  30338. });
  30339. const inputNumberSize = useFormSize();
  30340. const inputNumberDisabled = useFormDisabled();
  30341. const displayValue = vue.computed(() => {
  30342. if (data.userInput !== null) {
  30343. return data.userInput;
  30344. }
  30345. let currentValue = data.currentValue;
  30346. if (isNil(currentValue))
  30347. return "";
  30348. if (isNumber$1(currentValue)) {
  30349. if (Number.isNaN(currentValue))
  30350. return "";
  30351. if (!isUndefined(props.precision)) {
  30352. currentValue = currentValue.toFixed(props.precision);
  30353. }
  30354. }
  30355. return currentValue;
  30356. });
  30357. const toPrecision = (num, pre) => {
  30358. if (isUndefined(pre))
  30359. pre = numPrecision.value;
  30360. if (pre === 0)
  30361. return Math.round(num);
  30362. let snum = String(num);
  30363. const pointPos = snum.indexOf(".");
  30364. if (pointPos === -1)
  30365. return num;
  30366. const nums = snum.replace(".", "").split("");
  30367. const datum = nums[pointPos + pre];
  30368. if (!datum)
  30369. return num;
  30370. const length = snum.length;
  30371. if (snum.charAt(length - 1) === "5") {
  30372. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  30373. }
  30374. return Number.parseFloat(Number(snum).toFixed(pre));
  30375. };
  30376. const getPrecision = (value) => {
  30377. if (isNil(value))
  30378. return 0;
  30379. const valueString = value.toString();
  30380. const dotPosition = valueString.indexOf(".");
  30381. let precision = 0;
  30382. if (dotPosition !== -1) {
  30383. precision = valueString.length - dotPosition - 1;
  30384. }
  30385. return precision;
  30386. };
  30387. const ensurePrecision = (val, coefficient = 1) => {
  30388. if (!isNumber$1(val))
  30389. return data.currentValue;
  30390. return toPrecision(val + props.step * coefficient);
  30391. };
  30392. const increase = () => {
  30393. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  30394. return;
  30395. const value = Number(displayValue.value) || 0;
  30396. const newVal = ensurePrecision(value);
  30397. setCurrentValue(newVal);
  30398. emit(INPUT_EVENT, data.currentValue);
  30399. };
  30400. const decrease = () => {
  30401. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  30402. return;
  30403. const value = Number(displayValue.value) || 0;
  30404. const newVal = ensurePrecision(value, -1);
  30405. setCurrentValue(newVal);
  30406. emit(INPUT_EVENT, data.currentValue);
  30407. };
  30408. const verifyValue = (value, update) => {
  30409. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  30410. let newVal = Number(value);
  30411. if (isNil(value) || Number.isNaN(newVal)) {
  30412. return null;
  30413. }
  30414. if (value === "") {
  30415. if (valueOnClear === null) {
  30416. return null;
  30417. }
  30418. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  30419. }
  30420. if (stepStrictly) {
  30421. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  30422. }
  30423. if (!isUndefined(precision)) {
  30424. newVal = toPrecision(newVal, precision);
  30425. }
  30426. if (newVal > max || newVal < min) {
  30427. newVal = newVal > max ? max : min;
  30428. update && emit(UPDATE_MODEL_EVENT, newVal);
  30429. }
  30430. return newVal;
  30431. };
  30432. const setCurrentValue = (value, emitChange = true) => {
  30433. var _a;
  30434. const oldVal = data.currentValue;
  30435. const newVal = verifyValue(value);
  30436. if (!emitChange) {
  30437. emit(UPDATE_MODEL_EVENT, newVal);
  30438. return;
  30439. }
  30440. if (oldVal === newVal)
  30441. return;
  30442. data.userInput = null;
  30443. emit(UPDATE_MODEL_EVENT, newVal);
  30444. emit(CHANGE_EVENT, newVal, oldVal);
  30445. if (props.validateEvent) {
  30446. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  30447. }
  30448. data.currentValue = newVal;
  30449. };
  30450. const handleInput = (value) => {
  30451. data.userInput = value;
  30452. const newVal = value === "" ? null : Number(value);
  30453. emit(INPUT_EVENT, newVal);
  30454. setCurrentValue(newVal, false);
  30455. };
  30456. const handleInputChange = (value) => {
  30457. const newVal = value !== "" ? Number(value) : "";
  30458. if (isNumber$1(newVal) && !Number.isNaN(newVal) || value === "") {
  30459. setCurrentValue(newVal);
  30460. }
  30461. data.userInput = null;
  30462. };
  30463. const focus = () => {
  30464. var _a, _b;
  30465. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  30466. };
  30467. const blur = () => {
  30468. var _a, _b;
  30469. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  30470. };
  30471. const handleFocus = (event) => {
  30472. emit("focus", event);
  30473. };
  30474. const handleBlur = (event) => {
  30475. var _a;
  30476. emit("blur", event);
  30477. if (props.validateEvent) {
  30478. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  30479. }
  30480. };
  30481. vue.watch(() => props.modelValue, (value) => {
  30482. const userInput = verifyValue(data.userInput);
  30483. const newValue = verifyValue(value, true);
  30484. if (!isNumber$1(userInput) && (!userInput || userInput !== newValue)) {
  30485. data.currentValue = newValue;
  30486. data.userInput = null;
  30487. }
  30488. }, { immediate: true });
  30489. vue.onMounted(() => {
  30490. var _a;
  30491. const { min, max, modelValue } = props;
  30492. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  30493. innerInput.setAttribute("role", "spinbutton");
  30494. if (Number.isFinite(max)) {
  30495. innerInput.setAttribute("aria-valuemax", String(max));
  30496. } else {
  30497. innerInput.removeAttribute("aria-valuemax");
  30498. }
  30499. if (Number.isFinite(min)) {
  30500. innerInput.setAttribute("aria-valuemin", String(min));
  30501. } else {
  30502. innerInput.removeAttribute("aria-valuemin");
  30503. }
  30504. innerInput.setAttribute("aria-valuenow", String(data.currentValue));
  30505. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  30506. if (!isNumber$1(modelValue) && modelValue != null) {
  30507. let val = Number(modelValue);
  30508. if (Number.isNaN(val)) {
  30509. val = null;
  30510. }
  30511. emit(UPDATE_MODEL_EVENT, val);
  30512. }
  30513. });
  30514. vue.onUpdated(() => {
  30515. var _a;
  30516. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  30517. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`);
  30518. });
  30519. expose({
  30520. focus,
  30521. blur
  30522. });
  30523. return (_ctx, _cache) => {
  30524. return vue.openBlock(), vue.createElementBlock("div", {
  30525. class: vue.normalizeClass([
  30526. vue.unref(ns).b(),
  30527. vue.unref(ns).m(vue.unref(inputNumberSize)),
  30528. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  30529. vue.unref(ns).is("without-controls", !_ctx.controls),
  30530. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight))
  30531. ]),
  30532. onDragstart: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  30533. }, ["prevent"]))
  30534. }, [
  30535. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  30536. key: 0,
  30537. role: "button",
  30538. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  30539. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  30540. onKeydown: vue.withKeys(decrease, ["enter"])
  30541. }, [
  30542. vue.createVNode(vue.unref(ElIcon), null, {
  30543. default: vue.withCtx(() => [
  30544. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  30545. ]),
  30546. _: 1
  30547. })
  30548. ], 42, _hoisted_1$s)), [
  30549. [vue.unref(vRepeatClick), decrease]
  30550. ]) : vue.createCommentVNode("v-if", true),
  30551. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  30552. key: 1,
  30553. role: "button",
  30554. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  30555. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  30556. onKeydown: vue.withKeys(increase, ["enter"])
  30557. }, [
  30558. vue.createVNode(vue.unref(ElIcon), null, {
  30559. default: vue.withCtx(() => [
  30560. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  30561. ]),
  30562. _: 1
  30563. })
  30564. ], 42, _hoisted_2$i)), [
  30565. [vue.unref(vRepeatClick), increase]
  30566. ]) : vue.createCommentVNode("v-if", true),
  30567. vue.createVNode(vue.unref(ElInput), {
  30568. id: _ctx.id,
  30569. ref_key: "input",
  30570. ref: input,
  30571. type: "number",
  30572. step: _ctx.step,
  30573. "model-value": vue.unref(displayValue),
  30574. placeholder: _ctx.placeholder,
  30575. readonly: _ctx.readonly,
  30576. disabled: vue.unref(inputNumberDisabled),
  30577. size: vue.unref(inputNumberSize),
  30578. max: _ctx.max,
  30579. min: _ctx.min,
  30580. name: _ctx.name,
  30581. label: _ctx.label,
  30582. "validate-event": false,
  30583. onWheel: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  30584. }, ["prevent"])),
  30585. onKeydown: [
  30586. vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]),
  30587. vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"])
  30588. ],
  30589. onBlur: handleBlur,
  30590. onFocus: handleFocus,
  30591. onInput: handleInput,
  30592. onChange: handleInputChange
  30593. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
  30594. ], 34);
  30595. };
  30596. }
  30597. });
  30598. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__file", "input-number.vue"]]);
  30599. const ElInputNumber = withInstall(InputNumber);
  30600. const linkProps = buildProps({
  30601. type: {
  30602. type: String,
  30603. values: ["primary", "success", "warning", "info", "danger", "default"],
  30604. default: "default"
  30605. },
  30606. underline: {
  30607. type: Boolean,
  30608. default: true
  30609. },
  30610. disabled: { type: Boolean, default: false },
  30611. href: { type: String, default: "" },
  30612. icon: {
  30613. type: iconPropType
  30614. }
  30615. });
  30616. const linkEmits = {
  30617. click: (evt) => evt instanceof MouseEvent
  30618. };
  30619. const _hoisted_1$r = ["href"];
  30620. const __default__$G = vue.defineComponent({
  30621. name: "ElLink"
  30622. });
  30623. const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
  30624. ...__default__$G,
  30625. props: linkProps,
  30626. emits: linkEmits,
  30627. setup(__props, { emit }) {
  30628. const props = __props;
  30629. const ns = useNamespace("link");
  30630. const linkKls = vue.computed(() => [
  30631. ns.b(),
  30632. ns.m(props.type),
  30633. ns.is("disabled", props.disabled),
  30634. ns.is("underline", props.underline && !props.disabled)
  30635. ]);
  30636. function handleClick(event) {
  30637. if (!props.disabled)
  30638. emit("click", event);
  30639. }
  30640. return (_ctx, _cache) => {
  30641. return vue.openBlock(), vue.createElementBlock("a", {
  30642. class: vue.normalizeClass(vue.unref(linkKls)),
  30643. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  30644. onClick: handleClick
  30645. }, [
  30646. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  30647. default: vue.withCtx(() => [
  30648. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  30649. ]),
  30650. _: 1
  30651. })) : vue.createCommentVNode("v-if", true),
  30652. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  30653. key: 1,
  30654. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  30655. }, [
  30656. vue.renderSlot(_ctx.$slots, "default")
  30657. ], 2)) : vue.createCommentVNode("v-if", true),
  30658. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  30659. ], 10, _hoisted_1$r);
  30660. };
  30661. }
  30662. });
  30663. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "link.vue"]]);
  30664. const ElLink = withInstall(Link);
  30665. class SubMenu$1 {
  30666. constructor(parent, domNode) {
  30667. this.parent = parent;
  30668. this.domNode = domNode;
  30669. this.subIndex = 0;
  30670. this.subIndex = 0;
  30671. this.init();
  30672. }
  30673. init() {
  30674. this.subMenuItems = this.domNode.querySelectorAll("li");
  30675. this.addListeners();
  30676. }
  30677. gotoSubIndex(idx) {
  30678. if (idx === this.subMenuItems.length) {
  30679. idx = 0;
  30680. } else if (idx < 0) {
  30681. idx = this.subMenuItems.length - 1;
  30682. }
  30683. this.subMenuItems[idx].focus();
  30684. this.subIndex = idx;
  30685. }
  30686. addListeners() {
  30687. const parentNode = this.parent.domNode;
  30688. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  30689. el.addEventListener("keydown", (event) => {
  30690. let prevDef = false;
  30691. switch (event.code) {
  30692. case EVENT_CODE.down: {
  30693. this.gotoSubIndex(this.subIndex + 1);
  30694. prevDef = true;
  30695. break;
  30696. }
  30697. case EVENT_CODE.up: {
  30698. this.gotoSubIndex(this.subIndex - 1);
  30699. prevDef = true;
  30700. break;
  30701. }
  30702. case EVENT_CODE.tab: {
  30703. triggerEvent(parentNode, "mouseleave");
  30704. break;
  30705. }
  30706. case EVENT_CODE.enter:
  30707. case EVENT_CODE.space: {
  30708. prevDef = true;
  30709. event.currentTarget.click();
  30710. break;
  30711. }
  30712. }
  30713. if (prevDef) {
  30714. event.preventDefault();
  30715. event.stopPropagation();
  30716. }
  30717. return false;
  30718. });
  30719. });
  30720. }
  30721. }
  30722. var SubMenu$2 = SubMenu$1;
  30723. class MenuItem$1 {
  30724. constructor(domNode, namespace) {
  30725. this.domNode = domNode;
  30726. this.submenu = null;
  30727. this.submenu = null;
  30728. this.init(namespace);
  30729. }
  30730. init(namespace) {
  30731. this.domNode.setAttribute("tabindex", "0");
  30732. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  30733. if (menuChild) {
  30734. this.submenu = new SubMenu$2(this, menuChild);
  30735. }
  30736. this.addListeners();
  30737. }
  30738. addListeners() {
  30739. this.domNode.addEventListener("keydown", (event) => {
  30740. let prevDef = false;
  30741. switch (event.code) {
  30742. case EVENT_CODE.down: {
  30743. triggerEvent(event.currentTarget, "mouseenter");
  30744. this.submenu && this.submenu.gotoSubIndex(0);
  30745. prevDef = true;
  30746. break;
  30747. }
  30748. case EVENT_CODE.up: {
  30749. triggerEvent(event.currentTarget, "mouseenter");
  30750. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  30751. prevDef = true;
  30752. break;
  30753. }
  30754. case EVENT_CODE.tab: {
  30755. triggerEvent(event.currentTarget, "mouseleave");
  30756. break;
  30757. }
  30758. case EVENT_CODE.enter:
  30759. case EVENT_CODE.space: {
  30760. prevDef = true;
  30761. event.currentTarget.click();
  30762. break;
  30763. }
  30764. }
  30765. if (prevDef) {
  30766. event.preventDefault();
  30767. }
  30768. });
  30769. }
  30770. }
  30771. var MenuItem$2 = MenuItem$1;
  30772. class Menu$1 {
  30773. constructor(domNode, namespace) {
  30774. this.domNode = domNode;
  30775. this.init(namespace);
  30776. }
  30777. init(namespace) {
  30778. const menuChildren = this.domNode.childNodes;
  30779. Array.from(menuChildren).forEach((child) => {
  30780. if (child.nodeType === 1) {
  30781. new MenuItem$2(child, namespace);
  30782. }
  30783. });
  30784. }
  30785. }
  30786. var Menubar = Menu$1;
  30787. const _sfc_main$W = vue.defineComponent({
  30788. name: "ElMenuCollapseTransition",
  30789. setup() {
  30790. const ns = useNamespace("menu");
  30791. const listeners = {
  30792. onBeforeEnter: (el) => el.style.opacity = "0.2",
  30793. onEnter(el, done) {
  30794. addClass(el, `${ns.namespace.value}-opacity-transition`);
  30795. el.style.opacity = "1";
  30796. done();
  30797. },
  30798. onAfterEnter(el) {
  30799. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  30800. el.style.opacity = "";
  30801. },
  30802. onBeforeLeave(el) {
  30803. if (!el.dataset) {
  30804. el.dataset = {};
  30805. }
  30806. if (hasClass(el, ns.m("collapse"))) {
  30807. removeClass(el, ns.m("collapse"));
  30808. el.dataset.oldOverflow = el.style.overflow;
  30809. el.dataset.scrollWidth = el.clientWidth.toString();
  30810. addClass(el, ns.m("collapse"));
  30811. } else {
  30812. addClass(el, ns.m("collapse"));
  30813. el.dataset.oldOverflow = el.style.overflow;
  30814. el.dataset.scrollWidth = el.clientWidth.toString();
  30815. removeClass(el, ns.m("collapse"));
  30816. }
  30817. el.style.width = `${el.scrollWidth}px`;
  30818. el.style.overflow = "hidden";
  30819. },
  30820. onLeave(el) {
  30821. addClass(el, "horizontal-collapse-transition");
  30822. el.style.width = `${el.dataset.scrollWidth}px`;
  30823. }
  30824. };
  30825. return {
  30826. listeners
  30827. };
  30828. }
  30829. });
  30830. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  30831. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, _ctx.listeners), {
  30832. default: vue.withCtx(() => [
  30833. vue.renderSlot(_ctx.$slots, "default")
  30834. ]),
  30835. _: 3
  30836. }, 16);
  30837. }
  30838. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]);
  30839. function useMenu(instance, currentIndex) {
  30840. const indexPath = vue.computed(() => {
  30841. let parent = instance.parent;
  30842. const path = [currentIndex.value];
  30843. while (parent.type.name !== "ElMenu") {
  30844. if (parent.props.index) {
  30845. path.unshift(parent.props.index);
  30846. }
  30847. parent = parent.parent;
  30848. }
  30849. return path;
  30850. });
  30851. const parentMenu = vue.computed(() => {
  30852. let parent = instance.parent;
  30853. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  30854. parent = parent.parent;
  30855. }
  30856. return parent;
  30857. });
  30858. return {
  30859. parentMenu,
  30860. indexPath
  30861. };
  30862. }
  30863. function useMenuColor(props) {
  30864. const menuBarColor = vue.computed(() => {
  30865. const color = props.backgroundColor;
  30866. if (!color) {
  30867. return "";
  30868. } else {
  30869. return new TinyColor(color).shade(20).toString();
  30870. }
  30871. });
  30872. return menuBarColor;
  30873. }
  30874. const useMenuCssVar = (props, level) => {
  30875. const ns = useNamespace("menu");
  30876. return vue.computed(() => {
  30877. return ns.cssVarBlock({
  30878. "text-color": props.textColor || "",
  30879. "hover-text-color": props.textColor || "",
  30880. "bg-color": props.backgroundColor || "",
  30881. "hover-bg-color": useMenuColor(props).value || "",
  30882. "active-color": props.activeTextColor || "",
  30883. level: `${level}`
  30884. });
  30885. });
  30886. };
  30887. const subMenuProps = buildProps({
  30888. index: {
  30889. type: String,
  30890. required: true
  30891. },
  30892. showTimeout: {
  30893. type: Number,
  30894. default: 300
  30895. },
  30896. hideTimeout: {
  30897. type: Number,
  30898. default: 300
  30899. },
  30900. popperClass: String,
  30901. disabled: Boolean,
  30902. popperAppendToBody: {
  30903. type: Boolean,
  30904. default: void 0
  30905. },
  30906. teleported: {
  30907. type: Boolean,
  30908. default: void 0
  30909. },
  30910. popperOffset: {
  30911. type: Number,
  30912. default: 6
  30913. },
  30914. expandCloseIcon: {
  30915. type: iconPropType
  30916. },
  30917. expandOpenIcon: {
  30918. type: iconPropType
  30919. },
  30920. collapseCloseIcon: {
  30921. type: iconPropType
  30922. },
  30923. collapseOpenIcon: {
  30924. type: iconPropType
  30925. }
  30926. });
  30927. const COMPONENT_NAME$c = "ElSubMenu";
  30928. var SubMenu = vue.defineComponent({
  30929. name: COMPONENT_NAME$c,
  30930. props: subMenuProps,
  30931. setup(props, { slots, expose }) {
  30932. useDeprecated({
  30933. from: "popper-append-to-body",
  30934. replacement: "teleported",
  30935. scope: COMPONENT_NAME$c,
  30936. version: "2.3.0",
  30937. ref: "https://element-plus.org/en-US/component/menu.html#submenu-attributes"
  30938. }, vue.computed(() => props.popperAppendToBody !== void 0));
  30939. const instance = vue.getCurrentInstance();
  30940. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  30941. const nsMenu = useNamespace("menu");
  30942. const nsSubMenu = useNamespace("sub-menu");
  30943. const rootMenu = vue.inject("rootMenu");
  30944. if (!rootMenu)
  30945. throwError(COMPONENT_NAME$c, "can not inject root menu");
  30946. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  30947. if (!subMenu)
  30948. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  30949. const items = vue.ref({});
  30950. const subMenus = vue.ref({});
  30951. let timeout;
  30952. const mouseInChild = vue.ref(false);
  30953. const verticalTitleRef = vue.ref();
  30954. const vPopper = vue.ref(null);
  30955. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  30956. const subMenuTitleIcon = vue.computed(() => {
  30957. return mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse ? props.expandCloseIcon && props.expandOpenIcon ? opened.value ? props.expandOpenIcon : props.expandCloseIcon : arrow_down_default : props.collapseCloseIcon && props.collapseOpenIcon ? opened.value ? props.collapseOpenIcon : props.collapseCloseIcon : arrow_right_default;
  30958. });
  30959. const isFirstLevel = vue.computed(() => {
  30960. return subMenu.level === 0;
  30961. });
  30962. const appendToBody = vue.computed(() => {
  30963. var _a;
  30964. const value = (_a = props.teleported) != null ? _a : props.popperAppendToBody;
  30965. return value === void 0 ? isFirstLevel.value : value;
  30966. });
  30967. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  30968. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  30969. "bottom-start",
  30970. "bottom-end",
  30971. "top-start",
  30972. "top-end",
  30973. "right-start",
  30974. "left-start"
  30975. ] : [
  30976. "right-start",
  30977. "left-start",
  30978. "bottom-start",
  30979. "bottom-end",
  30980. "top-start",
  30981. "top-end"
  30982. ]);
  30983. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  30984. const active = vue.computed(() => {
  30985. let isActive = false;
  30986. Object.values(items.value).forEach((item2) => {
  30987. if (item2.active) {
  30988. isActive = true;
  30989. }
  30990. });
  30991. Object.values(subMenus.value).forEach((subItem) => {
  30992. if (subItem.active) {
  30993. isActive = true;
  30994. }
  30995. });
  30996. return isActive;
  30997. });
  30998. const backgroundColor = vue.computed(() => rootMenu.props.backgroundColor || "");
  30999. const activeTextColor = vue.computed(() => rootMenu.props.activeTextColor || "");
  31000. const textColor = vue.computed(() => rootMenu.props.textColor || "");
  31001. const mode = vue.computed(() => rootMenu.props.mode);
  31002. const item = vue.reactive({
  31003. index: props.index,
  31004. indexPath,
  31005. active
  31006. });
  31007. const titleStyle = vue.computed(() => {
  31008. if (mode.value !== "horizontal") {
  31009. return {
  31010. color: textColor.value
  31011. };
  31012. }
  31013. return {
  31014. borderBottomColor: active.value ? rootMenu.props.activeTextColor ? activeTextColor.value : "" : "transparent",
  31015. color: active.value ? activeTextColor.value : textColor.value
  31016. };
  31017. });
  31018. const doDestroy = () => {
  31019. var _a, _b, _c;
  31020. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  31021. };
  31022. const handleCollapseToggle = (value) => {
  31023. if (!value) {
  31024. doDestroy();
  31025. }
  31026. };
  31027. const handleClick = () => {
  31028. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  31029. return;
  31030. rootMenu.handleSubMenuClick({
  31031. index: props.index,
  31032. indexPath: indexPath.value,
  31033. active: active.value
  31034. });
  31035. };
  31036. const handleMouseenter = (event, showTimeout = props.showTimeout) => {
  31037. var _a;
  31038. if (event.type === "focus") {
  31039. return;
  31040. }
  31041. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  31042. return;
  31043. }
  31044. subMenu.mouseInChild.value = true;
  31045. timeout == null ? void 0 : timeout();
  31046. ({ stop: timeout } = useTimeoutFn(() => {
  31047. rootMenu.openMenu(props.index, indexPath.value);
  31048. }, showTimeout));
  31049. if (appendToBody.value) {
  31050. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  31051. }
  31052. };
  31053. const handleMouseleave = (deepDispatch = false) => {
  31054. var _a, _b;
  31055. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  31056. return;
  31057. }
  31058. timeout == null ? void 0 : timeout();
  31059. subMenu.mouseInChild.value = false;
  31060. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), props.hideTimeout));
  31061. if (appendToBody.value && deepDispatch) {
  31062. if (((_a = instance.parent) == null ? void 0 : _a.type.name) === "ElSubMenu") {
  31063. (_b = subMenu.handleMouseleave) == null ? void 0 : _b.call(subMenu, true);
  31064. }
  31065. }
  31066. };
  31067. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  31068. {
  31069. const addSubMenu = (item2) => {
  31070. subMenus.value[item2.index] = item2;
  31071. };
  31072. const removeSubMenu = (item2) => {
  31073. delete subMenus.value[item2.index];
  31074. };
  31075. vue.provide(`subMenu:${instance.uid}`, {
  31076. addSubMenu,
  31077. removeSubMenu,
  31078. handleMouseleave,
  31079. mouseInChild,
  31080. level: subMenu.level + 1
  31081. });
  31082. }
  31083. expose({
  31084. opened
  31085. });
  31086. vue.onMounted(() => {
  31087. rootMenu.addSubMenu(item);
  31088. subMenu.addSubMenu(item);
  31089. });
  31090. vue.onBeforeUnmount(() => {
  31091. subMenu.removeSubMenu(item);
  31092. rootMenu.removeSubMenu(item);
  31093. });
  31094. return () => {
  31095. var _a;
  31096. const titleTag = [
  31097. (_a = slots.title) == null ? void 0 : _a.call(slots),
  31098. vue.h(ElIcon, {
  31099. class: nsSubMenu.e("icon-arrow"),
  31100. style: {
  31101. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  31102. }
  31103. }, {
  31104. default: () => isString$1(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  31105. })
  31106. ];
  31107. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  31108. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  31109. ref: vPopper,
  31110. visible: opened.value,
  31111. effect: "light",
  31112. pure: true,
  31113. offset: props.popperOffset,
  31114. showArrow: false,
  31115. persistent: true,
  31116. popperClass: props.popperClass,
  31117. placement: currentPlacement.value,
  31118. teleported: appendToBody.value,
  31119. fallbackPlacements: fallbackPlacements.value,
  31120. transition: menuTransitionName.value,
  31121. gpuAcceleration: false
  31122. }, {
  31123. content: () => {
  31124. var _a2;
  31125. return vue.h("div", {
  31126. class: [
  31127. nsMenu.m(mode.value),
  31128. nsMenu.m("popup-container"),
  31129. props.popperClass
  31130. ],
  31131. onMouseenter: (evt) => handleMouseenter(evt, 100),
  31132. onMouseleave: () => handleMouseleave(true),
  31133. onFocus: (evt) => handleMouseenter(evt, 100)
  31134. }, [
  31135. vue.h("ul", {
  31136. class: [
  31137. nsMenu.b(),
  31138. nsMenu.m("popup"),
  31139. nsMenu.m(`popup-${currentPlacement.value}`)
  31140. ],
  31141. style: ulStyle.value
  31142. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  31143. ]);
  31144. },
  31145. default: () => vue.h("div", {
  31146. class: nsSubMenu.e("title"),
  31147. style: [
  31148. titleStyle.value,
  31149. { backgroundColor: backgroundColor.value }
  31150. ],
  31151. onClick: handleClick
  31152. }, titleTag)
  31153. }) : vue.h(vue.Fragment, {}, [
  31154. vue.h("div", {
  31155. class: nsSubMenu.e("title"),
  31156. style: [
  31157. titleStyle.value,
  31158. { backgroundColor: backgroundColor.value }
  31159. ],
  31160. ref: verticalTitleRef,
  31161. onClick: handleClick
  31162. }, titleTag),
  31163. vue.h(_CollapseTransition, {}, {
  31164. default: () => {
  31165. var _a2;
  31166. return vue.withDirectives(vue.h("ul", {
  31167. role: "menu",
  31168. class: [nsMenu.b(), nsMenu.m("inline")],
  31169. style: ulStyle.value
  31170. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  31171. }
  31172. })
  31173. ]);
  31174. return vue.h("li", {
  31175. class: [
  31176. nsSubMenu.b(),
  31177. nsSubMenu.is("active", active.value),
  31178. nsSubMenu.is("opened", opened.value),
  31179. nsSubMenu.is("disabled", props.disabled)
  31180. ],
  31181. role: "menuitem",
  31182. ariaHaspopup: true,
  31183. ariaExpanded: opened.value,
  31184. onMouseenter: handleMouseenter,
  31185. onMouseleave: () => handleMouseleave(true),
  31186. onFocus: handleMouseenter
  31187. }, [child]);
  31188. };
  31189. }
  31190. });
  31191. const menuProps = buildProps({
  31192. mode: {
  31193. type: String,
  31194. values: ["horizontal", "vertical"],
  31195. default: "vertical"
  31196. },
  31197. defaultActive: {
  31198. type: String,
  31199. default: ""
  31200. },
  31201. defaultOpeneds: {
  31202. type: definePropType(Array),
  31203. default: () => mutable([])
  31204. },
  31205. uniqueOpened: Boolean,
  31206. router: Boolean,
  31207. menuTrigger: {
  31208. type: String,
  31209. values: ["hover", "click"],
  31210. default: "hover"
  31211. },
  31212. collapse: Boolean,
  31213. backgroundColor: String,
  31214. textColor: String,
  31215. activeTextColor: String,
  31216. collapseTransition: {
  31217. type: Boolean,
  31218. default: true
  31219. },
  31220. ellipsis: {
  31221. type: Boolean,
  31222. default: true
  31223. },
  31224. popperEffect: {
  31225. type: String,
  31226. values: ["dark", "light"],
  31227. default: "dark"
  31228. }
  31229. });
  31230. const checkIndexPath = (indexPath) => Array.isArray(indexPath) && indexPath.every((path) => isString$1(path));
  31231. const menuEmits = {
  31232. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  31233. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  31234. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  31235. };
  31236. var Menu = vue.defineComponent({
  31237. name: "ElMenu",
  31238. props: menuProps,
  31239. emits: menuEmits,
  31240. setup(props, { emit, slots, expose }) {
  31241. const instance = vue.getCurrentInstance();
  31242. const router = instance.appContext.config.globalProperties.$router;
  31243. const menu = vue.ref();
  31244. const nsMenu = useNamespace("menu");
  31245. const nsSubMenu = useNamespace("sub-menu");
  31246. const sliceIndex = vue.ref(-1);
  31247. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  31248. const activeIndex = vue.ref(props.defaultActive);
  31249. const items = vue.ref({});
  31250. const subMenus = vue.ref({});
  31251. const isMenuPopup = vue.computed(() => {
  31252. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  31253. });
  31254. const initMenu = () => {
  31255. const activeItem = activeIndex.value && items.value[activeIndex.value];
  31256. if (!activeItem || props.mode === "horizontal" || props.collapse)
  31257. return;
  31258. const indexPath = activeItem.indexPath;
  31259. indexPath.forEach((index) => {
  31260. const subMenu = subMenus.value[index];
  31261. subMenu && openMenu(index, subMenu.indexPath);
  31262. });
  31263. };
  31264. const openMenu = (index, indexPath) => {
  31265. if (openedMenus.value.includes(index))
  31266. return;
  31267. if (props.uniqueOpened) {
  31268. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  31269. }
  31270. openedMenus.value.push(index);
  31271. emit("open", index, indexPath);
  31272. };
  31273. const close = (index) => {
  31274. const i = openedMenus.value.indexOf(index);
  31275. if (i !== -1) {
  31276. openedMenus.value.splice(i, 1);
  31277. }
  31278. };
  31279. const closeMenu = (index, indexPath) => {
  31280. close(index);
  31281. emit("close", index, indexPath);
  31282. };
  31283. const handleSubMenuClick = ({
  31284. index,
  31285. indexPath
  31286. }) => {
  31287. const isOpened = openedMenus.value.includes(index);
  31288. if (isOpened) {
  31289. closeMenu(index, indexPath);
  31290. } else {
  31291. openMenu(index, indexPath);
  31292. }
  31293. };
  31294. const handleMenuItemClick = (menuItem) => {
  31295. if (props.mode === "horizontal" || props.collapse) {
  31296. openedMenus.value = [];
  31297. }
  31298. const { index, indexPath } = menuItem;
  31299. if (isNil(index) || isNil(indexPath))
  31300. return;
  31301. if (props.router && router) {
  31302. const route = menuItem.route || index;
  31303. const routerResult = router.push(route).then((res) => {
  31304. if (!res)
  31305. activeIndex.value = index;
  31306. return res;
  31307. });
  31308. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  31309. } else {
  31310. activeIndex.value = index;
  31311. emit("select", index, indexPath, { index, indexPath });
  31312. }
  31313. };
  31314. const updateActiveIndex = (val) => {
  31315. const itemsInData = items.value;
  31316. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  31317. if (item) {
  31318. activeIndex.value = item.index;
  31319. } else {
  31320. activeIndex.value = val;
  31321. }
  31322. };
  31323. const calcSliceIndex = () => {
  31324. var _a, _b;
  31325. if (!menu.value)
  31326. return -1;
  31327. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#text" || item.nodeValue);
  31328. const moreItemWidth = 64;
  31329. const paddingLeft = Number.parseInt(getComputedStyle(menu.value).paddingLeft, 10);
  31330. const paddingRight = Number.parseInt(getComputedStyle(menu.value).paddingRight, 10);
  31331. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  31332. let calcWidth = 0;
  31333. let sliceIndex2 = 0;
  31334. items2.forEach((item, index) => {
  31335. calcWidth += item.offsetWidth || 0;
  31336. if (calcWidth <= menuWidth - moreItemWidth) {
  31337. sliceIndex2 = index + 1;
  31338. }
  31339. });
  31340. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  31341. };
  31342. const debounce = (fn, wait = 33.34) => {
  31343. let timmer;
  31344. return () => {
  31345. timmer && clearTimeout(timmer);
  31346. timmer = setTimeout(() => {
  31347. fn();
  31348. }, wait);
  31349. };
  31350. };
  31351. let isFirstTimeRender = true;
  31352. const handleResize = () => {
  31353. const callback = () => {
  31354. sliceIndex.value = -1;
  31355. vue.nextTick(() => {
  31356. sliceIndex.value = calcSliceIndex();
  31357. });
  31358. };
  31359. isFirstTimeRender ? callback() : debounce(callback)();
  31360. isFirstTimeRender = false;
  31361. };
  31362. vue.watch(() => props.defaultActive, (currentActive) => {
  31363. if (!items.value[currentActive]) {
  31364. activeIndex.value = "";
  31365. }
  31366. updateActiveIndex(currentActive);
  31367. });
  31368. vue.watch(() => props.collapse, (value) => {
  31369. if (value)
  31370. openedMenus.value = [];
  31371. });
  31372. vue.watch(items.value, initMenu);
  31373. let resizeStopper;
  31374. vue.watchEffect(() => {
  31375. if (props.mode === "horizontal" && props.ellipsis)
  31376. resizeStopper = useResizeObserver(menu, handleResize).stop;
  31377. else
  31378. resizeStopper == null ? void 0 : resizeStopper();
  31379. });
  31380. {
  31381. const addSubMenu = (item) => {
  31382. subMenus.value[item.index] = item;
  31383. };
  31384. const removeSubMenu = (item) => {
  31385. delete subMenus.value[item.index];
  31386. };
  31387. const addMenuItem = (item) => {
  31388. items.value[item.index] = item;
  31389. };
  31390. const removeMenuItem = (item) => {
  31391. delete items.value[item.index];
  31392. };
  31393. vue.provide("rootMenu", vue.reactive({
  31394. props,
  31395. openedMenus,
  31396. items,
  31397. subMenus,
  31398. activeIndex,
  31399. isMenuPopup,
  31400. addMenuItem,
  31401. removeMenuItem,
  31402. addSubMenu,
  31403. removeSubMenu,
  31404. openMenu,
  31405. closeMenu,
  31406. handleMenuItemClick,
  31407. handleSubMenuClick
  31408. }));
  31409. vue.provide(`subMenu:${instance.uid}`, {
  31410. addSubMenu,
  31411. removeSubMenu,
  31412. mouseInChild: vue.ref(false),
  31413. level: 0
  31414. });
  31415. }
  31416. vue.onMounted(() => {
  31417. if (props.mode === "horizontal") {
  31418. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  31419. }
  31420. });
  31421. {
  31422. const open = (index) => {
  31423. const { indexPath } = subMenus.value[index];
  31424. indexPath.forEach((i) => openMenu(i, indexPath));
  31425. };
  31426. expose({
  31427. open,
  31428. close,
  31429. handleResize
  31430. });
  31431. }
  31432. return () => {
  31433. var _a, _b;
  31434. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  31435. const vShowMore = [];
  31436. if (props.mode === "horizontal" && menu.value) {
  31437. const originalSlot = flattedChildren(slot);
  31438. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  31439. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  31440. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  31441. slot = slotDefault;
  31442. vShowMore.push(vue.h(SubMenu, {
  31443. index: "sub-menu-more",
  31444. class: nsSubMenu.e("hide-arrow")
  31445. }, {
  31446. title: () => vue.h(ElIcon, {
  31447. class: nsSubMenu.e("icon-more")
  31448. }, { default: () => vue.h(more_default) }),
  31449. default: () => slotMore
  31450. }));
  31451. }
  31452. }
  31453. const ulStyle = useMenuCssVar(props, 0);
  31454. const vMenu = vue.h("ul", {
  31455. key: String(props.collapse),
  31456. role: "menubar",
  31457. ref: menu,
  31458. style: ulStyle.value,
  31459. class: {
  31460. [nsMenu.b()]: true,
  31461. [nsMenu.m(props.mode)]: true,
  31462. [nsMenu.m("collapse")]: props.collapse
  31463. }
  31464. }, [...slot, ...vShowMore]);
  31465. if (props.collapseTransition && props.mode === "vertical") {
  31466. return vue.h(ElMenuCollapseTransition, () => vMenu);
  31467. }
  31468. return vMenu;
  31469. };
  31470. }
  31471. });
  31472. const menuItemProps = buildProps({
  31473. index: {
  31474. type: definePropType([String, null]),
  31475. default: null
  31476. },
  31477. route: {
  31478. type: definePropType([String, Object])
  31479. },
  31480. disabled: Boolean
  31481. });
  31482. const menuItemEmits = {
  31483. click: (item) => isString$1(item.index) && Array.isArray(item.indexPath)
  31484. };
  31485. const COMPONENT_NAME$b = "ElMenuItem";
  31486. const _sfc_main$V = vue.defineComponent({
  31487. name: COMPONENT_NAME$b,
  31488. components: {
  31489. ElTooltip
  31490. },
  31491. props: menuItemProps,
  31492. emits: menuItemEmits,
  31493. setup(props, { emit }) {
  31494. const instance = vue.getCurrentInstance();
  31495. const rootMenu = vue.inject("rootMenu");
  31496. const nsMenu = useNamespace("menu");
  31497. const nsMenuItem = useNamespace("menu-item");
  31498. if (!rootMenu)
  31499. throwError(COMPONENT_NAME$b, "can not inject root menu");
  31500. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  31501. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  31502. if (!subMenu)
  31503. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  31504. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  31505. const item = vue.reactive({
  31506. index: props.index,
  31507. indexPath,
  31508. active
  31509. });
  31510. const handleClick = () => {
  31511. if (!props.disabled) {
  31512. rootMenu.handleMenuItemClick({
  31513. index: props.index,
  31514. indexPath: indexPath.value,
  31515. route: props.route
  31516. });
  31517. emit("click", item);
  31518. }
  31519. };
  31520. vue.onMounted(() => {
  31521. subMenu.addSubMenu(item);
  31522. rootMenu.addMenuItem(item);
  31523. });
  31524. vue.onBeforeUnmount(() => {
  31525. subMenu.removeSubMenu(item);
  31526. rootMenu.removeMenuItem(item);
  31527. });
  31528. return {
  31529. parentMenu,
  31530. rootMenu,
  31531. active,
  31532. nsMenu,
  31533. nsMenuItem,
  31534. handleClick
  31535. };
  31536. }
  31537. });
  31538. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  31539. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  31540. return vue.openBlock(), vue.createElementBlock("li", {
  31541. class: vue.normalizeClass([
  31542. _ctx.nsMenuItem.b(),
  31543. _ctx.nsMenuItem.is("active", _ctx.active),
  31544. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  31545. ]),
  31546. role: "menuitem",
  31547. tabindex: "-1",
  31548. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  31549. }, [
  31550. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  31551. key: 0,
  31552. effect: _ctx.rootMenu.props.popperEffect,
  31553. placement: "right",
  31554. "fallback-placements": ["left"],
  31555. persistent: ""
  31556. }, {
  31557. content: vue.withCtx(() => [
  31558. vue.renderSlot(_ctx.$slots, "title")
  31559. ]),
  31560. default: vue.withCtx(() => [
  31561. vue.createElementVNode("div", {
  31562. class: vue.normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  31563. }, [
  31564. vue.renderSlot(_ctx.$slots, "default")
  31565. ], 2)
  31566. ]),
  31567. _: 3
  31568. }, 8, ["effect"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  31569. vue.renderSlot(_ctx.$slots, "default"),
  31570. vue.renderSlot(_ctx.$slots, "title")
  31571. ], 64))
  31572. ], 2);
  31573. }
  31574. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]);
  31575. const menuItemGroupProps = {
  31576. title: String
  31577. };
  31578. const COMPONENT_NAME$a = "ElMenuItemGroup";
  31579. const _sfc_main$U = vue.defineComponent({
  31580. name: COMPONENT_NAME$a,
  31581. props: menuItemGroupProps,
  31582. setup() {
  31583. const ns = useNamespace("menu-item-group");
  31584. return {
  31585. ns
  31586. };
  31587. }
  31588. });
  31589. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  31590. return vue.openBlock(), vue.createElementBlock("li", {
  31591. class: vue.normalizeClass(_ctx.ns.b())
  31592. }, [
  31593. vue.createElementVNode("div", {
  31594. class: vue.normalizeClass(_ctx.ns.e("title"))
  31595. }, [
  31596. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31597. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  31598. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  31599. ], 2),
  31600. vue.createElementVNode("ul", null, [
  31601. vue.renderSlot(_ctx.$slots, "default")
  31602. ])
  31603. ], 2);
  31604. }
  31605. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]);
  31606. const ElMenu = withInstall(Menu, {
  31607. MenuItem,
  31608. MenuItemGroup,
  31609. SubMenu
  31610. });
  31611. const ElMenuItem = withNoopInstall(MenuItem);
  31612. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  31613. const ElSubMenu = withNoopInstall(SubMenu);
  31614. const pageHeaderProps = buildProps({
  31615. icon: {
  31616. type: iconPropType,
  31617. default: () => back_default
  31618. },
  31619. title: String,
  31620. content: {
  31621. type: String,
  31622. default: ""
  31623. }
  31624. });
  31625. const pageHeaderEmits = {
  31626. back: () => true
  31627. };
  31628. const _hoisted_1$q = ["aria-label"];
  31629. const __default__$F = vue.defineComponent({
  31630. name: "ElPageHeader"
  31631. });
  31632. const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
  31633. ...__default__$F,
  31634. props: pageHeaderProps,
  31635. emits: pageHeaderEmits,
  31636. setup(__props, { emit }) {
  31637. const slots = vue.useSlots();
  31638. const { t } = useLocale();
  31639. const ns = useNamespace("page-header");
  31640. const kls = vue.computed(() => {
  31641. return [
  31642. ns.b(),
  31643. {
  31644. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  31645. [ns.m("has-extra")]: !!slots.extra,
  31646. [ns.is("contentful")]: !!slots.default
  31647. }
  31648. ];
  31649. });
  31650. function handleClick() {
  31651. emit("back");
  31652. }
  31653. return (_ctx, _cache) => {
  31654. return vue.openBlock(), vue.createElementBlock("div", {
  31655. class: vue.normalizeClass(vue.unref(kls))
  31656. }, [
  31657. _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", {
  31658. key: 0,
  31659. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  31660. }, [
  31661. vue.renderSlot(_ctx.$slots, "breadcrumb")
  31662. ], 2)) : vue.createCommentVNode("v-if", true),
  31663. vue.createElementVNode("div", {
  31664. class: vue.normalizeClass(vue.unref(ns).e("header"))
  31665. }, [
  31666. vue.createElementVNode("div", {
  31667. class: vue.normalizeClass(vue.unref(ns).e("left"))
  31668. }, [
  31669. vue.createElementVNode("div", {
  31670. class: vue.normalizeClass(vue.unref(ns).e("back")),
  31671. role: "button",
  31672. tabindex: "0",
  31673. onClick: handleClick
  31674. }, [
  31675. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  31676. key: 0,
  31677. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  31678. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  31679. }, [
  31680. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  31681. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  31682. default: vue.withCtx(() => [
  31683. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  31684. ]),
  31685. _: 1
  31686. })) : vue.createCommentVNode("v-if", true)
  31687. ])
  31688. ], 10, _hoisted_1$q)) : vue.createCommentVNode("v-if", true),
  31689. vue.createElementVNode("div", {
  31690. class: vue.normalizeClass(vue.unref(ns).e("title"))
  31691. }, [
  31692. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  31693. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  31694. ])
  31695. ], 2)
  31696. ], 2),
  31697. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  31698. vue.createElementVNode("div", {
  31699. class: vue.normalizeClass(vue.unref(ns).e("content"))
  31700. }, [
  31701. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  31702. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  31703. ])
  31704. ], 2)
  31705. ], 2),
  31706. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  31707. key: 0,
  31708. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  31709. }, [
  31710. vue.renderSlot(_ctx.$slots, "extra")
  31711. ], 2)) : vue.createCommentVNode("v-if", true)
  31712. ], 2),
  31713. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  31714. key: 1,
  31715. class: vue.normalizeClass(vue.unref(ns).e("main"))
  31716. }, [
  31717. vue.renderSlot(_ctx.$slots, "default")
  31718. ], 2)) : vue.createCommentVNode("v-if", true)
  31719. ], 2);
  31720. };
  31721. }
  31722. });
  31723. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "page-header.vue"]]);
  31724. const ElPageHeader = withInstall(PageHeader);
  31725. const elPaginationKey = Symbol("elPaginationKey");
  31726. const paginationPrevProps = buildProps({
  31727. disabled: Boolean,
  31728. currentPage: {
  31729. type: Number,
  31730. default: 1
  31731. },
  31732. prevText: {
  31733. type: String
  31734. },
  31735. prevIcon: {
  31736. type: iconPropType
  31737. }
  31738. });
  31739. const paginationPrevEmits = {
  31740. click: (evt) => evt instanceof MouseEvent
  31741. };
  31742. const _hoisted_1$p = ["disabled", "aria-label", "aria-disabled"];
  31743. const _hoisted_2$h = { key: 0 };
  31744. const __default__$E = vue.defineComponent({
  31745. name: "ElPaginationPrev"
  31746. });
  31747. const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
  31748. ...__default__$E,
  31749. props: paginationPrevProps,
  31750. emits: paginationPrevEmits,
  31751. setup(__props) {
  31752. const props = __props;
  31753. const { t } = useLocale();
  31754. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  31755. return (_ctx, _cache) => {
  31756. return vue.openBlock(), vue.createElementBlock("button", {
  31757. type: "button",
  31758. class: "btn-prev",
  31759. disabled: vue.unref(internalDisabled),
  31760. "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
  31761. "aria-disabled": vue.unref(internalDisabled),
  31762. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  31763. }, [
  31764. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$h, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  31765. default: vue.withCtx(() => [
  31766. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  31767. ]),
  31768. _: 1
  31769. }))
  31770. ], 8, _hoisted_1$p);
  31771. };
  31772. }
  31773. });
  31774. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "prev.vue"]]);
  31775. const paginationNextProps = buildProps({
  31776. disabled: Boolean,
  31777. currentPage: {
  31778. type: Number,
  31779. default: 1
  31780. },
  31781. pageCount: {
  31782. type: Number,
  31783. default: 50
  31784. },
  31785. nextText: {
  31786. type: String
  31787. },
  31788. nextIcon: {
  31789. type: iconPropType
  31790. }
  31791. });
  31792. const _hoisted_1$o = ["disabled", "aria-label", "aria-disabled"];
  31793. const _hoisted_2$g = { key: 0 };
  31794. const __default__$D = vue.defineComponent({
  31795. name: "ElPaginationNext"
  31796. });
  31797. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  31798. ...__default__$D,
  31799. props: paginationNextProps,
  31800. emits: ["click"],
  31801. setup(__props) {
  31802. const props = __props;
  31803. const { t } = useLocale();
  31804. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  31805. return (_ctx, _cache) => {
  31806. return vue.openBlock(), vue.createElementBlock("button", {
  31807. type: "button",
  31808. class: "btn-next",
  31809. disabled: vue.unref(internalDisabled),
  31810. "aria-label": _ctx.nextText || vue.unref(t)("el.pagination.next"),
  31811. "aria-disabled": vue.unref(internalDisabled),
  31812. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  31813. }, [
  31814. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$g, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  31815. default: vue.withCtx(() => [
  31816. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  31817. ]),
  31818. _: 1
  31819. }))
  31820. ], 8, _hoisted_1$o);
  31821. };
  31822. }
  31823. });
  31824. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "next.vue"]]);
  31825. const selectGroupKey = Symbol("ElSelectGroup");
  31826. const selectKey = Symbol("ElSelect");
  31827. function useOption$1(props, states) {
  31828. const select = vue.inject(selectKey);
  31829. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  31830. const isObject = vue.computed(() => {
  31831. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  31832. });
  31833. const itemSelected = vue.computed(() => {
  31834. if (!select.props.multiple) {
  31835. return isEqual(props.value, select.props.modelValue);
  31836. } else {
  31837. return contains(select.props.modelValue, props.value);
  31838. }
  31839. });
  31840. const limitReached = vue.computed(() => {
  31841. if (select.props.multiple) {
  31842. const modelValue = select.props.modelValue || [];
  31843. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  31844. } else {
  31845. return false;
  31846. }
  31847. });
  31848. const currentLabel = vue.computed(() => {
  31849. return props.label || (isObject.value ? "" : props.value);
  31850. });
  31851. const currentValue = vue.computed(() => {
  31852. return props.value || props.label || "";
  31853. });
  31854. const isDisabled = vue.computed(() => {
  31855. return props.disabled || states.groupDisabled || limitReached.value;
  31856. });
  31857. const instance = vue.getCurrentInstance();
  31858. const contains = (arr = [], target) => {
  31859. if (!isObject.value) {
  31860. return arr && arr.includes(target);
  31861. } else {
  31862. const valueKey = select.props.valueKey;
  31863. return arr && arr.some((item) => {
  31864. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  31865. });
  31866. }
  31867. };
  31868. const isEqual = (a, b) => {
  31869. if (!isObject.value) {
  31870. return a === b;
  31871. } else {
  31872. const { valueKey } = select.props;
  31873. return get(a, valueKey) === get(b, valueKey);
  31874. }
  31875. };
  31876. const hoverItem = () => {
  31877. if (!props.disabled && !selectGroup.disabled) {
  31878. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  31879. }
  31880. };
  31881. vue.watch(() => currentLabel.value, () => {
  31882. if (!props.created && !select.props.remote)
  31883. select.setSelected();
  31884. });
  31885. vue.watch(() => props.value, (val, oldVal) => {
  31886. const { remote, valueKey } = select.props;
  31887. if (!Object.is(val, oldVal)) {
  31888. select.onOptionDestroy(oldVal, instance.proxy);
  31889. select.onOptionCreate(instance.proxy);
  31890. }
  31891. if (!props.created && !remote) {
  31892. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  31893. return;
  31894. }
  31895. select.setSelected();
  31896. }
  31897. });
  31898. vue.watch(() => selectGroup.disabled, () => {
  31899. states.groupDisabled = selectGroup.disabled;
  31900. }, { immediate: true });
  31901. const { queryChange } = vue.toRaw(select);
  31902. vue.watch(queryChange, (changes) => {
  31903. const { query } = vue.unref(changes);
  31904. const regexp = new RegExp(escapeStringRegexp(query), "i");
  31905. states.visible = regexp.test(currentLabel.value) || props.created;
  31906. if (!states.visible) {
  31907. select.filteredOptionsCount--;
  31908. }
  31909. }, { immediate: true });
  31910. return {
  31911. select,
  31912. currentLabel,
  31913. currentValue,
  31914. itemSelected,
  31915. isDisabled,
  31916. hoverItem
  31917. };
  31918. }
  31919. const _sfc_main$Q = vue.defineComponent({
  31920. name: "ElOption",
  31921. componentName: "ElOption",
  31922. props: {
  31923. value: {
  31924. required: true,
  31925. type: [String, Number, Boolean, Object]
  31926. },
  31927. label: [String, Number],
  31928. created: Boolean,
  31929. disabled: {
  31930. type: Boolean,
  31931. default: false
  31932. }
  31933. },
  31934. setup(props) {
  31935. const ns = useNamespace("select");
  31936. const states = vue.reactive({
  31937. index: -1,
  31938. groupDisabled: false,
  31939. visible: true,
  31940. hitState: false,
  31941. hover: false
  31942. });
  31943. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption$1(props, states);
  31944. const { visible, hover } = vue.toRefs(states);
  31945. const vm = vue.getCurrentInstance().proxy;
  31946. select.onOptionCreate(vm);
  31947. vue.onBeforeUnmount(() => {
  31948. const key = vm.value;
  31949. const { selected } = select;
  31950. const selectedOptions = select.props.multiple ? selected : [selected];
  31951. const doesSelected = selectedOptions.some((item) => {
  31952. return item.value === vm.value;
  31953. });
  31954. vue.nextTick(() => {
  31955. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  31956. select.cachedOptions.delete(key);
  31957. }
  31958. });
  31959. select.onOptionDestroy(key, vm);
  31960. });
  31961. function selectOptionClick() {
  31962. if (props.disabled !== true && states.groupDisabled !== true) {
  31963. select.handleOptionSelect(vm, true);
  31964. }
  31965. }
  31966. return {
  31967. ns,
  31968. currentLabel,
  31969. itemSelected,
  31970. isDisabled,
  31971. select,
  31972. hoverItem,
  31973. visible,
  31974. hover,
  31975. selectOptionClick,
  31976. states
  31977. };
  31978. }
  31979. });
  31980. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  31981. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  31982. class: vue.normalizeClass([
  31983. _ctx.ns.be("dropdown", "item"),
  31984. _ctx.ns.is("disabled", _ctx.isDisabled),
  31985. {
  31986. selected: _ctx.itemSelected,
  31987. hover: _ctx.hover
  31988. }
  31989. ]),
  31990. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  31991. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  31992. }, [
  31993. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  31994. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  31995. ])
  31996. ], 34)), [
  31997. [vue.vShow, _ctx.visible]
  31998. ]);
  31999. }
  32000. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  32001. const _sfc_main$P = vue.defineComponent({
  32002. name: "ElSelectDropdown",
  32003. componentName: "ElSelectDropdown",
  32004. setup() {
  32005. const select = vue.inject(selectKey);
  32006. const ns = useNamespace("select");
  32007. const popperClass = vue.computed(() => select.props.popperClass);
  32008. const isMultiple = vue.computed(() => select.props.multiple);
  32009. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  32010. const minWidth = vue.ref("");
  32011. function updateMinWidth() {
  32012. var _a;
  32013. minWidth.value = `${(_a = select.selectWrapper) == null ? void 0 : _a.offsetWidth}px`;
  32014. }
  32015. vue.onMounted(() => {
  32016. updateMinWidth();
  32017. useResizeObserver(select.selectWrapper, updateMinWidth);
  32018. });
  32019. return {
  32020. ns,
  32021. minWidth,
  32022. popperClass,
  32023. isMultiple,
  32024. isFitInputWidth
  32025. };
  32026. }
  32027. });
  32028. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  32029. return vue.openBlock(), vue.createElementBlock("div", {
  32030. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  32031. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  32032. }, [
  32033. vue.renderSlot(_ctx.$slots, "default")
  32034. ], 6);
  32035. }
  32036. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  32037. function useSelectStates(props) {
  32038. const { t } = useLocale();
  32039. return vue.reactive({
  32040. options: /* @__PURE__ */ new Map(),
  32041. cachedOptions: /* @__PURE__ */ new Map(),
  32042. createdLabel: null,
  32043. createdSelected: false,
  32044. selected: props.multiple ? [] : {},
  32045. inputLength: 20,
  32046. inputWidth: 0,
  32047. optionsCount: 0,
  32048. filteredOptionsCount: 0,
  32049. visible: false,
  32050. softFocus: false,
  32051. selectedLabel: "",
  32052. hoverIndex: -1,
  32053. query: "",
  32054. previousQuery: null,
  32055. inputHovering: false,
  32056. cachedPlaceHolder: "",
  32057. currentPlaceholder: t("el.select.placeholder"),
  32058. menuVisibleOnFocus: false,
  32059. isOnComposition: false,
  32060. isSilentBlur: false,
  32061. prefixWidth: 11,
  32062. tagInMultiLine: false,
  32063. mouseEnter: false
  32064. });
  32065. }
  32066. const useSelect$3 = (props, states, ctx) => {
  32067. const { t } = useLocale();
  32068. const ns = useNamespace("select");
  32069. useDeprecated({
  32070. from: "suffixTransition",
  32071. replacement: "override style scheme",
  32072. version: "2.3.0",
  32073. scope: "props",
  32074. ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
  32075. }, vue.computed(() => props.suffixTransition === false));
  32076. const reference = vue.ref(null);
  32077. const input = vue.ref(null);
  32078. const iOSInput = vue.ref(null);
  32079. const tooltipRef = vue.ref(null);
  32080. const tags = vue.ref(null);
  32081. const selectWrapper = vue.ref(null);
  32082. const scrollbar = vue.ref(null);
  32083. const hoverOption = vue.ref(-1);
  32084. const queryChange = vue.shallowRef({ query: "" });
  32085. const groupQueryChange = vue.shallowRef("");
  32086. const optionList = vue.ref([]);
  32087. let originClientHeight = 0;
  32088. const { form, formItem } = useFormItem();
  32089. const readonly = vue.computed(() => !props.filterable || props.multiple || !states.visible);
  32090. const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  32091. const showClose = vue.computed(() => {
  32092. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  32093. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  32094. return criteria;
  32095. });
  32096. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  32097. const iconReverse = vue.computed(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
  32098. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  32099. const emptyText = vue.computed(() => {
  32100. if (props.loading) {
  32101. return props.loadingText || t("el.select.loading");
  32102. } else {
  32103. if (props.remote && states.query === "" && states.options.size === 0)
  32104. return false;
  32105. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  32106. return props.noMatchText || t("el.select.noMatch");
  32107. }
  32108. if (states.options.size === 0) {
  32109. return props.noDataText || t("el.select.noData");
  32110. }
  32111. }
  32112. return null;
  32113. });
  32114. const optionsArray = vue.computed(() => {
  32115. const list = Array.from(states.options.values());
  32116. const newList = [];
  32117. optionList.value.forEach((item) => {
  32118. const index = list.findIndex((i) => i.currentLabel === item);
  32119. if (index > -1) {
  32120. newList.push(list[index]);
  32121. }
  32122. });
  32123. return newList.length ? newList : list;
  32124. });
  32125. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  32126. const showNewOption = vue.computed(() => {
  32127. const hasExistingOption = optionsArray.value.filter((option) => {
  32128. return !option.created;
  32129. }).some((option) => {
  32130. return option.currentLabel === states.query;
  32131. });
  32132. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  32133. });
  32134. const selectSize = useFormSize();
  32135. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  32136. const dropMenuVisible = vue.computed({
  32137. get() {
  32138. return states.visible && emptyText.value !== false;
  32139. },
  32140. set(val) {
  32141. states.visible = val;
  32142. }
  32143. });
  32144. vue.watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
  32145. vue.nextTick(() => {
  32146. resetInputHeight();
  32147. });
  32148. });
  32149. vue.watch(() => props.placeholder, (val) => {
  32150. states.cachedPlaceHolder = states.currentPlaceholder = val;
  32151. });
  32152. vue.watch(() => props.modelValue, (val, oldVal) => {
  32153. if (props.multiple) {
  32154. resetInputHeight();
  32155. if (val && val.length > 0 || input.value && states.query !== "") {
  32156. states.currentPlaceholder = "";
  32157. } else {
  32158. states.currentPlaceholder = states.cachedPlaceHolder;
  32159. }
  32160. if (props.filterable && !props.reserveKeyword) {
  32161. states.query = "";
  32162. handleQueryChange(states.query);
  32163. }
  32164. }
  32165. setSelected();
  32166. if (props.filterable && !props.multiple) {
  32167. states.inputLength = 20;
  32168. }
  32169. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  32170. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  32171. }
  32172. }, {
  32173. flush: "post",
  32174. deep: true
  32175. });
  32176. vue.watch(() => states.visible, (val) => {
  32177. var _a, _b, _c, _d, _e;
  32178. if (!val) {
  32179. if (props.filterable) {
  32180. if (isFunction$1(props.filterMethod)) {
  32181. props.filterMethod("");
  32182. }
  32183. if (isFunction$1(props.remoteMethod)) {
  32184. props.remoteMethod("");
  32185. }
  32186. }
  32187. input.value && input.value.blur();
  32188. states.query = "";
  32189. states.previousQuery = null;
  32190. states.selectedLabel = "";
  32191. states.inputLength = 20;
  32192. states.menuVisibleOnFocus = false;
  32193. resetHoverIndex();
  32194. vue.nextTick(() => {
  32195. if (input.value && input.value.value === "" && states.selected.length === 0) {
  32196. states.currentPlaceholder = states.cachedPlaceHolder;
  32197. }
  32198. });
  32199. if (!props.multiple) {
  32200. if (states.selected) {
  32201. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  32202. states.selectedLabel = states.createdLabel;
  32203. } else {
  32204. states.selectedLabel = states.selected.currentLabel;
  32205. }
  32206. if (props.filterable)
  32207. states.query = states.selectedLabel;
  32208. }
  32209. if (props.filterable) {
  32210. states.currentPlaceholder = states.cachedPlaceHolder;
  32211. }
  32212. }
  32213. } else {
  32214. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  32215. if (props.filterable) {
  32216. states.filteredOptionsCount = states.optionsCount;
  32217. states.query = props.remote ? "" : states.selectedLabel;
  32218. (_d = (_c = iOSInput.value) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c);
  32219. if (props.multiple) {
  32220. (_e = input.value) == null ? void 0 : _e.focus();
  32221. } else {
  32222. if (states.selectedLabel) {
  32223. states.currentPlaceholder = `${states.selectedLabel}`;
  32224. states.selectedLabel = "";
  32225. }
  32226. }
  32227. handleQueryChange(states.query);
  32228. if (!props.multiple && !props.remote) {
  32229. queryChange.value.query = "";
  32230. vue.triggerRef(queryChange);
  32231. vue.triggerRef(groupQueryChange);
  32232. }
  32233. }
  32234. }
  32235. ctx.emit("visible-change", val);
  32236. });
  32237. vue.watch(() => states.options.entries(), () => {
  32238. var _a, _b, _c;
  32239. if (!isClient)
  32240. return;
  32241. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  32242. if (props.multiple) {
  32243. resetInputHeight();
  32244. }
  32245. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  32246. if (!Array.from(inputs).includes(document.activeElement)) {
  32247. setSelected();
  32248. }
  32249. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  32250. checkDefaultFirstOption();
  32251. }
  32252. }, {
  32253. flush: "post"
  32254. });
  32255. vue.watch(() => states.hoverIndex, (val) => {
  32256. if (isNumber$1(val) && val > -1) {
  32257. hoverOption.value = optionsArray.value[val] || {};
  32258. } else {
  32259. hoverOption.value = {};
  32260. }
  32261. optionsArray.value.forEach((option) => {
  32262. option.hover = hoverOption.value === option;
  32263. });
  32264. });
  32265. const resetInputHeight = () => {
  32266. vue.nextTick(() => {
  32267. var _a, _b;
  32268. if (!reference.value)
  32269. return;
  32270. const input2 = reference.value.$el.querySelector("input");
  32271. originClientHeight = originClientHeight || (input2.clientHeight > 0 ? input2.clientHeight + 2 : 0);
  32272. const _tags = tags.value;
  32273. const gotSize = getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
  32274. const sizeInMap = gotSize === originClientHeight || originClientHeight <= 0 ? gotSize : originClientHeight;
  32275. const isElHidden = input2.offsetParent === null;
  32276. !isElHidden && (input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`);
  32277. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  32278. if (states.visible && emptyText.value !== false) {
  32279. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  32280. }
  32281. });
  32282. };
  32283. const handleQueryChange = async (val) => {
  32284. if (states.previousQuery === val || states.isOnComposition)
  32285. return;
  32286. if (states.previousQuery === null && (isFunction$1(props.filterMethod) || isFunction$1(props.remoteMethod))) {
  32287. states.previousQuery = val;
  32288. return;
  32289. }
  32290. states.previousQuery = val;
  32291. vue.nextTick(() => {
  32292. var _a, _b;
  32293. if (states.visible)
  32294. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  32295. });
  32296. states.hoverIndex = -1;
  32297. if (props.multiple && props.filterable) {
  32298. vue.nextTick(() => {
  32299. const length = input.value.value.length * 15 + 20;
  32300. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  32301. managePlaceholder();
  32302. resetInputHeight();
  32303. });
  32304. }
  32305. if (props.remote && isFunction$1(props.remoteMethod)) {
  32306. states.hoverIndex = -1;
  32307. props.remoteMethod(val);
  32308. } else if (isFunction$1(props.filterMethod)) {
  32309. props.filterMethod(val);
  32310. vue.triggerRef(groupQueryChange);
  32311. } else {
  32312. states.filteredOptionsCount = states.optionsCount;
  32313. queryChange.value.query = val;
  32314. vue.triggerRef(queryChange);
  32315. vue.triggerRef(groupQueryChange);
  32316. }
  32317. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  32318. await vue.nextTick();
  32319. checkDefaultFirstOption();
  32320. }
  32321. };
  32322. const managePlaceholder = () => {
  32323. if (states.currentPlaceholder !== "") {
  32324. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  32325. }
  32326. };
  32327. const checkDefaultFirstOption = () => {
  32328. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  32329. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  32330. const firstOriginOption = optionsInDropdown[0];
  32331. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  32332. };
  32333. const setSelected = () => {
  32334. var _a;
  32335. if (!props.multiple) {
  32336. const option = getOption(props.modelValue);
  32337. if ((_a = option.props) == null ? void 0 : _a.created) {
  32338. states.createdLabel = option.props.value;
  32339. states.createdSelected = true;
  32340. } else {
  32341. states.createdSelected = false;
  32342. }
  32343. states.selectedLabel = option.currentLabel;
  32344. states.selected = option;
  32345. if (props.filterable)
  32346. states.query = states.selectedLabel;
  32347. return;
  32348. } else {
  32349. states.selectedLabel = "";
  32350. }
  32351. const result = [];
  32352. if (Array.isArray(props.modelValue)) {
  32353. props.modelValue.forEach((value) => {
  32354. result.push(getOption(value));
  32355. });
  32356. }
  32357. states.selected = result;
  32358. vue.nextTick(() => {
  32359. resetInputHeight();
  32360. });
  32361. };
  32362. const getOption = (value) => {
  32363. let option;
  32364. const isObjectValue = toRawType(value).toLowerCase() === "object";
  32365. const isNull = toRawType(value).toLowerCase() === "null";
  32366. const isUndefined = toRawType(value).toLowerCase() === "undefined";
  32367. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  32368. const cachedOption = cachedOptionsArray.value[i];
  32369. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  32370. if (isEqualValue) {
  32371. option = {
  32372. value,
  32373. currentLabel: cachedOption.currentLabel,
  32374. isDisabled: cachedOption.isDisabled
  32375. };
  32376. break;
  32377. }
  32378. }
  32379. if (option)
  32380. return option;
  32381. const label = isObjectValue ? value.label : !isNull && !isUndefined ? value : "";
  32382. const newOption = {
  32383. value,
  32384. currentLabel: label
  32385. };
  32386. if (props.multiple) {
  32387. newOption.hitState = false;
  32388. }
  32389. return newOption;
  32390. };
  32391. const resetHoverIndex = () => {
  32392. setTimeout(() => {
  32393. const valueKey = props.valueKey;
  32394. if (!props.multiple) {
  32395. states.hoverIndex = optionsArray.value.findIndex((item) => {
  32396. return getValueKey(item) === getValueKey(states.selected);
  32397. });
  32398. } else {
  32399. if (states.selected.length > 0) {
  32400. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  32401. return optionsArray.value.findIndex((item) => {
  32402. return get(item, valueKey) === get(selected, valueKey);
  32403. });
  32404. }));
  32405. } else {
  32406. states.hoverIndex = -1;
  32407. }
  32408. }
  32409. }, 300);
  32410. };
  32411. const handleResize = () => {
  32412. var _a, _b;
  32413. resetInputWidth();
  32414. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  32415. if (props.multiple)
  32416. resetInputHeight();
  32417. };
  32418. const resetInputWidth = () => {
  32419. var _a;
  32420. states.inputWidth = (_a = reference.value) == null ? void 0 : _a.$el.offsetWidth;
  32421. };
  32422. const onInputChange = () => {
  32423. if (props.filterable && states.query !== states.selectedLabel) {
  32424. states.query = states.selectedLabel;
  32425. handleQueryChange(states.query);
  32426. }
  32427. };
  32428. const debouncedOnInputChange = debounce(() => {
  32429. onInputChange();
  32430. }, debounce$1.value);
  32431. const debouncedQueryChange = debounce((e) => {
  32432. handleQueryChange(e.target.value);
  32433. }, debounce$1.value);
  32434. const emitChange = (val) => {
  32435. if (!isEqual$1(props.modelValue, val)) {
  32436. ctx.emit(CHANGE_EVENT, val);
  32437. }
  32438. };
  32439. const deletePrevTag = (e) => {
  32440. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  32441. const value = props.modelValue.slice();
  32442. value.pop();
  32443. ctx.emit(UPDATE_MODEL_EVENT, value);
  32444. emitChange(value);
  32445. }
  32446. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  32447. states.currentPlaceholder = states.cachedPlaceHolder;
  32448. }
  32449. };
  32450. const deleteTag = (event, tag) => {
  32451. const index = states.selected.indexOf(tag);
  32452. if (index > -1 && !selectDisabled.value) {
  32453. const value = props.modelValue.slice();
  32454. value.splice(index, 1);
  32455. ctx.emit(UPDATE_MODEL_EVENT, value);
  32456. emitChange(value);
  32457. ctx.emit("remove-tag", tag.value);
  32458. }
  32459. event.stopPropagation();
  32460. };
  32461. const deleteSelected = (event) => {
  32462. event.stopPropagation();
  32463. const value = props.multiple ? [] : "";
  32464. if (!isString$1(value)) {
  32465. for (const item of states.selected) {
  32466. if (item.isDisabled)
  32467. value.push(item.value);
  32468. }
  32469. }
  32470. ctx.emit(UPDATE_MODEL_EVENT, value);
  32471. emitChange(value);
  32472. states.hoverIndex = -1;
  32473. states.visible = false;
  32474. ctx.emit("clear");
  32475. };
  32476. const handleOptionSelect = (option, byClick) => {
  32477. var _a;
  32478. if (props.multiple) {
  32479. const value = (props.modelValue || []).slice();
  32480. const optionIndex = getValueIndex(value, option.value);
  32481. if (optionIndex > -1) {
  32482. value.splice(optionIndex, 1);
  32483. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  32484. value.push(option.value);
  32485. }
  32486. ctx.emit(UPDATE_MODEL_EVENT, value);
  32487. emitChange(value);
  32488. if (option.created) {
  32489. states.query = "";
  32490. handleQueryChange("");
  32491. states.inputLength = 20;
  32492. }
  32493. if (props.filterable)
  32494. (_a = input.value) == null ? void 0 : _a.focus();
  32495. } else {
  32496. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  32497. emitChange(option.value);
  32498. states.visible = false;
  32499. }
  32500. states.isSilentBlur = byClick;
  32501. setSoftFocus();
  32502. if (states.visible)
  32503. return;
  32504. vue.nextTick(() => {
  32505. scrollToOption(option);
  32506. });
  32507. };
  32508. const getValueIndex = (arr = [], value) => {
  32509. if (!isObject$1(value))
  32510. return arr.indexOf(value);
  32511. const valueKey = props.valueKey;
  32512. let index = -1;
  32513. arr.some((item, i) => {
  32514. if (vue.toRaw(get(item, valueKey)) === get(value, valueKey)) {
  32515. index = i;
  32516. return true;
  32517. }
  32518. return false;
  32519. });
  32520. return index;
  32521. };
  32522. const setSoftFocus = () => {
  32523. states.softFocus = true;
  32524. const _input = input.value || reference.value;
  32525. if (_input) {
  32526. _input == null ? void 0 : _input.focus();
  32527. }
  32528. };
  32529. const scrollToOption = (option) => {
  32530. var _a, _b, _c, _d, _e;
  32531. const targetOption = Array.isArray(option) ? option[0] : option;
  32532. let target = null;
  32533. if (targetOption == null ? void 0 : targetOption.value) {
  32534. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  32535. if (options.length > 0) {
  32536. target = options[0].$el;
  32537. }
  32538. }
  32539. if (tooltipRef.value && target) {
  32540. const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
  32541. if (menu) {
  32542. scrollIntoView(menu, target);
  32543. }
  32544. }
  32545. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  32546. };
  32547. const onOptionCreate = (vm) => {
  32548. states.optionsCount++;
  32549. states.filteredOptionsCount++;
  32550. states.options.set(vm.value, vm);
  32551. states.cachedOptions.set(vm.value, vm);
  32552. };
  32553. const onOptionDestroy = (key, vm) => {
  32554. if (states.options.get(key) === vm) {
  32555. states.optionsCount--;
  32556. states.filteredOptionsCount--;
  32557. states.options.delete(key);
  32558. }
  32559. };
  32560. const resetInputState = (e) => {
  32561. if (e.code !== EVENT_CODE.backspace)
  32562. toggleLastOptionHitState(false);
  32563. states.inputLength = input.value.value.length * 15 + 20;
  32564. resetInputHeight();
  32565. };
  32566. const toggleLastOptionHitState = (hit) => {
  32567. if (!Array.isArray(states.selected))
  32568. return;
  32569. const option = states.selected[states.selected.length - 1];
  32570. if (!option)
  32571. return;
  32572. if (hit === true || hit === false) {
  32573. option.hitState = hit;
  32574. return hit;
  32575. }
  32576. option.hitState = !option.hitState;
  32577. return option.hitState;
  32578. };
  32579. const handleComposition = (event) => {
  32580. const text = event.target.value;
  32581. if (event.type === "compositionend") {
  32582. states.isOnComposition = false;
  32583. vue.nextTick(() => handleQueryChange(text));
  32584. } else {
  32585. const lastCharacter = text[text.length - 1] || "";
  32586. states.isOnComposition = !isKorean(lastCharacter);
  32587. }
  32588. };
  32589. const handleMenuEnter = () => {
  32590. vue.nextTick(() => scrollToOption(states.selected));
  32591. };
  32592. const handleFocus = (event) => {
  32593. if (!states.softFocus) {
  32594. if (props.automaticDropdown || props.filterable) {
  32595. if (props.filterable && !states.visible) {
  32596. states.menuVisibleOnFocus = true;
  32597. }
  32598. states.visible = true;
  32599. }
  32600. ctx.emit("focus", event);
  32601. } else {
  32602. states.softFocus = false;
  32603. }
  32604. };
  32605. const blur = () => {
  32606. var _a, _b, _c;
  32607. states.visible = false;
  32608. (_a = reference.value) == null ? void 0 : _a.blur();
  32609. (_c = (_b = iOSInput.value) == null ? void 0 : _b.blur) == null ? void 0 : _c.call(_b);
  32610. };
  32611. const handleBlur = (event) => {
  32612. vue.nextTick(() => {
  32613. if (states.isSilentBlur) {
  32614. states.isSilentBlur = false;
  32615. } else {
  32616. ctx.emit("blur", event);
  32617. }
  32618. });
  32619. states.softFocus = false;
  32620. };
  32621. const handleClearClick = (event) => {
  32622. deleteSelected(event);
  32623. };
  32624. const handleClose = () => {
  32625. states.visible = false;
  32626. };
  32627. const handleKeydownEscape = (event) => {
  32628. if (states.visible) {
  32629. event.preventDefault();
  32630. event.stopPropagation();
  32631. states.visible = false;
  32632. }
  32633. };
  32634. const toggleMenu = (e) => {
  32635. var _a;
  32636. if (e && !states.mouseEnter) {
  32637. return;
  32638. }
  32639. if (!selectDisabled.value) {
  32640. if (states.menuVisibleOnFocus) {
  32641. states.menuVisibleOnFocus = false;
  32642. } else {
  32643. if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
  32644. states.visible = !states.visible;
  32645. }
  32646. }
  32647. if (states.visible) {
  32648. (_a = input.value || reference.value) == null ? void 0 : _a.focus();
  32649. }
  32650. }
  32651. };
  32652. const selectOption = () => {
  32653. if (!states.visible) {
  32654. toggleMenu();
  32655. } else {
  32656. if (optionsArray.value[states.hoverIndex]) {
  32657. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  32658. }
  32659. }
  32660. };
  32661. const getValueKey = (item) => {
  32662. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  32663. };
  32664. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  32665. const showTagList = vue.computed(() => states.selected.slice(0, props.maxCollapseTags));
  32666. const collapseTagList = vue.computed(() => states.selected.slice(props.maxCollapseTags));
  32667. const navigateOptions = (direction) => {
  32668. if (!states.visible) {
  32669. states.visible = true;
  32670. return;
  32671. }
  32672. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  32673. return;
  32674. if (states.isOnComposition)
  32675. return;
  32676. if (!optionsAllDisabled.value) {
  32677. if (direction === "next") {
  32678. states.hoverIndex++;
  32679. if (states.hoverIndex === states.options.size) {
  32680. states.hoverIndex = 0;
  32681. }
  32682. } else if (direction === "prev") {
  32683. states.hoverIndex--;
  32684. if (states.hoverIndex < 0) {
  32685. states.hoverIndex = states.options.size - 1;
  32686. }
  32687. }
  32688. const option = optionsArray.value[states.hoverIndex];
  32689. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  32690. navigateOptions(direction);
  32691. }
  32692. vue.nextTick(() => scrollToOption(hoverOption.value));
  32693. }
  32694. };
  32695. const handleMouseEnter = () => {
  32696. states.mouseEnter = true;
  32697. };
  32698. const handleMouseLeave = () => {
  32699. states.mouseEnter = false;
  32700. };
  32701. return {
  32702. optionList,
  32703. optionsArray,
  32704. selectSize,
  32705. handleResize,
  32706. debouncedOnInputChange,
  32707. debouncedQueryChange,
  32708. deletePrevTag,
  32709. deleteTag,
  32710. deleteSelected,
  32711. handleOptionSelect,
  32712. scrollToOption,
  32713. readonly,
  32714. resetInputHeight,
  32715. showClose,
  32716. iconComponent,
  32717. iconReverse,
  32718. showNewOption,
  32719. collapseTagSize,
  32720. setSelected,
  32721. managePlaceholder,
  32722. selectDisabled,
  32723. emptyText,
  32724. toggleLastOptionHitState,
  32725. resetInputState,
  32726. handleComposition,
  32727. onOptionCreate,
  32728. onOptionDestroy,
  32729. handleMenuEnter,
  32730. handleFocus,
  32731. blur,
  32732. handleBlur,
  32733. handleClearClick,
  32734. handleClose,
  32735. handleKeydownEscape,
  32736. toggleMenu,
  32737. selectOption,
  32738. getValueKey,
  32739. navigateOptions,
  32740. dropMenuVisible,
  32741. queryChange,
  32742. groupQueryChange,
  32743. showTagList,
  32744. collapseTagList,
  32745. reference,
  32746. input,
  32747. iOSInput,
  32748. tooltipRef,
  32749. tags,
  32750. selectWrapper,
  32751. scrollbar,
  32752. handleMouseEnter,
  32753. handleMouseLeave
  32754. };
  32755. };
  32756. var ElOptions = vue.defineComponent({
  32757. name: "ElOptions",
  32758. emits: ["update-options"],
  32759. setup(_, { slots, emit }) {
  32760. let cachedOptions = [];
  32761. function isSameOptions(a, b) {
  32762. if (a.length !== b.length)
  32763. return false;
  32764. for (const [index] of a.entries()) {
  32765. if (a[index] != b[index]) {
  32766. return false;
  32767. }
  32768. }
  32769. return true;
  32770. }
  32771. return () => {
  32772. var _a, _b;
  32773. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  32774. const filteredOptions = [];
  32775. function filterOptions(children2) {
  32776. if (!Array.isArray(children2))
  32777. return;
  32778. children2.forEach((item) => {
  32779. var _a2, _b2, _c, _d;
  32780. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  32781. if (name === "ElOptionGroup") {
  32782. filterOptions(!isString$1(item.children) && !Array.isArray(item.children) && isFunction$1((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  32783. } else if (name === "ElOption") {
  32784. filteredOptions.push((_d = item.props) == null ? void 0 : _d.label);
  32785. } else if (Array.isArray(item.children)) {
  32786. filterOptions(item.children);
  32787. }
  32788. });
  32789. }
  32790. if (children.length) {
  32791. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  32792. }
  32793. if (!isSameOptions(filteredOptions, cachedOptions)) {
  32794. cachedOptions = filteredOptions;
  32795. emit("update-options", filteredOptions);
  32796. }
  32797. return children;
  32798. };
  32799. }
  32800. });
  32801. const COMPONENT_NAME$9 = "ElSelect";
  32802. const _sfc_main$O = vue.defineComponent({
  32803. name: COMPONENT_NAME$9,
  32804. componentName: COMPONENT_NAME$9,
  32805. components: {
  32806. ElInput,
  32807. ElSelectMenu: ElSelectMenu$1,
  32808. ElOption: Option,
  32809. ElOptions,
  32810. ElTag,
  32811. ElScrollbar,
  32812. ElTooltip,
  32813. ElIcon
  32814. },
  32815. directives: { ClickOutside },
  32816. props: {
  32817. name: String,
  32818. id: String,
  32819. modelValue: {
  32820. type: [Array, String, Number, Boolean, Object],
  32821. default: void 0
  32822. },
  32823. autocomplete: {
  32824. type: String,
  32825. default: "off"
  32826. },
  32827. automaticDropdown: Boolean,
  32828. size: {
  32829. type: String,
  32830. validator: isValidComponentSize
  32831. },
  32832. effect: {
  32833. type: String,
  32834. default: "light"
  32835. },
  32836. disabled: Boolean,
  32837. clearable: Boolean,
  32838. filterable: Boolean,
  32839. allowCreate: Boolean,
  32840. loading: Boolean,
  32841. popperClass: {
  32842. type: String,
  32843. default: ""
  32844. },
  32845. popperOptions: {
  32846. type: Object,
  32847. default: () => ({})
  32848. },
  32849. remote: Boolean,
  32850. loadingText: String,
  32851. noMatchText: String,
  32852. noDataText: String,
  32853. remoteMethod: Function,
  32854. filterMethod: Function,
  32855. multiple: Boolean,
  32856. multipleLimit: {
  32857. type: Number,
  32858. default: 0
  32859. },
  32860. placeholder: {
  32861. type: String
  32862. },
  32863. defaultFirstOption: Boolean,
  32864. reserveKeyword: {
  32865. type: Boolean,
  32866. default: true
  32867. },
  32868. valueKey: {
  32869. type: String,
  32870. default: "value"
  32871. },
  32872. collapseTags: Boolean,
  32873. collapseTagsTooltip: {
  32874. type: Boolean,
  32875. default: false
  32876. },
  32877. maxCollapseTags: {
  32878. type: Number,
  32879. default: 1
  32880. },
  32881. teleported: useTooltipContentProps.teleported,
  32882. persistent: {
  32883. type: Boolean,
  32884. default: true
  32885. },
  32886. clearIcon: {
  32887. type: iconPropType,
  32888. default: circle_close_default
  32889. },
  32890. fitInputWidth: {
  32891. type: Boolean,
  32892. default: false
  32893. },
  32894. suffixIcon: {
  32895. type: iconPropType,
  32896. default: arrow_down_default
  32897. },
  32898. tagType: { ...tagProps.type, default: "info" },
  32899. validateEvent: {
  32900. type: Boolean,
  32901. default: true
  32902. },
  32903. remoteShowSuffix: {
  32904. type: Boolean,
  32905. default: false
  32906. },
  32907. suffixTransition: {
  32908. type: Boolean,
  32909. default: true
  32910. },
  32911. placement: {
  32912. type: String,
  32913. values: Ee,
  32914. default: "bottom-start"
  32915. }
  32916. },
  32917. emits: [
  32918. UPDATE_MODEL_EVENT,
  32919. CHANGE_EVENT,
  32920. "remove-tag",
  32921. "clear",
  32922. "visible-change",
  32923. "focus",
  32924. "blur"
  32925. ],
  32926. setup(props, ctx) {
  32927. const nsSelect = useNamespace("select");
  32928. const nsInput = useNamespace("input");
  32929. const { t } = useLocale();
  32930. const states = useSelectStates(props);
  32931. const {
  32932. optionList,
  32933. optionsArray,
  32934. selectSize,
  32935. readonly,
  32936. handleResize,
  32937. collapseTagSize,
  32938. debouncedOnInputChange,
  32939. debouncedQueryChange,
  32940. deletePrevTag,
  32941. deleteTag,
  32942. deleteSelected,
  32943. handleOptionSelect,
  32944. scrollToOption,
  32945. setSelected,
  32946. resetInputHeight,
  32947. managePlaceholder,
  32948. showClose,
  32949. selectDisabled,
  32950. iconComponent,
  32951. iconReverse,
  32952. showNewOption,
  32953. emptyText,
  32954. toggleLastOptionHitState,
  32955. resetInputState,
  32956. handleComposition,
  32957. onOptionCreate,
  32958. onOptionDestroy,
  32959. handleMenuEnter,
  32960. handleFocus,
  32961. blur,
  32962. handleBlur,
  32963. handleClearClick,
  32964. handleClose,
  32965. handleKeydownEscape,
  32966. toggleMenu,
  32967. selectOption,
  32968. getValueKey,
  32969. navigateOptions,
  32970. dropMenuVisible,
  32971. reference,
  32972. input,
  32973. iOSInput,
  32974. tooltipRef,
  32975. tags,
  32976. selectWrapper,
  32977. scrollbar,
  32978. queryChange,
  32979. groupQueryChange,
  32980. handleMouseEnter,
  32981. handleMouseLeave,
  32982. showTagList,
  32983. collapseTagList
  32984. } = useSelect$3(props, states, ctx);
  32985. const { focus } = useFocus(reference);
  32986. const {
  32987. inputWidth,
  32988. selected,
  32989. inputLength,
  32990. filteredOptionsCount,
  32991. visible,
  32992. softFocus,
  32993. selectedLabel,
  32994. hoverIndex,
  32995. query,
  32996. inputHovering,
  32997. currentPlaceholder,
  32998. menuVisibleOnFocus,
  32999. isOnComposition,
  33000. isSilentBlur,
  33001. options,
  33002. cachedOptions,
  33003. optionsCount,
  33004. prefixWidth,
  33005. tagInMultiLine
  33006. } = vue.toRefs(states);
  33007. const wrapperKls = vue.computed(() => {
  33008. const classList = [nsSelect.b()];
  33009. const _selectSize = vue.unref(selectSize);
  33010. if (_selectSize) {
  33011. classList.push(nsSelect.m(_selectSize));
  33012. }
  33013. if (props.disabled) {
  33014. classList.push(nsSelect.m("disabled"));
  33015. }
  33016. return classList;
  33017. });
  33018. const selectTagsStyle = vue.computed(() => ({
  33019. maxWidth: `${vue.unref(inputWidth) - 32}px`,
  33020. width: "100%"
  33021. }));
  33022. const tagTextStyle = vue.computed(() => {
  33023. const maxWidth = vue.unref(inputWidth) > 123 ? vue.unref(inputWidth) - 123 : vue.unref(inputWidth) - 75;
  33024. return { maxWidth: `${maxWidth}px` };
  33025. });
  33026. vue.provide(selectKey, vue.reactive({
  33027. props,
  33028. options,
  33029. optionsArray,
  33030. cachedOptions,
  33031. optionsCount,
  33032. filteredOptionsCount,
  33033. hoverIndex,
  33034. handleOptionSelect,
  33035. onOptionCreate,
  33036. onOptionDestroy,
  33037. selectWrapper,
  33038. selected,
  33039. setSelected,
  33040. queryChange,
  33041. groupQueryChange
  33042. }));
  33043. vue.onMounted(() => {
  33044. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || (() => t("el.select.placeholder"));
  33045. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  33046. currentPlaceholder.value = "";
  33047. }
  33048. useResizeObserver(selectWrapper, handleResize);
  33049. if (props.remote && props.multiple) {
  33050. resetInputHeight();
  33051. }
  33052. vue.nextTick(() => {
  33053. const refEl = reference.value && reference.value.$el;
  33054. if (!refEl)
  33055. return;
  33056. inputWidth.value = refEl.getBoundingClientRect().width;
  33057. if (ctx.slots.prefix) {
  33058. const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
  33059. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  33060. }
  33061. });
  33062. setSelected();
  33063. });
  33064. if (props.multiple && !Array.isArray(props.modelValue)) {
  33065. ctx.emit(UPDATE_MODEL_EVENT, []);
  33066. }
  33067. if (!props.multiple && Array.isArray(props.modelValue)) {
  33068. ctx.emit(UPDATE_MODEL_EVENT, "");
  33069. }
  33070. const popperPaneRef = vue.computed(() => {
  33071. var _a, _b;
  33072. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  33073. });
  33074. const onOptionsRendered = (v) => {
  33075. optionList.value = v;
  33076. };
  33077. return {
  33078. isIOS,
  33079. onOptionsRendered,
  33080. tagInMultiLine,
  33081. prefixWidth,
  33082. selectSize,
  33083. readonly,
  33084. handleResize,
  33085. collapseTagSize,
  33086. debouncedOnInputChange,
  33087. debouncedQueryChange,
  33088. deletePrevTag,
  33089. deleteTag,
  33090. deleteSelected,
  33091. handleOptionSelect,
  33092. scrollToOption,
  33093. inputWidth,
  33094. selected,
  33095. inputLength,
  33096. filteredOptionsCount,
  33097. visible,
  33098. softFocus,
  33099. selectedLabel,
  33100. hoverIndex,
  33101. query,
  33102. inputHovering,
  33103. currentPlaceholder,
  33104. menuVisibleOnFocus,
  33105. isOnComposition,
  33106. isSilentBlur,
  33107. options,
  33108. resetInputHeight,
  33109. managePlaceholder,
  33110. showClose,
  33111. selectDisabled,
  33112. iconComponent,
  33113. iconReverse,
  33114. showNewOption,
  33115. emptyText,
  33116. toggleLastOptionHitState,
  33117. resetInputState,
  33118. handleComposition,
  33119. handleMenuEnter,
  33120. handleFocus,
  33121. blur,
  33122. handleBlur,
  33123. handleClearClick,
  33124. handleClose,
  33125. handleKeydownEscape,
  33126. toggleMenu,
  33127. selectOption,
  33128. getValueKey,
  33129. navigateOptions,
  33130. dropMenuVisible,
  33131. focus,
  33132. reference,
  33133. input,
  33134. iOSInput,
  33135. tooltipRef,
  33136. popperPaneRef,
  33137. tags,
  33138. selectWrapper,
  33139. scrollbar,
  33140. wrapperKls,
  33141. selectTagsStyle,
  33142. nsSelect,
  33143. tagTextStyle,
  33144. handleMouseEnter,
  33145. handleMouseLeave,
  33146. showTagList,
  33147. collapseTagList
  33148. };
  33149. }
  33150. });
  33151. const _hoisted_1$n = ["disabled", "autocomplete"];
  33152. const _hoisted_2$f = ["disabled"];
  33153. const _hoisted_3$8 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  33154. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  33155. const _component_el_tag = vue.resolveComponent("el-tag");
  33156. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  33157. const _component_el_icon = vue.resolveComponent("el-icon");
  33158. const _component_el_input = vue.resolveComponent("el-input");
  33159. const _component_el_option = vue.resolveComponent("el-option");
  33160. const _component_el_options = vue.resolveComponent("el-options");
  33161. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  33162. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  33163. const _directive_click_outside = vue.resolveDirective("click-outside");
  33164. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  33165. ref: "selectWrapper",
  33166. class: vue.normalizeClass(_ctx.wrapperKls),
  33167. onMouseenter: _cache[21] || (_cache[21] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  33168. onMouseleave: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  33169. onClick: _cache[23] || (_cache[23] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  33170. }, [
  33171. vue.createVNode(_component_el_tooltip, {
  33172. ref: "tooltipRef",
  33173. visible: _ctx.dropMenuVisible,
  33174. placement: _ctx.placement,
  33175. teleported: _ctx.teleported,
  33176. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  33177. "popper-options": _ctx.popperOptions,
  33178. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  33179. effect: _ctx.effect,
  33180. pure: "",
  33181. trigger: "click",
  33182. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  33183. "stop-popper-mouse-event": false,
  33184. "gpu-acceleration": false,
  33185. persistent: _ctx.persistent,
  33186. onShow: _ctx.handleMenuEnter
  33187. }, {
  33188. default: vue.withCtx(() => [
  33189. vue.createElementVNode("div", {
  33190. class: "select-trigger",
  33191. onMouseenter: _cache[19] || (_cache[19] = ($event) => _ctx.inputHovering = true),
  33192. onMouseleave: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = false)
  33193. }, [
  33194. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  33195. key: 0,
  33196. ref: "tags",
  33197. class: vue.normalizeClass([
  33198. _ctx.nsSelect.e("tags"),
  33199. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  33200. ]),
  33201. style: vue.normalizeStyle(_ctx.selectTagsStyle)
  33202. }, [
  33203. _ctx.collapseTags && _ctx.selected.length ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  33204. key: 0,
  33205. onAfterLeave: _ctx.resetInputHeight
  33206. }, {
  33207. default: vue.withCtx(() => [
  33208. vue.createElementVNode("span", {
  33209. class: vue.normalizeClass([
  33210. _ctx.nsSelect.b("tags-wrapper"),
  33211. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  33212. ])
  33213. }, [
  33214. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  33215. return vue.openBlock(), vue.createBlock(_component_el_tag, {
  33216. key: _ctx.getValueKey(item),
  33217. closable: !_ctx.selectDisabled && !item.isDisabled,
  33218. size: _ctx.collapseTagSize,
  33219. hit: item.hitState,
  33220. type: _ctx.tagType,
  33221. "disable-transitions": "",
  33222. onClose: ($event) => _ctx.deleteTag($event, item)
  33223. }, {
  33224. default: vue.withCtx(() => [
  33225. vue.createElementVNode("span", {
  33226. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  33227. style: vue.normalizeStyle(_ctx.tagTextStyle)
  33228. }, vue.toDisplayString(item.currentLabel), 7)
  33229. ]),
  33230. _: 2
  33231. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  33232. }), 128)),
  33233. _ctx.selected.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tag, {
  33234. key: 0,
  33235. closable: false,
  33236. size: _ctx.collapseTagSize,
  33237. type: _ctx.tagType,
  33238. "disable-transitions": ""
  33239. }, {
  33240. default: vue.withCtx(() => [
  33241. _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  33242. key: 0,
  33243. disabled: _ctx.dropMenuVisible,
  33244. "fallback-placements": ["bottom", "top", "right", "left"],
  33245. effect: _ctx.effect,
  33246. placement: "bottom",
  33247. teleported: _ctx.teleported
  33248. }, {
  33249. default: vue.withCtx(() => [
  33250. vue.createElementVNode("span", {
  33251. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  33252. }, "+ " + vue.toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3)
  33253. ]),
  33254. content: vue.withCtx(() => [
  33255. vue.createElementVNode("div", {
  33256. class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  33257. }, [
  33258. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (item) => {
  33259. return vue.openBlock(), vue.createElementBlock("div", {
  33260. key: _ctx.getValueKey(item),
  33261. class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  33262. }, [
  33263. vue.createVNode(_component_el_tag, {
  33264. class: "in-tooltip",
  33265. closable: !_ctx.selectDisabled && !item.isDisabled,
  33266. size: _ctx.collapseTagSize,
  33267. hit: item.hitState,
  33268. type: _ctx.tagType,
  33269. "disable-transitions": "",
  33270. style: { margin: "2px" },
  33271. onClose: ($event) => _ctx.deleteTag($event, item)
  33272. }, {
  33273. default: vue.withCtx(() => [
  33274. vue.createElementVNode("span", {
  33275. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  33276. style: vue.normalizeStyle({
  33277. maxWidth: _ctx.inputWidth - 75 + "px"
  33278. })
  33279. }, vue.toDisplayString(item.currentLabel), 7)
  33280. ]),
  33281. _: 2
  33282. }, 1032, ["closable", "size", "hit", "type", "onClose"])
  33283. ], 2);
  33284. }), 128))
  33285. ], 2)
  33286. ]),
  33287. _: 1
  33288. }, 8, ["disabled", "effect", "teleported"])) : (vue.openBlock(), vue.createElementBlock("span", {
  33289. key: 1,
  33290. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  33291. }, "+ " + vue.toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3))
  33292. ]),
  33293. _: 1
  33294. }, 8, ["size", "type"])) : vue.createCommentVNode("v-if", true)
  33295. ], 2)
  33296. ]),
  33297. _: 1
  33298. }, 8, ["onAfterLeave"])) : vue.createCommentVNode("v-if", true),
  33299. !_ctx.collapseTags ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  33300. key: 1,
  33301. onAfterLeave: _ctx.resetInputHeight
  33302. }, {
  33303. default: vue.withCtx(() => [
  33304. vue.createElementVNode("span", {
  33305. class: vue.normalizeClass([
  33306. _ctx.nsSelect.b("tags-wrapper"),
  33307. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  33308. ])
  33309. }, [
  33310. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.selected, (item) => {
  33311. return vue.openBlock(), vue.createBlock(_component_el_tag, {
  33312. key: _ctx.getValueKey(item),
  33313. closable: !_ctx.selectDisabled && !item.isDisabled,
  33314. size: _ctx.collapseTagSize,
  33315. hit: item.hitState,
  33316. type: _ctx.tagType,
  33317. "disable-transitions": "",
  33318. onClose: ($event) => _ctx.deleteTag($event, item)
  33319. }, {
  33320. default: vue.withCtx(() => [
  33321. vue.createElementVNode("span", {
  33322. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  33323. style: vue.normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  33324. }, vue.toDisplayString(item.currentLabel), 7)
  33325. ]),
  33326. _: 2
  33327. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  33328. }), 128))
  33329. ], 2)
  33330. ]),
  33331. _: 1
  33332. }, 8, ["onAfterLeave"])) : vue.createCommentVNode("v-if", true),
  33333. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  33334. key: 2,
  33335. ref: "input",
  33336. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.query = $event),
  33337. type: "text",
  33338. class: vue.normalizeClass([
  33339. _ctx.nsSelect.e("input"),
  33340. _ctx.nsSelect.is(_ctx.selectSize),
  33341. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  33342. ]),
  33343. disabled: _ctx.selectDisabled,
  33344. autocomplete: _ctx.autocomplete,
  33345. style: vue.normalizeStyle({
  33346. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  33347. flexGrow: 1,
  33348. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  33349. maxWidth: `${_ctx.inputWidth - 42}px`
  33350. }),
  33351. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  33352. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  33353. onKeyup: _cache[3] || (_cache[3] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  33354. onKeydown: [
  33355. _cache[4] || (_cache[4] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  33356. _cache[5] || (_cache[5] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  33357. _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  33358. _cache[7] || (_cache[7] = vue.withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
  33359. _cache[8] || (_cache[8] = vue.withKeys(vue.withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  33360. _cache[9] || (_cache[9] = vue.withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  33361. _cache[10] || (_cache[10] = vue.withKeys(($event) => _ctx.visible = false, ["tab"]))
  33362. ],
  33363. onCompositionstart: _cache[11] || (_cache[11] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  33364. onCompositionupdate: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  33365. onCompositionend: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  33366. onInput: _cache[14] || (_cache[14] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  33367. }, null, 46, _hoisted_1$n)), [
  33368. [vue.vModelText, _ctx.query]
  33369. ]) : vue.createCommentVNode("v-if", true)
  33370. ], 6)) : vue.createCommentVNode("v-if", true),
  33371. vue.createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "),
  33372. _ctx.isIOS && !_ctx.multiple && _ctx.filterable && _ctx.readonly ? (vue.openBlock(), vue.createElementBlock("input", {
  33373. key: 1,
  33374. ref: "iOSInput",
  33375. class: vue.normalizeClass([
  33376. _ctx.nsSelect.e("input"),
  33377. _ctx.nsSelect.is(_ctx.selectSize),
  33378. _ctx.nsSelect.em("input", "iOS")
  33379. ]),
  33380. disabled: _ctx.selectDisabled,
  33381. type: "text"
  33382. }, null, 10, _hoisted_2$f)) : vue.createCommentVNode("v-if", true),
  33383. vue.createVNode(_component_el_input, {
  33384. id: _ctx.id,
  33385. ref: "reference",
  33386. modelValue: _ctx.selectedLabel,
  33387. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.selectedLabel = $event),
  33388. type: "text",
  33389. placeholder: typeof _ctx.currentPlaceholder === "function" ? _ctx.currentPlaceholder() : _ctx.currentPlaceholder,
  33390. name: _ctx.name,
  33391. autocomplete: _ctx.autocomplete,
  33392. size: _ctx.selectSize,
  33393. disabled: _ctx.selectDisabled,
  33394. readonly: _ctx.readonly,
  33395. "validate-event": false,
  33396. class: vue.normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  33397. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  33398. onFocus: _ctx.handleFocus,
  33399. onBlur: _ctx.handleBlur,
  33400. onInput: _ctx.debouncedOnInputChange,
  33401. onPaste: _ctx.debouncedOnInputChange,
  33402. onCompositionstart: _ctx.handleComposition,
  33403. onCompositionupdate: _ctx.handleComposition,
  33404. onCompositionend: _ctx.handleComposition,
  33405. onKeydown: [
  33406. _cache[16] || (_cache[16] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  33407. _cache[17] || (_cache[17] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  33408. vue.withKeys(vue.withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  33409. vue.withKeys(_ctx.handleKeydownEscape, ["esc"]),
  33410. _cache[18] || (_cache[18] = vue.withKeys(($event) => _ctx.visible = false, ["tab"]))
  33411. ]
  33412. }, vue.createSlots({
  33413. suffix: vue.withCtx(() => [
  33414. _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  33415. key: 0,
  33416. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  33417. }, {
  33418. default: vue.withCtx(() => [
  33419. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  33420. ]),
  33421. _: 1
  33422. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  33423. _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  33424. key: 1,
  33425. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  33426. onClick: _ctx.handleClearClick
  33427. }, {
  33428. default: vue.withCtx(() => [
  33429. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  33430. ]),
  33431. _: 1
  33432. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  33433. ]),
  33434. _: 2
  33435. }, [
  33436. _ctx.$slots.prefix ? {
  33437. name: "prefix",
  33438. fn: vue.withCtx(() => [
  33439. vue.createElementVNode("div", _hoisted_3$8, [
  33440. vue.renderSlot(_ctx.$slots, "prefix")
  33441. ])
  33442. ])
  33443. } : void 0
  33444. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  33445. ], 32)
  33446. ]),
  33447. content: vue.withCtx(() => [
  33448. vue.createVNode(_component_el_select_menu, null, {
  33449. default: vue.withCtx(() => [
  33450. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  33451. ref: "scrollbar",
  33452. tag: "ul",
  33453. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  33454. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  33455. class: vue.normalizeClass([
  33456. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  33457. ])
  33458. }, {
  33459. default: vue.withCtx(() => [
  33460. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  33461. key: 0,
  33462. value: _ctx.query,
  33463. created: true
  33464. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  33465. vue.createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, {
  33466. default: vue.withCtx(() => [
  33467. vue.renderSlot(_ctx.$slots, "default")
  33468. ]),
  33469. _: 3
  33470. }, 8, ["onUpdateOptions"])
  33471. ]),
  33472. _: 3
  33473. }, 8, ["wrap-class", "view-class", "class"]), [
  33474. [vue.vShow, _ctx.options.size > 0 && !_ctx.loading]
  33475. ]),
  33476. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  33477. _ctx.$slots.empty ? vue.renderSlot(_ctx.$slots, "empty", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", {
  33478. key: 1,
  33479. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  33480. }, vue.toDisplayString(_ctx.emptyText), 3))
  33481. ], 64)) : vue.createCommentVNode("v-if", true)
  33482. ]),
  33483. _: 3
  33484. })
  33485. ]),
  33486. _: 3
  33487. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onShow"])
  33488. ], 34)), [
  33489. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  33490. ]);
  33491. }
  33492. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  33493. const _sfc_main$N = vue.defineComponent({
  33494. name: "ElOptionGroup",
  33495. componentName: "ElOptionGroup",
  33496. props: {
  33497. label: String,
  33498. disabled: {
  33499. type: Boolean,
  33500. default: false
  33501. }
  33502. },
  33503. setup(props) {
  33504. const ns = useNamespace("select");
  33505. const visible = vue.ref(true);
  33506. const instance = vue.getCurrentInstance();
  33507. const children = vue.ref([]);
  33508. vue.provide(selectGroupKey, vue.reactive({
  33509. ...vue.toRefs(props)
  33510. }));
  33511. const select = vue.inject(selectKey);
  33512. vue.onMounted(() => {
  33513. children.value = flattedChildren(instance.subTree);
  33514. });
  33515. const flattedChildren = (node) => {
  33516. const children2 = [];
  33517. if (Array.isArray(node.children)) {
  33518. node.children.forEach((child) => {
  33519. var _a;
  33520. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  33521. children2.push(child.component.proxy);
  33522. } else if ((_a = child.children) == null ? void 0 : _a.length) {
  33523. children2.push(...flattedChildren(child));
  33524. }
  33525. });
  33526. }
  33527. return children2;
  33528. };
  33529. const { groupQueryChange } = vue.toRaw(select);
  33530. vue.watch(groupQueryChange, () => {
  33531. visible.value = children.value.some((option) => option.visible === true);
  33532. }, { flush: "post" });
  33533. return {
  33534. visible,
  33535. ns
  33536. };
  33537. }
  33538. });
  33539. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  33540. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  33541. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  33542. }, [
  33543. vue.createElementVNode("li", {
  33544. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  33545. }, vue.toDisplayString(_ctx.label), 3),
  33546. vue.createElementVNode("li", null, [
  33547. vue.createElementVNode("ul", {
  33548. class: vue.normalizeClass(_ctx.ns.b("group"))
  33549. }, [
  33550. vue.renderSlot(_ctx.$slots, "default")
  33551. ], 2)
  33552. ])
  33553. ], 2)), [
  33554. [vue.vShow, _ctx.visible]
  33555. ]);
  33556. }
  33557. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  33558. const ElSelect = withInstall(Select$1, {
  33559. Option,
  33560. OptionGroup
  33561. });
  33562. const ElOption = withNoopInstall(Option);
  33563. const ElOptionGroup = withNoopInstall(OptionGroup);
  33564. const usePagination = () => vue.inject(elPaginationKey, {});
  33565. const paginationSizesProps = buildProps({
  33566. pageSize: {
  33567. type: Number,
  33568. required: true
  33569. },
  33570. pageSizes: {
  33571. type: definePropType(Array),
  33572. default: () => mutable([10, 20, 30, 40, 50, 100])
  33573. },
  33574. popperClass: {
  33575. type: String
  33576. },
  33577. disabled: Boolean,
  33578. size: {
  33579. type: String,
  33580. values: componentSizes
  33581. }
  33582. });
  33583. const __default__$C = vue.defineComponent({
  33584. name: "ElPaginationSizes"
  33585. });
  33586. const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
  33587. ...__default__$C,
  33588. props: paginationSizesProps,
  33589. emits: ["page-size-change"],
  33590. setup(__props, { emit }) {
  33591. const props = __props;
  33592. const { t } = useLocale();
  33593. const ns = useNamespace("pagination");
  33594. const pagination = usePagination();
  33595. const innerPageSize = vue.ref(props.pageSize);
  33596. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  33597. if (isEqual$1(newVal, oldVal))
  33598. return;
  33599. if (Array.isArray(newVal)) {
  33600. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  33601. emit("page-size-change", pageSize);
  33602. }
  33603. });
  33604. vue.watch(() => props.pageSize, (newVal) => {
  33605. innerPageSize.value = newVal;
  33606. });
  33607. const innerPageSizes = vue.computed(() => props.pageSizes);
  33608. function handleChange(val) {
  33609. var _a;
  33610. if (val !== innerPageSize.value) {
  33611. innerPageSize.value = val;
  33612. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  33613. }
  33614. }
  33615. return (_ctx, _cache) => {
  33616. return vue.openBlock(), vue.createElementBlock("span", {
  33617. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  33618. }, [
  33619. vue.createVNode(vue.unref(ElSelect), {
  33620. "model-value": innerPageSize.value,
  33621. disabled: _ctx.disabled,
  33622. "popper-class": _ctx.popperClass,
  33623. size: _ctx.size,
  33624. "validate-event": false,
  33625. onChange: handleChange
  33626. }, {
  33627. default: vue.withCtx(() => [
  33628. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  33629. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  33630. key: item,
  33631. value: item,
  33632. label: item + vue.unref(t)("el.pagination.pagesize")
  33633. }, null, 8, ["value", "label"]);
  33634. }), 128))
  33635. ]),
  33636. _: 1
  33637. }, 8, ["model-value", "disabled", "popper-class", "size"])
  33638. ], 2);
  33639. };
  33640. }
  33641. });
  33642. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__file", "sizes.vue"]]);
  33643. const paginationJumperProps = buildProps({
  33644. size: {
  33645. type: String,
  33646. values: componentSizes
  33647. }
  33648. });
  33649. const _hoisted_1$m = ["disabled"];
  33650. const __default__$B = vue.defineComponent({
  33651. name: "ElPaginationJumper"
  33652. });
  33653. const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
  33654. ...__default__$B,
  33655. props: paginationJumperProps,
  33656. setup(__props) {
  33657. const { t } = useLocale();
  33658. const ns = useNamespace("pagination");
  33659. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  33660. const userInput = vue.ref();
  33661. const innerValue = vue.computed(() => {
  33662. var _a;
  33663. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  33664. });
  33665. function handleInput(val) {
  33666. userInput.value = val ? +val : "";
  33667. }
  33668. function handleChange(val) {
  33669. val = Math.trunc(+val);
  33670. changeEvent == null ? void 0 : changeEvent(val);
  33671. userInput.value = void 0;
  33672. }
  33673. return (_ctx, _cache) => {
  33674. return vue.openBlock(), vue.createElementBlock("span", {
  33675. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  33676. disabled: vue.unref(disabled)
  33677. }, [
  33678. vue.createElementVNode("span", {
  33679. class: vue.normalizeClass([vue.unref(ns).e("goto")])
  33680. }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3),
  33681. vue.createVNode(vue.unref(ElInput), {
  33682. size: _ctx.size,
  33683. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  33684. min: 1,
  33685. max: vue.unref(pageCount),
  33686. disabled: vue.unref(disabled),
  33687. "model-value": vue.unref(innerValue),
  33688. "validate-event": false,
  33689. label: vue.unref(t)("el.pagination.page"),
  33690. type: "number",
  33691. "onUpdate:modelValue": handleInput,
  33692. onChange: handleChange
  33693. }, null, 8, ["size", "class", "max", "disabled", "model-value", "label"]),
  33694. vue.createElementVNode("span", {
  33695. class: vue.normalizeClass([vue.unref(ns).e("classifier")])
  33696. }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3)
  33697. ], 10, _hoisted_1$m);
  33698. };
  33699. }
  33700. });
  33701. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__file", "jumper.vue"]]);
  33702. const paginationTotalProps = buildProps({
  33703. total: {
  33704. type: Number,
  33705. default: 1e3
  33706. }
  33707. });
  33708. const _hoisted_1$l = ["disabled"];
  33709. const __default__$A = vue.defineComponent({
  33710. name: "ElPaginationTotal"
  33711. });
  33712. const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
  33713. ...__default__$A,
  33714. props: paginationTotalProps,
  33715. setup(__props) {
  33716. const { t } = useLocale();
  33717. const ns = useNamespace("pagination");
  33718. const { disabled } = usePagination();
  33719. return (_ctx, _cache) => {
  33720. return vue.openBlock(), vue.createElementBlock("span", {
  33721. class: vue.normalizeClass(vue.unref(ns).e("total")),
  33722. disabled: vue.unref(disabled)
  33723. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  33724. total: _ctx.total
  33725. })), 11, _hoisted_1$l);
  33726. };
  33727. }
  33728. });
  33729. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "total.vue"]]);
  33730. const paginationPagerProps = buildProps({
  33731. currentPage: {
  33732. type: Number,
  33733. default: 1
  33734. },
  33735. pageCount: {
  33736. type: Number,
  33737. required: true
  33738. },
  33739. pagerCount: {
  33740. type: Number,
  33741. default: 7
  33742. },
  33743. disabled: Boolean
  33744. });
  33745. const _hoisted_1$k = ["onKeyup"];
  33746. const _hoisted_2$e = ["aria-current", "aria-label", "tabindex"];
  33747. const _hoisted_3$7 = ["tabindex", "aria-label"];
  33748. const _hoisted_4$5 = ["aria-current", "aria-label", "tabindex"];
  33749. const _hoisted_5$4 = ["tabindex", "aria-label"];
  33750. const _hoisted_6 = ["aria-current", "aria-label", "tabindex"];
  33751. const __default__$z = vue.defineComponent({
  33752. name: "ElPaginationPager"
  33753. });
  33754. const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
  33755. ...__default__$z,
  33756. props: paginationPagerProps,
  33757. emits: ["change"],
  33758. setup(__props, { emit }) {
  33759. const props = __props;
  33760. const nsPager = useNamespace("pager");
  33761. const nsIcon = useNamespace("icon");
  33762. const { t } = useLocale();
  33763. const showPrevMore = vue.ref(false);
  33764. const showNextMore = vue.ref(false);
  33765. const quickPrevHover = vue.ref(false);
  33766. const quickNextHover = vue.ref(false);
  33767. const quickPrevFocus = vue.ref(false);
  33768. const quickNextFocus = vue.ref(false);
  33769. const pagers = vue.computed(() => {
  33770. const pagerCount = props.pagerCount;
  33771. const halfPagerCount = (pagerCount - 1) / 2;
  33772. const currentPage = Number(props.currentPage);
  33773. const pageCount = Number(props.pageCount);
  33774. let showPrevMore2 = false;
  33775. let showNextMore2 = false;
  33776. if (pageCount > pagerCount) {
  33777. if (currentPage > pagerCount - halfPagerCount) {
  33778. showPrevMore2 = true;
  33779. }
  33780. if (currentPage < pageCount - halfPagerCount) {
  33781. showNextMore2 = true;
  33782. }
  33783. }
  33784. const array = [];
  33785. if (showPrevMore2 && !showNextMore2) {
  33786. const startPage = pageCount - (pagerCount - 2);
  33787. for (let i = startPage; i < pageCount; i++) {
  33788. array.push(i);
  33789. }
  33790. } else if (!showPrevMore2 && showNextMore2) {
  33791. for (let i = 2; i < pagerCount; i++) {
  33792. array.push(i);
  33793. }
  33794. } else if (showPrevMore2 && showNextMore2) {
  33795. const offset = Math.floor(pagerCount / 2) - 1;
  33796. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  33797. array.push(i);
  33798. }
  33799. } else {
  33800. for (let i = 2; i < pageCount; i++) {
  33801. array.push(i);
  33802. }
  33803. }
  33804. return array;
  33805. });
  33806. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  33807. vue.watchEffect(() => {
  33808. const halfPagerCount = (props.pagerCount - 1) / 2;
  33809. showPrevMore.value = false;
  33810. showNextMore.value = false;
  33811. if (props.pageCount > props.pagerCount) {
  33812. if (props.currentPage > props.pagerCount - halfPagerCount) {
  33813. showPrevMore.value = true;
  33814. }
  33815. if (props.currentPage < props.pageCount - halfPagerCount) {
  33816. showNextMore.value = true;
  33817. }
  33818. }
  33819. });
  33820. function onMouseEnter(forward = false) {
  33821. if (props.disabled)
  33822. return;
  33823. if (forward) {
  33824. quickPrevHover.value = true;
  33825. } else {
  33826. quickNextHover.value = true;
  33827. }
  33828. }
  33829. function onFocus(forward = false) {
  33830. if (forward) {
  33831. quickPrevFocus.value = true;
  33832. } else {
  33833. quickNextFocus.value = true;
  33834. }
  33835. }
  33836. function onEnter(e) {
  33837. const target = e.target;
  33838. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  33839. const newPage = Number(target.textContent);
  33840. if (newPage !== props.currentPage) {
  33841. emit("change", newPage);
  33842. }
  33843. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  33844. onPagerClick(e);
  33845. }
  33846. }
  33847. function onPagerClick(event) {
  33848. const target = event.target;
  33849. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  33850. return;
  33851. }
  33852. let newPage = Number(target.textContent);
  33853. const pageCount = props.pageCount;
  33854. const currentPage = props.currentPage;
  33855. const pagerCountOffset = props.pagerCount - 2;
  33856. if (target.className.includes("more")) {
  33857. if (target.className.includes("quickprev")) {
  33858. newPage = currentPage - pagerCountOffset;
  33859. } else if (target.className.includes("quicknext")) {
  33860. newPage = currentPage + pagerCountOffset;
  33861. }
  33862. }
  33863. if (!Number.isNaN(+newPage)) {
  33864. if (newPage < 1) {
  33865. newPage = 1;
  33866. }
  33867. if (newPage > pageCount) {
  33868. newPage = pageCount;
  33869. }
  33870. }
  33871. if (newPage !== currentPage) {
  33872. emit("change", newPage);
  33873. }
  33874. }
  33875. return (_ctx, _cache) => {
  33876. return vue.openBlock(), vue.createElementBlock("ul", {
  33877. class: vue.normalizeClass(vue.unref(nsPager).b()),
  33878. onClick: onPagerClick,
  33879. onKeyup: vue.withKeys(onEnter, ["enter"])
  33880. }, [
  33881. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  33882. key: 0,
  33883. class: vue.normalizeClass([[
  33884. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  33885. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33886. ], "number"]),
  33887. "aria-current": _ctx.currentPage === 1,
  33888. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }),
  33889. tabindex: vue.unref(tabindex)
  33890. }, " 1 ", 10, _hoisted_2$e)) : vue.createCommentVNode("v-if", true),
  33891. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  33892. key: 1,
  33893. class: vue.normalizeClass([
  33894. "more",
  33895. "btn-quickprev",
  33896. vue.unref(nsIcon).b(),
  33897. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33898. ]),
  33899. tabindex: vue.unref(tabindex),
  33900. "aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  33901. onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
  33902. onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
  33903. onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
  33904. onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
  33905. }, [
  33906. (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_left_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  33907. ], 42, _hoisted_3$7)) : vue.createCommentVNode("v-if", true),
  33908. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  33909. return vue.openBlock(), vue.createElementBlock("li", {
  33910. key: pager,
  33911. class: vue.normalizeClass([[
  33912. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  33913. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33914. ], "number"]),
  33915. "aria-current": _ctx.currentPage === pager,
  33916. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager }),
  33917. tabindex: vue.unref(tabindex)
  33918. }, vue.toDisplayString(pager), 11, _hoisted_4$5);
  33919. }), 128)),
  33920. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  33921. key: 2,
  33922. class: vue.normalizeClass([
  33923. "more",
  33924. "btn-quicknext",
  33925. vue.unref(nsIcon).b(),
  33926. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33927. ]),
  33928. tabindex: vue.unref(tabindex),
  33929. "aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  33930. onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
  33931. onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
  33932. onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
  33933. onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
  33934. }, [
  33935. (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_right_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  33936. ], 42, _hoisted_5$4)) : vue.createCommentVNode("v-if", true),
  33937. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  33938. key: 3,
  33939. class: vue.normalizeClass([[
  33940. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  33941. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33942. ], "number"]),
  33943. "aria-current": _ctx.currentPage === _ctx.pageCount,
  33944. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  33945. tabindex: vue.unref(tabindex)
  33946. }, vue.toDisplayString(_ctx.pageCount), 11, _hoisted_6)) : vue.createCommentVNode("v-if", true)
  33947. ], 42, _hoisted_1$k);
  33948. };
  33949. }
  33950. });
  33951. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "pager.vue"]]);
  33952. const isAbsent = (v) => typeof v !== "number";
  33953. const paginationProps = buildProps({
  33954. total: Number,
  33955. pageSize: Number,
  33956. defaultPageSize: Number,
  33957. currentPage: Number,
  33958. defaultCurrentPage: Number,
  33959. pageCount: Number,
  33960. pagerCount: {
  33961. type: Number,
  33962. validator: (value) => {
  33963. return isNumber$1(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  33964. },
  33965. default: 7
  33966. },
  33967. layout: {
  33968. type: String,
  33969. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  33970. },
  33971. pageSizes: {
  33972. type: definePropType(Array),
  33973. default: () => mutable([10, 20, 30, 40, 50, 100])
  33974. },
  33975. popperClass: {
  33976. type: String,
  33977. default: ""
  33978. },
  33979. prevText: {
  33980. type: String,
  33981. default: ""
  33982. },
  33983. prevIcon: {
  33984. type: iconPropType,
  33985. default: () => arrow_left_default
  33986. },
  33987. nextText: {
  33988. type: String,
  33989. default: ""
  33990. },
  33991. nextIcon: {
  33992. type: iconPropType,
  33993. default: () => arrow_right_default
  33994. },
  33995. small: Boolean,
  33996. background: Boolean,
  33997. disabled: Boolean,
  33998. hideOnSinglePage: Boolean
  33999. });
  34000. const paginationEmits = {
  34001. "update:current-page": (val) => isNumber$1(val),
  34002. "update:page-size": (val) => isNumber$1(val),
  34003. "size-change": (val) => isNumber$1(val),
  34004. "current-change": (val) => isNumber$1(val),
  34005. "prev-click": (val) => isNumber$1(val),
  34006. "next-click": (val) => isNumber$1(val)
  34007. };
  34008. const componentName = "ElPagination";
  34009. var Pagination = vue.defineComponent({
  34010. name: componentName,
  34011. props: paginationProps,
  34012. emits: paginationEmits,
  34013. setup(props, { emit, slots }) {
  34014. const { t } = useLocale();
  34015. const ns = useNamespace("pagination");
  34016. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  34017. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  34018. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  34019. const assertValidUsage = vue.computed(() => {
  34020. if (isAbsent(props.total) && isAbsent(props.pageCount))
  34021. return false;
  34022. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  34023. return false;
  34024. if (props.layout.includes("sizes")) {
  34025. if (!isAbsent(props.pageCount)) {
  34026. if (!hasPageSizeListener)
  34027. return false;
  34028. } else if (!isAbsent(props.total)) {
  34029. if (!isAbsent(props.pageSize)) {
  34030. if (!hasPageSizeListener) {
  34031. return false;
  34032. }
  34033. }
  34034. }
  34035. }
  34036. return true;
  34037. });
  34038. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  34039. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  34040. const pageSizeBridge = vue.computed({
  34041. get() {
  34042. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  34043. },
  34044. set(v) {
  34045. if (isAbsent(props.pageSize)) {
  34046. innerPageSize.value = v;
  34047. }
  34048. if (hasPageSizeListener) {
  34049. emit("update:page-size", v);
  34050. emit("size-change", v);
  34051. }
  34052. }
  34053. });
  34054. const pageCountBridge = vue.computed(() => {
  34055. let pageCount = 0;
  34056. if (!isAbsent(props.pageCount)) {
  34057. pageCount = props.pageCount;
  34058. } else if (!isAbsent(props.total)) {
  34059. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  34060. }
  34061. return pageCount;
  34062. });
  34063. const currentPageBridge = vue.computed({
  34064. get() {
  34065. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  34066. },
  34067. set(v) {
  34068. let newCurrentPage = v;
  34069. if (v < 1) {
  34070. newCurrentPage = 1;
  34071. } else if (v > pageCountBridge.value) {
  34072. newCurrentPage = pageCountBridge.value;
  34073. }
  34074. if (isAbsent(props.currentPage)) {
  34075. innerCurrentPage.value = newCurrentPage;
  34076. }
  34077. if (hasCurrentPageListener) {
  34078. emit("update:current-page", newCurrentPage);
  34079. emit("current-change", newCurrentPage);
  34080. }
  34081. }
  34082. });
  34083. vue.watch(pageCountBridge, (val) => {
  34084. if (currentPageBridge.value > val)
  34085. currentPageBridge.value = val;
  34086. });
  34087. function handleCurrentChange(val) {
  34088. currentPageBridge.value = val;
  34089. }
  34090. function handleSizeChange(val) {
  34091. pageSizeBridge.value = val;
  34092. const newPageCount = pageCountBridge.value;
  34093. if (currentPageBridge.value > newPageCount) {
  34094. currentPageBridge.value = newPageCount;
  34095. }
  34096. }
  34097. function prev() {
  34098. if (props.disabled)
  34099. return;
  34100. currentPageBridge.value -= 1;
  34101. emit("prev-click", currentPageBridge.value);
  34102. }
  34103. function next() {
  34104. if (props.disabled)
  34105. return;
  34106. currentPageBridge.value += 1;
  34107. emit("next-click", currentPageBridge.value);
  34108. }
  34109. function addClass(element, cls) {
  34110. if (element) {
  34111. if (!element.props) {
  34112. element.props = {};
  34113. }
  34114. element.props.class = [element.props.class, cls].join(" ");
  34115. }
  34116. }
  34117. vue.provide(elPaginationKey, {
  34118. pageCount: pageCountBridge,
  34119. disabled: vue.computed(() => props.disabled),
  34120. currentPage: currentPageBridge,
  34121. changeEvent: handleCurrentChange,
  34122. handleSizeChange
  34123. });
  34124. return () => {
  34125. var _a, _b;
  34126. if (!assertValidUsage.value) {
  34127. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  34128. return null;
  34129. }
  34130. if (!props.layout)
  34131. return null;
  34132. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  34133. return null;
  34134. const rootChildren = [];
  34135. const rightWrapperChildren = [];
  34136. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  34137. const TEMPLATE_MAP = {
  34138. prev: vue.h(Prev, {
  34139. disabled: props.disabled,
  34140. currentPage: currentPageBridge.value,
  34141. prevText: props.prevText,
  34142. prevIcon: props.prevIcon,
  34143. onClick: prev
  34144. }),
  34145. jumper: vue.h(Jumper, {
  34146. size: props.small ? "small" : "default"
  34147. }),
  34148. pager: vue.h(Pager, {
  34149. currentPage: currentPageBridge.value,
  34150. pageCount: pageCountBridge.value,
  34151. pagerCount: props.pagerCount,
  34152. onChange: handleCurrentChange,
  34153. disabled: props.disabled
  34154. }),
  34155. next: vue.h(Next, {
  34156. disabled: props.disabled,
  34157. currentPage: currentPageBridge.value,
  34158. pageCount: pageCountBridge.value,
  34159. nextText: props.nextText,
  34160. nextIcon: props.nextIcon,
  34161. onClick: next
  34162. }),
  34163. sizes: vue.h(Sizes, {
  34164. pageSize: pageSizeBridge.value,
  34165. pageSizes: props.pageSizes,
  34166. popperClass: props.popperClass,
  34167. disabled: props.disabled,
  34168. size: props.small ? "small" : "default"
  34169. }),
  34170. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  34171. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  34172. };
  34173. const components = props.layout.split(",").map((item) => item.trim());
  34174. let haveRightWrapper = false;
  34175. components.forEach((c) => {
  34176. if (c === "->") {
  34177. haveRightWrapper = true;
  34178. return;
  34179. }
  34180. if (!haveRightWrapper) {
  34181. rootChildren.push(TEMPLATE_MAP[c]);
  34182. } else {
  34183. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  34184. }
  34185. });
  34186. addClass(rootChildren[0], ns.is("first"));
  34187. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  34188. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  34189. addClass(rightWrapperChildren[0], ns.is("first"));
  34190. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  34191. rootChildren.push(rightWrapperRoot);
  34192. }
  34193. return vue.h("div", {
  34194. class: [
  34195. ns.b(),
  34196. ns.is("background", props.background),
  34197. {
  34198. [ns.m("small")]: props.small
  34199. }
  34200. ]
  34201. }, rootChildren);
  34202. };
  34203. }
  34204. });
  34205. const ElPagination = withInstall(Pagination);
  34206. const popconfirmProps = buildProps({
  34207. title: String,
  34208. confirmButtonText: String,
  34209. cancelButtonText: String,
  34210. confirmButtonType: {
  34211. type: String,
  34212. values: buttonTypes,
  34213. default: "primary"
  34214. },
  34215. cancelButtonType: {
  34216. type: String,
  34217. values: buttonTypes,
  34218. default: "text"
  34219. },
  34220. icon: {
  34221. type: iconPropType,
  34222. default: () => question_filled_default
  34223. },
  34224. iconColor: {
  34225. type: String,
  34226. default: "#f90"
  34227. },
  34228. hideIcon: {
  34229. type: Boolean,
  34230. default: false
  34231. },
  34232. hideAfter: {
  34233. type: Number,
  34234. default: 200
  34235. },
  34236. teleported: useTooltipContentProps.teleported,
  34237. persistent: useTooltipContentProps.persistent,
  34238. width: {
  34239. type: [String, Number],
  34240. default: 150
  34241. }
  34242. });
  34243. const popconfirmEmits = {
  34244. confirm: (e) => e instanceof MouseEvent,
  34245. cancel: (e) => e instanceof MouseEvent
  34246. };
  34247. const __default__$y = vue.defineComponent({
  34248. name: "ElPopconfirm"
  34249. });
  34250. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  34251. ...__default__$y,
  34252. props: popconfirmProps,
  34253. emits: popconfirmEmits,
  34254. setup(__props, { emit }) {
  34255. const props = __props;
  34256. const { t } = useLocale();
  34257. const ns = useNamespace("popconfirm");
  34258. const tooltipRef = vue.ref();
  34259. const hidePopper = () => {
  34260. var _a, _b;
  34261. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  34262. };
  34263. const style = vue.computed(() => {
  34264. return {
  34265. width: addUnit(props.width)
  34266. };
  34267. });
  34268. const confirm = (e) => {
  34269. emit("confirm", e);
  34270. hidePopper();
  34271. };
  34272. const cancel = (e) => {
  34273. emit("cancel", e);
  34274. hidePopper();
  34275. };
  34276. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  34277. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  34278. return (_ctx, _cache) => {
  34279. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  34280. ref_key: "tooltipRef",
  34281. ref: tooltipRef,
  34282. trigger: "click",
  34283. effect: "light"
  34284. }, _ctx.$attrs, {
  34285. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  34286. "popper-style": vue.unref(style),
  34287. teleported: _ctx.teleported,
  34288. "fallback-placements": ["bottom", "top", "right", "left"],
  34289. "hide-after": _ctx.hideAfter,
  34290. persistent: _ctx.persistent
  34291. }), {
  34292. content: vue.withCtx(() => [
  34293. vue.createElementVNode("div", {
  34294. class: vue.normalizeClass(vue.unref(ns).b())
  34295. }, [
  34296. vue.createElementVNode("div", {
  34297. class: vue.normalizeClass(vue.unref(ns).e("main"))
  34298. }, [
  34299. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  34300. key: 0,
  34301. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  34302. style: vue.normalizeStyle({ color: _ctx.iconColor })
  34303. }, {
  34304. default: vue.withCtx(() => [
  34305. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  34306. ]),
  34307. _: 1
  34308. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  34309. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  34310. ], 2),
  34311. vue.createElementVNode("div", {
  34312. class: vue.normalizeClass(vue.unref(ns).e("action"))
  34313. }, [
  34314. vue.createVNode(vue.unref(ElButton), {
  34315. size: "small",
  34316. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  34317. text: _ctx.cancelButtonType === "text",
  34318. onClick: cancel
  34319. }, {
  34320. default: vue.withCtx(() => [
  34321. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  34322. ]),
  34323. _: 1
  34324. }, 8, ["type", "text"]),
  34325. vue.createVNode(vue.unref(ElButton), {
  34326. size: "small",
  34327. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  34328. text: _ctx.confirmButtonType === "text",
  34329. onClick: confirm
  34330. }, {
  34331. default: vue.withCtx(() => [
  34332. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  34333. ]),
  34334. _: 1
  34335. }, 8, ["type", "text"])
  34336. ], 2)
  34337. ], 2)
  34338. ]),
  34339. default: vue.withCtx(() => [
  34340. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  34341. ]),
  34342. _: 3
  34343. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  34344. };
  34345. }
  34346. });
  34347. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "popconfirm.vue"]]);
  34348. const ElPopconfirm = withInstall(Popconfirm);
  34349. const popoverProps = buildProps({
  34350. trigger: useTooltipTriggerProps.trigger,
  34351. placement: dropdownProps.placement,
  34352. disabled: useTooltipTriggerProps.disabled,
  34353. visible: useTooltipContentProps.visible,
  34354. transition: useTooltipContentProps.transition,
  34355. popperOptions: dropdownProps.popperOptions,
  34356. tabindex: dropdownProps.tabindex,
  34357. content: useTooltipContentProps.content,
  34358. popperStyle: useTooltipContentProps.popperStyle,
  34359. popperClass: useTooltipContentProps.popperClass,
  34360. enterable: {
  34361. ...useTooltipContentProps.enterable,
  34362. default: true
  34363. },
  34364. effect: {
  34365. ...useTooltipContentProps.effect,
  34366. default: "light"
  34367. },
  34368. teleported: useTooltipContentProps.teleported,
  34369. title: String,
  34370. width: {
  34371. type: [String, Number],
  34372. default: 150
  34373. },
  34374. offset: {
  34375. type: Number,
  34376. default: void 0
  34377. },
  34378. showAfter: {
  34379. type: Number,
  34380. default: 0
  34381. },
  34382. hideAfter: {
  34383. type: Number,
  34384. default: 200
  34385. },
  34386. autoClose: {
  34387. type: Number,
  34388. default: 0
  34389. },
  34390. showArrow: {
  34391. type: Boolean,
  34392. default: true
  34393. },
  34394. persistent: {
  34395. type: Boolean,
  34396. default: true
  34397. },
  34398. "onUpdate:visible": {
  34399. type: Function
  34400. }
  34401. });
  34402. const popoverEmits = {
  34403. "update:visible": (value) => isBoolean$1(value),
  34404. "before-enter": () => true,
  34405. "before-leave": () => true,
  34406. "after-enter": () => true,
  34407. "after-leave": () => true
  34408. };
  34409. const updateEventKeyRaw = `onUpdate:visible`;
  34410. const __default__$x = vue.defineComponent({
  34411. name: "ElPopover"
  34412. });
  34413. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  34414. ...__default__$x,
  34415. props: popoverProps,
  34416. emits: popoverEmits,
  34417. setup(__props, { expose, emit }) {
  34418. const props = __props;
  34419. const onUpdateVisible = vue.computed(() => {
  34420. return props[updateEventKeyRaw];
  34421. });
  34422. const ns = useNamespace("popover");
  34423. const tooltipRef = vue.ref();
  34424. const popperRef = vue.computed(() => {
  34425. var _a;
  34426. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  34427. });
  34428. const style = vue.computed(() => {
  34429. return [
  34430. {
  34431. width: addUnit(props.width)
  34432. },
  34433. props.popperStyle
  34434. ];
  34435. });
  34436. const kls = vue.computed(() => {
  34437. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  34438. });
  34439. const gpuAcceleration = vue.computed(() => {
  34440. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  34441. });
  34442. const hide = () => {
  34443. var _a;
  34444. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  34445. };
  34446. const beforeEnter = () => {
  34447. emit("before-enter");
  34448. };
  34449. const beforeLeave = () => {
  34450. emit("before-leave");
  34451. };
  34452. const afterEnter = () => {
  34453. emit("after-enter");
  34454. };
  34455. const afterLeave = () => {
  34456. emit("update:visible", false);
  34457. emit("after-leave");
  34458. };
  34459. expose({
  34460. popperRef,
  34461. hide
  34462. });
  34463. return (_ctx, _cache) => {
  34464. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  34465. ref_key: "tooltipRef",
  34466. ref: tooltipRef
  34467. }, _ctx.$attrs, {
  34468. trigger: _ctx.trigger,
  34469. placement: _ctx.placement,
  34470. disabled: _ctx.disabled,
  34471. visible: _ctx.visible,
  34472. transition: _ctx.transition,
  34473. "popper-options": _ctx.popperOptions,
  34474. tabindex: _ctx.tabindex,
  34475. content: _ctx.content,
  34476. offset: _ctx.offset,
  34477. "show-after": _ctx.showAfter,
  34478. "hide-after": _ctx.hideAfter,
  34479. "auto-close": _ctx.autoClose,
  34480. "show-arrow": _ctx.showArrow,
  34481. "aria-label": _ctx.title,
  34482. effect: _ctx.effect,
  34483. enterable: _ctx.enterable,
  34484. "popper-class": vue.unref(kls),
  34485. "popper-style": vue.unref(style),
  34486. teleported: _ctx.teleported,
  34487. persistent: _ctx.persistent,
  34488. "gpu-acceleration": vue.unref(gpuAcceleration),
  34489. "onUpdate:visible": vue.unref(onUpdateVisible),
  34490. onBeforeShow: beforeEnter,
  34491. onBeforeHide: beforeLeave,
  34492. onShow: afterEnter,
  34493. onHide: afterLeave
  34494. }), {
  34495. content: vue.withCtx(() => [
  34496. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  34497. key: 0,
  34498. class: vue.normalizeClass(vue.unref(ns).e("title")),
  34499. role: "title"
  34500. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  34501. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  34502. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  34503. ])
  34504. ]),
  34505. default: vue.withCtx(() => [
  34506. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  34507. ]),
  34508. _: 3
  34509. }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  34510. };
  34511. }
  34512. });
  34513. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "popover.vue"]]);
  34514. const attachEvents = (el, binding) => {
  34515. const popperComponent = binding.arg || binding.value;
  34516. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  34517. if (popover) {
  34518. popover.triggerRef = el;
  34519. }
  34520. };
  34521. var PopoverDirective = {
  34522. mounted(el, binding) {
  34523. attachEvents(el, binding);
  34524. },
  34525. updated(el, binding) {
  34526. attachEvents(el, binding);
  34527. }
  34528. };
  34529. const VPopover = "popover";
  34530. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  34531. const ElPopover = withInstall(Popover, {
  34532. directive: ElPopoverDirective
  34533. });
  34534. const progressProps = buildProps({
  34535. type: {
  34536. type: String,
  34537. default: "line",
  34538. values: ["line", "circle", "dashboard"]
  34539. },
  34540. percentage: {
  34541. type: Number,
  34542. default: 0,
  34543. validator: (val) => val >= 0 && val <= 100
  34544. },
  34545. status: {
  34546. type: String,
  34547. default: "",
  34548. values: ["", "success", "exception", "warning"]
  34549. },
  34550. indeterminate: {
  34551. type: Boolean,
  34552. default: false
  34553. },
  34554. duration: {
  34555. type: Number,
  34556. default: 3
  34557. },
  34558. strokeWidth: {
  34559. type: Number,
  34560. default: 6
  34561. },
  34562. strokeLinecap: {
  34563. type: definePropType(String),
  34564. default: "round"
  34565. },
  34566. textInside: {
  34567. type: Boolean,
  34568. default: false
  34569. },
  34570. width: {
  34571. type: Number,
  34572. default: 126
  34573. },
  34574. showText: {
  34575. type: Boolean,
  34576. default: true
  34577. },
  34578. color: {
  34579. type: definePropType([
  34580. String,
  34581. Array,
  34582. Function
  34583. ]),
  34584. default: ""
  34585. },
  34586. format: {
  34587. type: definePropType(Function),
  34588. default: (percentage) => `${percentage}%`
  34589. }
  34590. });
  34591. const _hoisted_1$j = ["aria-valuenow"];
  34592. const _hoisted_2$d = { viewBox: "0 0 100 100" };
  34593. const _hoisted_3$6 = ["d", "stroke", "stroke-width"];
  34594. const _hoisted_4$4 = ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"];
  34595. const _hoisted_5$3 = { key: 0 };
  34596. const __default__$w = vue.defineComponent({
  34597. name: "ElProgress"
  34598. });
  34599. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  34600. ...__default__$w,
  34601. props: progressProps,
  34602. setup(__props) {
  34603. const props = __props;
  34604. const STATUS_COLOR_MAP = {
  34605. success: "#13ce66",
  34606. exception: "#ff4949",
  34607. warning: "#e6a23c",
  34608. default: "#20a0ff"
  34609. };
  34610. const ns = useNamespace("progress");
  34611. const barStyle = vue.computed(() => ({
  34612. width: `${props.percentage}%`,
  34613. animationDuration: `${props.duration}s`,
  34614. backgroundColor: getCurrentColor(props.percentage)
  34615. }));
  34616. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  34617. const radius = vue.computed(() => {
  34618. if (["circle", "dashboard"].includes(props.type)) {
  34619. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  34620. }
  34621. return 0;
  34622. });
  34623. const trackPath = vue.computed(() => {
  34624. const r = radius.value;
  34625. const isDashboard = props.type === "dashboard";
  34626. return `
  34627. M 50 50
  34628. m 0 ${isDashboard ? "" : "-"}${r}
  34629. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  34630. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  34631. `;
  34632. });
  34633. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  34634. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  34635. const strokeDashoffset = vue.computed(() => {
  34636. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  34637. return `${offset}px`;
  34638. });
  34639. const trailPathStyle = vue.computed(() => ({
  34640. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  34641. strokeDashoffset: strokeDashoffset.value
  34642. }));
  34643. const circlePathStyle = vue.computed(() => ({
  34644. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  34645. strokeDashoffset: strokeDashoffset.value,
  34646. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  34647. }));
  34648. const stroke = vue.computed(() => {
  34649. let ret;
  34650. if (props.color) {
  34651. ret = getCurrentColor(props.percentage);
  34652. } else {
  34653. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  34654. }
  34655. return ret;
  34656. });
  34657. const statusIcon = vue.computed(() => {
  34658. if (props.status === "warning") {
  34659. return warning_filled_default;
  34660. }
  34661. if (props.type === "line") {
  34662. return props.status === "success" ? circle_check_default : circle_close_default;
  34663. } else {
  34664. return props.status === "success" ? check_default : close_default;
  34665. }
  34666. });
  34667. const progressTextSize = vue.computed(() => {
  34668. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  34669. });
  34670. const content = vue.computed(() => props.format(props.percentage));
  34671. function getColors(color) {
  34672. const span = 100 / color.length;
  34673. const seriesColors = color.map((seriesColor, index) => {
  34674. if (isString$1(seriesColor)) {
  34675. return {
  34676. color: seriesColor,
  34677. percentage: (index + 1) * span
  34678. };
  34679. }
  34680. return seriesColor;
  34681. });
  34682. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  34683. }
  34684. const getCurrentColor = (percentage) => {
  34685. var _a;
  34686. const { color } = props;
  34687. if (isFunction$1(color)) {
  34688. return color(percentage);
  34689. } else if (isString$1(color)) {
  34690. return color;
  34691. } else {
  34692. const colors = getColors(color);
  34693. for (const color2 of colors) {
  34694. if (color2.percentage > percentage)
  34695. return color2.color;
  34696. }
  34697. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  34698. }
  34699. };
  34700. return (_ctx, _cache) => {
  34701. return vue.openBlock(), vue.createElementBlock("div", {
  34702. class: vue.normalizeClass([
  34703. vue.unref(ns).b(),
  34704. vue.unref(ns).m(_ctx.type),
  34705. vue.unref(ns).is(_ctx.status),
  34706. {
  34707. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  34708. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  34709. }
  34710. ]),
  34711. role: "progressbar",
  34712. "aria-valuenow": _ctx.percentage,
  34713. "aria-valuemin": "0",
  34714. "aria-valuemax": "100"
  34715. }, [
  34716. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  34717. key: 0,
  34718. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  34719. }, [
  34720. vue.createElementVNode("div", {
  34721. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  34722. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  34723. }, [
  34724. vue.createElementVNode("div", {
  34725. class: vue.normalizeClass([
  34726. vue.unref(ns).be("bar", "inner"),
  34727. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  34728. ]),
  34729. style: vue.normalizeStyle(vue.unref(barStyle))
  34730. }, [
  34731. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  34732. key: 0,
  34733. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  34734. }, [
  34735. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  34736. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  34737. ])
  34738. ], 2)) : vue.createCommentVNode("v-if", true)
  34739. ], 6)
  34740. ], 6)
  34741. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  34742. key: 1,
  34743. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  34744. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  34745. }, [
  34746. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$d, [
  34747. vue.createElementVNode("path", {
  34748. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  34749. d: vue.unref(trackPath),
  34750. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  34751. "stroke-width": vue.unref(relativeStrokeWidth),
  34752. fill: "none",
  34753. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  34754. }, null, 14, _hoisted_3$6),
  34755. vue.createElementVNode("path", {
  34756. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  34757. d: vue.unref(trackPath),
  34758. stroke: vue.unref(stroke),
  34759. fill: "none",
  34760. opacity: _ctx.percentage ? 1 : 0,
  34761. "stroke-linecap": _ctx.strokeLinecap,
  34762. "stroke-width": vue.unref(relativeStrokeWidth),
  34763. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  34764. }, null, 14, _hoisted_4$4)
  34765. ]))
  34766. ], 6)),
  34767. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  34768. key: 2,
  34769. class: vue.normalizeClass(vue.unref(ns).e("text")),
  34770. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  34771. }, [
  34772. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  34773. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$3, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  34774. default: vue.withCtx(() => [
  34775. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  34776. ]),
  34777. _: 1
  34778. }))
  34779. ])
  34780. ], 6)) : vue.createCommentVNode("v-if", true)
  34781. ], 10, _hoisted_1$j);
  34782. };
  34783. }
  34784. });
  34785. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "progress.vue"]]);
  34786. const ElProgress = withInstall(Progress);
  34787. const rateProps = buildProps({
  34788. modelValue: {
  34789. type: Number,
  34790. default: 0
  34791. },
  34792. id: {
  34793. type: String,
  34794. default: void 0
  34795. },
  34796. lowThreshold: {
  34797. type: Number,
  34798. default: 2
  34799. },
  34800. highThreshold: {
  34801. type: Number,
  34802. default: 4
  34803. },
  34804. max: {
  34805. type: Number,
  34806. default: 5
  34807. },
  34808. colors: {
  34809. type: definePropType([Array, Object]),
  34810. default: () => mutable(["", "", ""])
  34811. },
  34812. voidColor: {
  34813. type: String,
  34814. default: ""
  34815. },
  34816. disabledVoidColor: {
  34817. type: String,
  34818. default: ""
  34819. },
  34820. icons: {
  34821. type: definePropType([Array, Object]),
  34822. default: () => [star_filled_default, star_filled_default, star_filled_default]
  34823. },
  34824. voidIcon: {
  34825. type: iconPropType,
  34826. default: () => star_default
  34827. },
  34828. disabledVoidIcon: {
  34829. type: iconPropType,
  34830. default: () => star_filled_default
  34831. },
  34832. disabled: Boolean,
  34833. allowHalf: Boolean,
  34834. showText: Boolean,
  34835. showScore: Boolean,
  34836. textColor: {
  34837. type: String,
  34838. default: ""
  34839. },
  34840. texts: {
  34841. type: definePropType(Array),
  34842. default: () => mutable([
  34843. "Extremely bad",
  34844. "Disappointed",
  34845. "Fair",
  34846. "Satisfied",
  34847. "Surprise"
  34848. ])
  34849. },
  34850. scoreTemplate: {
  34851. type: String,
  34852. default: "{value}"
  34853. },
  34854. size: useSizeProp,
  34855. label: {
  34856. type: String,
  34857. default: void 0
  34858. },
  34859. clearable: {
  34860. type: Boolean,
  34861. default: false
  34862. }
  34863. });
  34864. const rateEmits = {
  34865. [CHANGE_EVENT]: (value) => isNumber$1(value),
  34866. [UPDATE_MODEL_EVENT]: (value) => isNumber$1(value)
  34867. };
  34868. const _hoisted_1$i = ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"];
  34869. const _hoisted_2$c = ["onMousemove", "onClick"];
  34870. const __default__$v = vue.defineComponent({
  34871. name: "ElRate"
  34872. });
  34873. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  34874. ...__default__$v,
  34875. props: rateProps,
  34876. emits: rateEmits,
  34877. setup(__props, { expose, emit }) {
  34878. const props = __props;
  34879. function getValueFromMap(value, map) {
  34880. const isExcludedObject = (val) => isObject$1(val);
  34881. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  34882. const val = map[key];
  34883. const excluded = isExcludedObject(val) ? val.excluded : false;
  34884. return excluded ? value < key : value <= key;
  34885. }).sort((a, b) => a - b);
  34886. const matchedValue = map[matchedKeys[0]];
  34887. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  34888. }
  34889. const formContext = vue.inject(formContextKey, void 0);
  34890. const formItemContext = vue.inject(formItemContextKey, void 0);
  34891. const rateSize = useFormSize();
  34892. const ns = useNamespace("rate");
  34893. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  34894. formItemContext
  34895. });
  34896. const currentValue = vue.ref(props.modelValue);
  34897. const hoverIndex = vue.ref(-1);
  34898. const pointerAtLeftHalf = vue.ref(true);
  34899. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  34900. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  34901. const rateStyles = vue.computed(() => {
  34902. return ns.cssVarBlock({
  34903. "void-color": props.voidColor,
  34904. "disabled-void-color": props.disabledVoidColor,
  34905. "fill-color": activeColor.value
  34906. });
  34907. });
  34908. const text = vue.computed(() => {
  34909. let result = "";
  34910. if (props.showScore) {
  34911. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  34912. } else if (props.showText) {
  34913. result = props.texts[Math.ceil(currentValue.value) - 1];
  34914. }
  34915. return result;
  34916. });
  34917. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  34918. const colorMap = vue.computed(() => isArray$1(props.colors) ? {
  34919. [props.lowThreshold]: props.colors[0],
  34920. [props.highThreshold]: { value: props.colors[1], excluded: true },
  34921. [props.max]: props.colors[2]
  34922. } : props.colors);
  34923. const activeColor = vue.computed(() => {
  34924. const color = getValueFromMap(currentValue.value, colorMap.value);
  34925. return isObject$1(color) ? "" : color;
  34926. });
  34927. const decimalStyle = vue.computed(() => {
  34928. let width = "";
  34929. if (rateDisabled.value) {
  34930. width = `${valueDecimal.value}%`;
  34931. } else if (props.allowHalf) {
  34932. width = "50%";
  34933. }
  34934. return {
  34935. color: activeColor.value,
  34936. width
  34937. };
  34938. });
  34939. const componentMap = vue.computed(() => {
  34940. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  34941. icons = vue.markRaw(icons);
  34942. return isArray$1(icons) ? {
  34943. [props.lowThreshold]: icons[0],
  34944. [props.highThreshold]: {
  34945. value: icons[1],
  34946. excluded: true
  34947. },
  34948. [props.max]: icons[2]
  34949. } : icons;
  34950. });
  34951. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  34952. const voidComponent = vue.computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : vue.markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : vue.markRaw(props.voidIcon));
  34953. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  34954. function showDecimalIcon(item) {
  34955. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  34956. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  34957. return showWhenDisabled || showWhenAllowHalf;
  34958. }
  34959. function emitValue(value) {
  34960. if (props.clearable && value === props.modelValue) {
  34961. value = 0;
  34962. }
  34963. emit(UPDATE_MODEL_EVENT, value);
  34964. if (props.modelValue !== value) {
  34965. emit("change", value);
  34966. }
  34967. }
  34968. function selectValue(value) {
  34969. if (rateDisabled.value) {
  34970. return;
  34971. }
  34972. if (props.allowHalf && pointerAtLeftHalf.value) {
  34973. emitValue(currentValue.value);
  34974. } else {
  34975. emitValue(value);
  34976. }
  34977. }
  34978. function handleKey(e) {
  34979. if (rateDisabled.value) {
  34980. return;
  34981. }
  34982. let _currentValue = currentValue.value;
  34983. const code = e.code;
  34984. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  34985. if (props.allowHalf) {
  34986. _currentValue += 0.5;
  34987. } else {
  34988. _currentValue += 1;
  34989. }
  34990. e.stopPropagation();
  34991. e.preventDefault();
  34992. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  34993. if (props.allowHalf) {
  34994. _currentValue -= 0.5;
  34995. } else {
  34996. _currentValue -= 1;
  34997. }
  34998. e.stopPropagation();
  34999. e.preventDefault();
  35000. }
  35001. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  35002. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  35003. emit(UPDATE_MODEL_EVENT, _currentValue);
  35004. emit("change", _currentValue);
  35005. return _currentValue;
  35006. }
  35007. function setCurrentValue(value, event) {
  35008. if (rateDisabled.value) {
  35009. return;
  35010. }
  35011. if (props.allowHalf && event) {
  35012. let target = event.target;
  35013. if (hasClass(target, ns.e("item"))) {
  35014. target = target.querySelector(`.${ns.e("icon")}`);
  35015. }
  35016. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  35017. target = target.parentNode;
  35018. }
  35019. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  35020. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  35021. } else {
  35022. currentValue.value = value;
  35023. }
  35024. hoverIndex.value = value;
  35025. }
  35026. function resetCurrentValue() {
  35027. if (rateDisabled.value) {
  35028. return;
  35029. }
  35030. if (props.allowHalf) {
  35031. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  35032. }
  35033. currentValue.value = props.modelValue;
  35034. hoverIndex.value = -1;
  35035. }
  35036. vue.watch(() => props.modelValue, (val) => {
  35037. currentValue.value = val;
  35038. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  35039. });
  35040. if (!props.modelValue) {
  35041. emit(UPDATE_MODEL_EVENT, 0);
  35042. }
  35043. expose({
  35044. setCurrentValue,
  35045. resetCurrentValue
  35046. });
  35047. return (_ctx, _cache) => {
  35048. var _a;
  35049. return vue.openBlock(), vue.createElementBlock("div", {
  35050. id: vue.unref(inputId),
  35051. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  35052. role: "slider",
  35053. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "rating" : void 0,
  35054. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  35055. "aria-valuenow": currentValue.value,
  35056. "aria-valuetext": vue.unref(text) || void 0,
  35057. "aria-valuemin": "0",
  35058. "aria-valuemax": _ctx.max,
  35059. tabindex: "0",
  35060. style: vue.normalizeStyle(vue.unref(rateStyles)),
  35061. onKeydown: handleKey
  35062. }, [
  35063. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  35064. return vue.openBlock(), vue.createElementBlock("span", {
  35065. key,
  35066. class: vue.normalizeClass(vue.unref(ns).e("item")),
  35067. onMousemove: ($event) => setCurrentValue(item, $event),
  35068. onMouseleave: resetCurrentValue,
  35069. onClick: ($event) => selectValue(item)
  35070. }, [
  35071. vue.createVNode(vue.unref(ElIcon), {
  35072. class: vue.normalizeClass([
  35073. vue.unref(ns).e("icon"),
  35074. { hover: hoverIndex.value === item },
  35075. vue.unref(ns).is("active", item <= currentValue.value)
  35076. ])
  35077. }, {
  35078. default: vue.withCtx(() => [
  35079. !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  35080. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  35081. [vue.vShow, item <= currentValue.value]
  35082. ]),
  35083. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  35084. [vue.vShow, !(item <= currentValue.value)]
  35085. ])
  35086. ], 64)) : vue.createCommentVNode("v-if", true),
  35087. showDecimalIcon(item) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  35088. key: 1,
  35089. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  35090. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  35091. }, {
  35092. default: vue.withCtx(() => [
  35093. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  35094. ]),
  35095. _: 1
  35096. }, 8, ["style", "class"])) : vue.createCommentVNode("v-if", true)
  35097. ]),
  35098. _: 2
  35099. }, 1032, ["class"])
  35100. ], 42, _hoisted_2$c);
  35101. }), 128)),
  35102. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  35103. key: 0,
  35104. class: vue.normalizeClass(vue.unref(ns).e("text"))
  35105. }, vue.toDisplayString(vue.unref(text)), 3)) : vue.createCommentVNode("v-if", true)
  35106. ], 46, _hoisted_1$i);
  35107. };
  35108. }
  35109. });
  35110. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "rate.vue"]]);
  35111. const ElRate = withInstall(Rate);
  35112. const IconMap = {
  35113. success: "icon-success",
  35114. warning: "icon-warning",
  35115. error: "icon-error",
  35116. info: "icon-info"
  35117. };
  35118. const IconComponentMap = {
  35119. [IconMap.success]: circle_check_filled_default,
  35120. [IconMap.warning]: warning_filled_default,
  35121. [IconMap.error]: circle_close_filled_default,
  35122. [IconMap.info]: info_filled_default
  35123. };
  35124. const resultProps = buildProps({
  35125. title: {
  35126. type: String,
  35127. default: ""
  35128. },
  35129. subTitle: {
  35130. type: String,
  35131. default: ""
  35132. },
  35133. icon: {
  35134. type: String,
  35135. values: ["success", "warning", "info", "error"],
  35136. default: "info"
  35137. }
  35138. });
  35139. const __default__$u = vue.defineComponent({
  35140. name: "ElResult"
  35141. });
  35142. const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
  35143. ...__default__$u,
  35144. props: resultProps,
  35145. setup(__props) {
  35146. const props = __props;
  35147. const ns = useNamespace("result");
  35148. const resultIcon = vue.computed(() => {
  35149. const icon = props.icon;
  35150. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  35151. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  35152. return {
  35153. class: iconClass,
  35154. component: iconComponent
  35155. };
  35156. });
  35157. return (_ctx, _cache) => {
  35158. return vue.openBlock(), vue.createElementBlock("div", {
  35159. class: vue.normalizeClass(vue.unref(ns).b())
  35160. }, [
  35161. vue.createElementVNode("div", {
  35162. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  35163. }, [
  35164. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  35165. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  35166. key: 0,
  35167. class: vue.normalizeClass(vue.unref(resultIcon).class)
  35168. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  35169. ])
  35170. ], 2),
  35171. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  35172. key: 0,
  35173. class: vue.normalizeClass(vue.unref(ns).e("title"))
  35174. }, [
  35175. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  35176. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  35177. ])
  35178. ], 2)) : vue.createCommentVNode("v-if", true),
  35179. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  35180. key: 1,
  35181. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  35182. }, [
  35183. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  35184. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  35185. ])
  35186. ], 2)) : vue.createCommentVNode("v-if", true),
  35187. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  35188. key: 2,
  35189. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  35190. }, [
  35191. vue.renderSlot(_ctx.$slots, "extra")
  35192. ], 2)) : vue.createCommentVNode("v-if", true)
  35193. ], 2);
  35194. };
  35195. }
  35196. });
  35197. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "result.vue"]]);
  35198. const ElResult = withInstall(Result);
  35199. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  35200. return typeof value === "number" && value !== value;
  35201. };
  35202. function isEqual(first, second) {
  35203. if (first === second) {
  35204. return true;
  35205. }
  35206. if (safeIsNaN(first) && safeIsNaN(second)) {
  35207. return true;
  35208. }
  35209. return false;
  35210. }
  35211. function areInputsEqual(newInputs, lastInputs) {
  35212. if (newInputs.length !== lastInputs.length) {
  35213. return false;
  35214. }
  35215. for (var i = 0; i < newInputs.length; i++) {
  35216. if (!isEqual(newInputs[i], lastInputs[i])) {
  35217. return false;
  35218. }
  35219. }
  35220. return true;
  35221. }
  35222. function memoizeOne(resultFn, isEqual2) {
  35223. if (isEqual2 === void 0) {
  35224. isEqual2 = areInputsEqual;
  35225. }
  35226. var cache = null;
  35227. function memoized() {
  35228. var newArgs = [];
  35229. for (var _i = 0; _i < arguments.length; _i++) {
  35230. newArgs[_i] = arguments[_i];
  35231. }
  35232. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  35233. return cache.lastResult;
  35234. }
  35235. var lastResult = resultFn.apply(this, newArgs);
  35236. cache = {
  35237. lastResult,
  35238. lastArgs: newArgs,
  35239. lastThis: this
  35240. };
  35241. return lastResult;
  35242. }
  35243. memoized.clear = function clear() {
  35244. cache = null;
  35245. };
  35246. return memoized;
  35247. }
  35248. const useCache = () => {
  35249. const vm = vue.getCurrentInstance();
  35250. const props = vm.proxy.$props;
  35251. return vue.computed(() => {
  35252. const _getItemStyleCache = (_, __, ___) => ({});
  35253. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  35254. });
  35255. };
  35256. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  35257. const ITEM_RENDER_EVT = "itemRendered";
  35258. const SCROLL_EVT = "scroll";
  35259. const FORWARD = "forward";
  35260. const BACKWARD = "backward";
  35261. const AUTO_ALIGNMENT = "auto";
  35262. const SMART_ALIGNMENT = "smart";
  35263. const START_ALIGNMENT = "start";
  35264. const CENTERED_ALIGNMENT = "center";
  35265. const END_ALIGNMENT = "end";
  35266. const HORIZONTAL = "horizontal";
  35267. const VERTICAL = "vertical";
  35268. const LTR = "ltr";
  35269. const RTL = "rtl";
  35270. const RTL_OFFSET_NAG = "negative";
  35271. const RTL_OFFSET_POS_ASC = "positive-ascending";
  35272. const RTL_OFFSET_POS_DESC = "positive-descending";
  35273. const ScrollbarDirKey = {
  35274. [HORIZONTAL]: "left",
  35275. [VERTICAL]: "top"
  35276. };
  35277. const SCROLLBAR_MIN_SIZE = 20;
  35278. const LayoutKeys = {
  35279. [HORIZONTAL]: "deltaX",
  35280. [VERTICAL]: "deltaY"
  35281. };
  35282. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  35283. let frameHandle;
  35284. let offset = 0;
  35285. const hasReachedEdge = (offset2) => {
  35286. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  35287. return edgeReached;
  35288. };
  35289. const onWheel = (e) => {
  35290. cAF(frameHandle);
  35291. const newOffset = e[LayoutKeys[layout.value]];
  35292. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  35293. return;
  35294. offset += newOffset;
  35295. if (!isFirefox()) {
  35296. e.preventDefault();
  35297. }
  35298. frameHandle = rAF(() => {
  35299. onWheelDelta(offset);
  35300. offset = 0;
  35301. });
  35302. };
  35303. return {
  35304. hasReachedEdge,
  35305. onWheel
  35306. };
  35307. };
  35308. var useWheel$1 = useWheel;
  35309. const itemSize$1 = buildProp({
  35310. type: definePropType([Number, Function]),
  35311. required: true
  35312. });
  35313. const estimatedItemSize = buildProp({
  35314. type: Number
  35315. });
  35316. const cache = buildProp({
  35317. type: Number,
  35318. default: 2
  35319. });
  35320. const direction = buildProp({
  35321. type: String,
  35322. values: ["ltr", "rtl"],
  35323. default: "ltr"
  35324. });
  35325. const initScrollOffset = buildProp({
  35326. type: Number,
  35327. default: 0
  35328. });
  35329. const total = buildProp({
  35330. type: Number,
  35331. required: true
  35332. });
  35333. const layout = buildProp({
  35334. type: String,
  35335. values: ["horizontal", "vertical"],
  35336. default: VERTICAL
  35337. });
  35338. const virtualizedProps = buildProps({
  35339. className: {
  35340. type: String,
  35341. default: ""
  35342. },
  35343. containerElement: {
  35344. type: definePropType([String, Object]),
  35345. default: "div"
  35346. },
  35347. data: {
  35348. type: definePropType(Array),
  35349. default: () => mutable([])
  35350. },
  35351. direction,
  35352. height: {
  35353. type: [String, Number],
  35354. required: true
  35355. },
  35356. innerElement: {
  35357. type: [String, Object],
  35358. default: "div"
  35359. },
  35360. style: {
  35361. type: definePropType([Object, String, Array])
  35362. },
  35363. useIsScrolling: {
  35364. type: Boolean,
  35365. default: false
  35366. },
  35367. width: {
  35368. type: [Number, String],
  35369. required: false
  35370. },
  35371. perfMode: {
  35372. type: Boolean,
  35373. default: true
  35374. },
  35375. scrollbarAlwaysOn: {
  35376. type: Boolean,
  35377. default: false
  35378. }
  35379. });
  35380. const virtualizedListProps = buildProps({
  35381. cache,
  35382. estimatedItemSize,
  35383. layout,
  35384. initScrollOffset,
  35385. total,
  35386. itemSize: itemSize$1,
  35387. ...virtualizedProps
  35388. });
  35389. const scrollbarSize = {
  35390. type: Number,
  35391. default: 6
  35392. };
  35393. const startGap = { type: Number, default: 0 };
  35394. const endGap = { type: Number, default: 2 };
  35395. const virtualizedGridProps = buildProps({
  35396. columnCache: cache,
  35397. columnWidth: itemSize$1,
  35398. estimatedColumnWidth: estimatedItemSize,
  35399. estimatedRowHeight: estimatedItemSize,
  35400. initScrollLeft: initScrollOffset,
  35401. initScrollTop: initScrollOffset,
  35402. itemKey: {
  35403. type: definePropType(Function),
  35404. default: ({
  35405. columnIndex,
  35406. rowIndex
  35407. }) => `${rowIndex}:${columnIndex}`
  35408. },
  35409. rowCache: cache,
  35410. rowHeight: itemSize$1,
  35411. totalColumn: total,
  35412. totalRow: total,
  35413. hScrollbarSize: scrollbarSize,
  35414. vScrollbarSize: scrollbarSize,
  35415. scrollbarStartGap: startGap,
  35416. scrollbarEndGap: endGap,
  35417. role: String,
  35418. ...virtualizedProps
  35419. });
  35420. const virtualizedScrollbarProps = buildProps({
  35421. alwaysOn: Boolean,
  35422. class: String,
  35423. layout,
  35424. total,
  35425. ratio: {
  35426. type: Number,
  35427. required: true
  35428. },
  35429. clientSize: {
  35430. type: Number,
  35431. required: true
  35432. },
  35433. scrollFrom: {
  35434. type: Number,
  35435. required: true
  35436. },
  35437. scrollbarSize,
  35438. startGap,
  35439. endGap,
  35440. visible: Boolean
  35441. });
  35442. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  35443. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  35444. const isRTL = (dir) => dir === RTL;
  35445. let cachedRTLResult = null;
  35446. function getRTLOffsetType(recalculate = false) {
  35447. if (cachedRTLResult === null || recalculate) {
  35448. const outerDiv = document.createElement("div");
  35449. const outerStyle = outerDiv.style;
  35450. outerStyle.width = "50px";
  35451. outerStyle.height = "50px";
  35452. outerStyle.overflow = "scroll";
  35453. outerStyle.direction = "rtl";
  35454. const innerDiv = document.createElement("div");
  35455. const innerStyle = innerDiv.style;
  35456. innerStyle.width = "100px";
  35457. innerStyle.height = "100px";
  35458. outerDiv.appendChild(innerDiv);
  35459. document.body.appendChild(outerDiv);
  35460. if (outerDiv.scrollLeft > 0) {
  35461. cachedRTLResult = RTL_OFFSET_POS_DESC;
  35462. } else {
  35463. outerDiv.scrollLeft = 1;
  35464. if (outerDiv.scrollLeft === 0) {
  35465. cachedRTLResult = RTL_OFFSET_NAG;
  35466. } else {
  35467. cachedRTLResult = RTL_OFFSET_POS_ASC;
  35468. }
  35469. }
  35470. document.body.removeChild(outerDiv);
  35471. return cachedRTLResult;
  35472. }
  35473. return cachedRTLResult;
  35474. }
  35475. function renderThumbStyle({ move, size, bar }, layout) {
  35476. const style = {};
  35477. const translate = `translate${bar.axis}(${move}px)`;
  35478. style[bar.size] = size;
  35479. style.transform = translate;
  35480. style.msTransform = translate;
  35481. style.webkitTransform = translate;
  35482. if (layout === "horizontal") {
  35483. style.height = "100%";
  35484. } else {
  35485. style.width = "100%";
  35486. }
  35487. return style;
  35488. }
  35489. const ScrollBar = vue.defineComponent({
  35490. name: "ElVirtualScrollBar",
  35491. props: virtualizedScrollbarProps,
  35492. emits: ["scroll", "start-move", "stop-move"],
  35493. setup(props, { emit }) {
  35494. const GAP = vue.computed(() => props.startGap + props.endGap);
  35495. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  35496. const nsScrollbar = useNamespace("scrollbar");
  35497. const trackRef = vue.ref();
  35498. const thumbRef = vue.ref();
  35499. let frameHandle = null;
  35500. let onselectstartStore = null;
  35501. const state = vue.reactive({
  35502. isDragging: false,
  35503. traveled: 0
  35504. });
  35505. const bar = vue.computed(() => BAR_MAP[props.layout]);
  35506. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  35507. const trackStyle = vue.computed(() => ({
  35508. position: "absolute",
  35509. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  35510. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  35511. [ScrollbarDirKey[props.layout]]: "2px",
  35512. right: "2px",
  35513. bottom: "2px",
  35514. borderRadius: "4px"
  35515. }));
  35516. const thumbSize = vue.computed(() => {
  35517. const ratio = props.ratio;
  35518. const clientSize = props.clientSize;
  35519. if (ratio >= 100) {
  35520. return Number.POSITIVE_INFINITY;
  35521. }
  35522. if (ratio >= 50) {
  35523. return ratio * clientSize / 100;
  35524. }
  35525. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  35526. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  35527. });
  35528. const thumbStyle = vue.computed(() => {
  35529. if (!Number.isFinite(thumbSize.value)) {
  35530. return {
  35531. display: "none"
  35532. };
  35533. }
  35534. const thumb = `${thumbSize.value}px`;
  35535. const style = renderThumbStyle({
  35536. bar: bar.value,
  35537. size: thumb,
  35538. move: state.traveled
  35539. }, props.layout);
  35540. return style;
  35541. });
  35542. const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP)));
  35543. const attachEvents = () => {
  35544. window.addEventListener("mousemove", onMouseMove);
  35545. window.addEventListener("mouseup", onMouseUp);
  35546. const thumbEl = vue.unref(thumbRef);
  35547. if (!thumbEl)
  35548. return;
  35549. onselectstartStore = document.onselectstart;
  35550. document.onselectstart = () => false;
  35551. thumbEl.addEventListener("touchmove", onMouseMove);
  35552. thumbEl.addEventListener("touchend", onMouseUp);
  35553. };
  35554. const detachEvents = () => {
  35555. window.removeEventListener("mousemove", onMouseMove);
  35556. window.removeEventListener("mouseup", onMouseUp);
  35557. document.onselectstart = onselectstartStore;
  35558. onselectstartStore = null;
  35559. const thumbEl = vue.unref(thumbRef);
  35560. if (!thumbEl)
  35561. return;
  35562. thumbEl.removeEventListener("touchmove", onMouseMove);
  35563. thumbEl.removeEventListener("touchend", onMouseUp);
  35564. };
  35565. const onThumbMouseDown = (e) => {
  35566. e.stopImmediatePropagation();
  35567. if (e.ctrlKey || [1, 2].includes(e.button)) {
  35568. return;
  35569. }
  35570. state.isDragging = true;
  35571. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  35572. emit("start-move");
  35573. attachEvents();
  35574. };
  35575. const onMouseUp = () => {
  35576. state.isDragging = false;
  35577. state[bar.value.axis] = 0;
  35578. emit("stop-move");
  35579. detachEvents();
  35580. };
  35581. const onMouseMove = (e) => {
  35582. const { isDragging } = state;
  35583. if (!isDragging)
  35584. return;
  35585. if (!thumbRef.value || !trackRef.value)
  35586. return;
  35587. const prevPage = state[bar.value.axis];
  35588. if (!prevPage)
  35589. return;
  35590. cAF(frameHandle);
  35591. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  35592. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  35593. const distance = offset - thumbClickPosition;
  35594. frameHandle = rAF(() => {
  35595. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  35596. emit("scroll", distance, totalSteps.value);
  35597. });
  35598. };
  35599. const clickTrackHandler = (e) => {
  35600. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  35601. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  35602. const distance = offset - thumbHalf;
  35603. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  35604. emit("scroll", distance, totalSteps.value);
  35605. };
  35606. vue.watch(() => props.scrollFrom, (v) => {
  35607. if (state.isDragging)
  35608. return;
  35609. state.traveled = Math.ceil(v * totalSteps.value);
  35610. });
  35611. vue.onBeforeUnmount(() => {
  35612. detachEvents();
  35613. });
  35614. return () => {
  35615. return vue.h("div", {
  35616. role: "presentation",
  35617. ref: trackRef,
  35618. class: [
  35619. nsVirtualScrollbar.b(),
  35620. props.class,
  35621. (props.alwaysOn || state.isDragging) && "always-on"
  35622. ],
  35623. style: trackStyle.value,
  35624. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  35625. onTouchstartPrevent: onThumbMouseDown
  35626. }, vue.h("div", {
  35627. ref: thumbRef,
  35628. class: nsScrollbar.e("thumb"),
  35629. style: thumbStyle.value,
  35630. onMousedown: onThumbMouseDown
  35631. }, []));
  35632. };
  35633. }
  35634. });
  35635. var Scrollbar = ScrollBar;
  35636. const createList = ({
  35637. name,
  35638. getOffset,
  35639. getItemSize,
  35640. getItemOffset,
  35641. getEstimatedTotalSize,
  35642. getStartIndexForOffset,
  35643. getStopIndexForStartIndex,
  35644. initCache,
  35645. clearCache,
  35646. validateProps
  35647. }) => {
  35648. return vue.defineComponent({
  35649. name: name != null ? name : "ElVirtualList",
  35650. props: virtualizedListProps,
  35651. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  35652. setup(props, { emit, expose }) {
  35653. validateProps(props);
  35654. const instance = vue.getCurrentInstance();
  35655. const ns = useNamespace("vl");
  35656. const dynamicSizeCache = vue.ref(initCache(props, instance));
  35657. const getItemStyleCache = useCache();
  35658. const windowRef = vue.ref();
  35659. const innerRef = vue.ref();
  35660. const scrollbarRef = vue.ref();
  35661. const states = vue.ref({
  35662. isScrolling: false,
  35663. scrollDir: "forward",
  35664. scrollOffset: isNumber$1(props.initScrollOffset) ? props.initScrollOffset : 0,
  35665. updateRequested: false,
  35666. isScrollbarDragging: false,
  35667. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  35668. });
  35669. const itemsToRender = vue.computed(() => {
  35670. const { total, cache } = props;
  35671. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  35672. if (total === 0) {
  35673. return [0, 0, 0, 0];
  35674. }
  35675. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  35676. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  35677. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  35678. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  35679. return [
  35680. Math.max(0, startIndex - cacheBackward),
  35681. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  35682. startIndex,
  35683. stopIndex
  35684. ];
  35685. });
  35686. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  35687. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  35688. const windowStyle = vue.computed(() => [
  35689. {
  35690. position: "relative",
  35691. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  35692. WebkitOverflowScrolling: "touch",
  35693. willChange: "transform"
  35694. },
  35695. {
  35696. direction: props.direction,
  35697. height: isNumber$1(props.height) ? `${props.height}px` : props.height,
  35698. width: isNumber$1(props.width) ? `${props.width}px` : props.width
  35699. },
  35700. props.style
  35701. ]);
  35702. const innerStyle = vue.computed(() => {
  35703. const size = vue.unref(estimatedTotalSize);
  35704. const horizontal = vue.unref(_isHorizontal);
  35705. return {
  35706. height: horizontal ? "100%" : `${size}px`,
  35707. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  35708. width: horizontal ? `${size}px` : "100%"
  35709. };
  35710. });
  35711. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  35712. const { onWheel } = useWheel$1({
  35713. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  35714. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  35715. layout: vue.computed(() => props.layout)
  35716. }, (offset) => {
  35717. var _a, _b;
  35718. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  35719. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  35720. });
  35721. const emitEvents = () => {
  35722. const { total } = props;
  35723. if (total > 0) {
  35724. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  35725. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  35726. }
  35727. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  35728. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  35729. };
  35730. const scrollVertically = (e) => {
  35731. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  35732. const _states = vue.unref(states);
  35733. if (_states.scrollOffset === scrollTop) {
  35734. return;
  35735. }
  35736. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  35737. states.value = {
  35738. ..._states,
  35739. isScrolling: true,
  35740. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  35741. scrollOffset,
  35742. updateRequested: false
  35743. };
  35744. vue.nextTick(resetIsScrolling);
  35745. };
  35746. const scrollHorizontally = (e) => {
  35747. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  35748. const _states = vue.unref(states);
  35749. if (_states.scrollOffset === scrollLeft) {
  35750. return;
  35751. }
  35752. const { direction } = props;
  35753. let scrollOffset = scrollLeft;
  35754. if (direction === RTL) {
  35755. switch (getRTLOffsetType()) {
  35756. case RTL_OFFSET_NAG: {
  35757. scrollOffset = -scrollLeft;
  35758. break;
  35759. }
  35760. case RTL_OFFSET_POS_DESC: {
  35761. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  35762. break;
  35763. }
  35764. }
  35765. }
  35766. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  35767. states.value = {
  35768. ..._states,
  35769. isScrolling: true,
  35770. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  35771. scrollOffset,
  35772. updateRequested: false
  35773. };
  35774. vue.nextTick(resetIsScrolling);
  35775. };
  35776. const onScroll = (e) => {
  35777. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  35778. emitEvents();
  35779. };
  35780. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  35781. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  35782. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  35783. };
  35784. const scrollTo = (offset) => {
  35785. offset = Math.max(offset, 0);
  35786. if (offset === vue.unref(states).scrollOffset) {
  35787. return;
  35788. }
  35789. states.value = {
  35790. ...vue.unref(states),
  35791. scrollOffset: offset,
  35792. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  35793. updateRequested: true
  35794. };
  35795. vue.nextTick(resetIsScrolling);
  35796. };
  35797. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  35798. const { scrollOffset } = vue.unref(states);
  35799. idx = Math.max(0, Math.min(idx, props.total - 1));
  35800. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  35801. };
  35802. const getItemStyle = (idx) => {
  35803. const { direction, itemSize, layout } = props;
  35804. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  35805. let style;
  35806. if (hasOwn(itemStyleCache, String(idx))) {
  35807. style = itemStyleCache[idx];
  35808. } else {
  35809. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  35810. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  35811. const horizontal = vue.unref(_isHorizontal);
  35812. const isRtl = direction === RTL;
  35813. const offsetHorizontal = horizontal ? offset : 0;
  35814. itemStyleCache[idx] = style = {
  35815. position: "absolute",
  35816. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  35817. right: isRtl ? `${offsetHorizontal}px` : void 0,
  35818. top: !horizontal ? `${offset}px` : 0,
  35819. height: !horizontal ? `${size}px` : "100%",
  35820. width: horizontal ? `${size}px` : "100%"
  35821. };
  35822. }
  35823. return style;
  35824. };
  35825. const resetIsScrolling = () => {
  35826. states.value.isScrolling = false;
  35827. vue.nextTick(() => {
  35828. getItemStyleCache.value(-1, null, null);
  35829. });
  35830. };
  35831. const resetScrollTop = () => {
  35832. const window = windowRef.value;
  35833. if (window) {
  35834. window.scrollTop = 0;
  35835. }
  35836. };
  35837. vue.onMounted(() => {
  35838. if (!isClient)
  35839. return;
  35840. const { initScrollOffset } = props;
  35841. const windowElement = vue.unref(windowRef);
  35842. if (isNumber$1(initScrollOffset) && windowElement) {
  35843. if (vue.unref(_isHorizontal)) {
  35844. windowElement.scrollLeft = initScrollOffset;
  35845. } else {
  35846. windowElement.scrollTop = initScrollOffset;
  35847. }
  35848. }
  35849. emitEvents();
  35850. });
  35851. vue.onUpdated(() => {
  35852. const { direction, layout } = props;
  35853. const { scrollOffset, updateRequested } = vue.unref(states);
  35854. const windowElement = vue.unref(windowRef);
  35855. if (updateRequested && windowElement) {
  35856. if (layout === HORIZONTAL) {
  35857. if (direction === RTL) {
  35858. switch (getRTLOffsetType()) {
  35859. case RTL_OFFSET_NAG: {
  35860. windowElement.scrollLeft = -scrollOffset;
  35861. break;
  35862. }
  35863. case RTL_OFFSET_POS_ASC: {
  35864. windowElement.scrollLeft = scrollOffset;
  35865. break;
  35866. }
  35867. default: {
  35868. const { clientWidth, scrollWidth } = windowElement;
  35869. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  35870. break;
  35871. }
  35872. }
  35873. } else {
  35874. windowElement.scrollLeft = scrollOffset;
  35875. }
  35876. } else {
  35877. windowElement.scrollTop = scrollOffset;
  35878. }
  35879. }
  35880. });
  35881. const api = {
  35882. ns,
  35883. clientSize,
  35884. estimatedTotalSize,
  35885. windowStyle,
  35886. windowRef,
  35887. innerRef,
  35888. innerStyle,
  35889. itemsToRender,
  35890. scrollbarRef,
  35891. states,
  35892. getItemStyle,
  35893. onScroll,
  35894. onScrollbarScroll,
  35895. onWheel,
  35896. scrollTo,
  35897. scrollToItem,
  35898. resetScrollTop
  35899. };
  35900. expose({
  35901. windowRef,
  35902. innerRef,
  35903. getItemStyleCache,
  35904. scrollTo,
  35905. scrollToItem,
  35906. resetScrollTop,
  35907. states
  35908. });
  35909. return api;
  35910. },
  35911. render(ctx) {
  35912. var _a;
  35913. const {
  35914. $slots,
  35915. className,
  35916. clientSize,
  35917. containerElement,
  35918. data,
  35919. getItemStyle,
  35920. innerElement,
  35921. itemsToRender,
  35922. innerStyle,
  35923. layout,
  35924. total,
  35925. onScroll,
  35926. onScrollbarScroll,
  35927. onWheel,
  35928. states,
  35929. useIsScrolling,
  35930. windowStyle,
  35931. ns
  35932. } = ctx;
  35933. const [start, end] = itemsToRender;
  35934. const Container = vue.resolveDynamicComponent(containerElement);
  35935. const Inner = vue.resolveDynamicComponent(innerElement);
  35936. const children = [];
  35937. if (total > 0) {
  35938. for (let i = start; i <= end; i++) {
  35939. children.push((_a = $slots.default) == null ? void 0 : _a.call($slots, {
  35940. data,
  35941. key: i,
  35942. index: i,
  35943. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  35944. style: getItemStyle(i)
  35945. }));
  35946. }
  35947. }
  35948. const InnerNode = [
  35949. vue.h(Inner, {
  35950. style: innerStyle,
  35951. ref: "innerRef"
  35952. }, !isString$1(Inner) ? {
  35953. default: () => children
  35954. } : children)
  35955. ];
  35956. const scrollbar = vue.h(Scrollbar, {
  35957. ref: "scrollbarRef",
  35958. clientSize,
  35959. layout,
  35960. onScroll: onScrollbarScroll,
  35961. ratio: clientSize * 100 / this.estimatedTotalSize,
  35962. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  35963. total
  35964. });
  35965. const listContainer = vue.h(Container, {
  35966. class: [ns.e("window"), className],
  35967. style: windowStyle,
  35968. onScroll,
  35969. onWheel,
  35970. ref: "windowRef",
  35971. key: 0
  35972. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  35973. return vue.h("div", {
  35974. key: 0,
  35975. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  35976. }, [listContainer, scrollbar]);
  35977. }
  35978. });
  35979. };
  35980. var createList$1 = createList;
  35981. const FixedSizeList = createList$1({
  35982. name: "ElFixedSizeList",
  35983. getItemOffset: ({ itemSize }, index) => index * itemSize,
  35984. getItemSize: ({ itemSize }) => itemSize,
  35985. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  35986. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  35987. const size = isHorizontal(layout) ? width : height;
  35988. const lastItemOffset = Math.max(0, total * itemSize - size);
  35989. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  35990. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  35991. if (alignment === SMART_ALIGNMENT) {
  35992. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  35993. alignment = AUTO_ALIGNMENT;
  35994. } else {
  35995. alignment = CENTERED_ALIGNMENT;
  35996. }
  35997. }
  35998. switch (alignment) {
  35999. case START_ALIGNMENT: {
  36000. return maxOffset;
  36001. }
  36002. case END_ALIGNMENT: {
  36003. return minOffset;
  36004. }
  36005. case CENTERED_ALIGNMENT: {
  36006. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36007. if (middleOffset < Math.ceil(size / 2)) {
  36008. return 0;
  36009. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  36010. return lastItemOffset;
  36011. } else {
  36012. return middleOffset;
  36013. }
  36014. }
  36015. case AUTO_ALIGNMENT:
  36016. default: {
  36017. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  36018. return scrollOffset;
  36019. } else if (scrollOffset < minOffset) {
  36020. return minOffset;
  36021. } else {
  36022. return maxOffset;
  36023. }
  36024. }
  36025. }
  36026. },
  36027. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  36028. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  36029. const offset = startIndex * itemSize;
  36030. const size = isHorizontal(layout) ? width : height;
  36031. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  36032. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  36033. },
  36034. initCache() {
  36035. return void 0;
  36036. },
  36037. clearCache: true,
  36038. validateProps() {
  36039. }
  36040. });
  36041. var FixedSizeList$1 = FixedSizeList;
  36042. const getItemFromCache$1 = (props, index, listCache) => {
  36043. const { itemSize } = props;
  36044. const { items, lastVisitedIndex } = listCache;
  36045. if (index > lastVisitedIndex) {
  36046. let offset = 0;
  36047. if (lastVisitedIndex >= 0) {
  36048. const item = items[lastVisitedIndex];
  36049. offset = item.offset + item.size;
  36050. }
  36051. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  36052. const size = itemSize(i);
  36053. items[i] = {
  36054. offset,
  36055. size
  36056. };
  36057. offset += size;
  36058. }
  36059. listCache.lastVisitedIndex = index;
  36060. }
  36061. return items[index];
  36062. };
  36063. const findItem$1 = (props, listCache, offset) => {
  36064. const { items, lastVisitedIndex } = listCache;
  36065. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  36066. if (lastVisitedOffset >= offset) {
  36067. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  36068. }
  36069. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  36070. };
  36071. const bs$1 = (props, listCache, low, high, offset) => {
  36072. while (low <= high) {
  36073. const mid = low + Math.floor((high - low) / 2);
  36074. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  36075. if (currentOffset === offset) {
  36076. return mid;
  36077. } else if (currentOffset < offset) {
  36078. low = mid + 1;
  36079. } else if (currentOffset > offset) {
  36080. high = mid - 1;
  36081. }
  36082. }
  36083. return Math.max(0, low - 1);
  36084. };
  36085. const es$1 = (props, listCache, index, offset) => {
  36086. const { total } = props;
  36087. let exponent = 1;
  36088. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  36089. index += exponent;
  36090. exponent *= 2;
  36091. }
  36092. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  36093. };
  36094. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  36095. let totalSizeOfMeasuredItems = 0;
  36096. if (lastVisitedIndex >= total) {
  36097. lastVisitedIndex = total - 1;
  36098. }
  36099. if (lastVisitedIndex >= 0) {
  36100. const item = items[lastVisitedIndex];
  36101. totalSizeOfMeasuredItems = item.offset + item.size;
  36102. }
  36103. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  36104. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  36105. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  36106. };
  36107. const DynamicSizeList = createList$1({
  36108. name: "ElDynamicSizeList",
  36109. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  36110. getItemSize: (_, index, { items }) => items[index].size,
  36111. getEstimatedTotalSize,
  36112. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  36113. const { height, layout, width } = props;
  36114. const size = isHorizontal(layout) ? width : height;
  36115. const item = getItemFromCache$1(props, index, listCache);
  36116. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  36117. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  36118. const minOffset = Math.max(0, item.offset - size + item.size);
  36119. if (alignment === SMART_ALIGNMENT) {
  36120. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  36121. alignment = AUTO_ALIGNMENT;
  36122. } else {
  36123. alignment = CENTERED_ALIGNMENT;
  36124. }
  36125. }
  36126. switch (alignment) {
  36127. case START_ALIGNMENT: {
  36128. return maxOffset;
  36129. }
  36130. case END_ALIGNMENT: {
  36131. return minOffset;
  36132. }
  36133. case CENTERED_ALIGNMENT: {
  36134. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  36135. }
  36136. case AUTO_ALIGNMENT:
  36137. default: {
  36138. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  36139. return scrollOffset;
  36140. } else if (scrollOffset < minOffset) {
  36141. return minOffset;
  36142. } else {
  36143. return maxOffset;
  36144. }
  36145. }
  36146. }
  36147. },
  36148. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  36149. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  36150. const { height, total, layout, width } = props;
  36151. const size = isHorizontal(layout) ? width : height;
  36152. const item = getItemFromCache$1(props, startIndex, listCache);
  36153. const maxOffset = scrollOffset + size;
  36154. let offset = item.offset + item.size;
  36155. let stopIndex = startIndex;
  36156. while (stopIndex < total - 1 && offset < maxOffset) {
  36157. stopIndex++;
  36158. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  36159. }
  36160. return stopIndex;
  36161. },
  36162. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  36163. const cache = {
  36164. items: {},
  36165. estimatedItemSize,
  36166. lastVisitedIndex: -1
  36167. };
  36168. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  36169. var _a, _b;
  36170. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  36171. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  36172. if (forceUpdate) {
  36173. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  36174. }
  36175. };
  36176. return cache;
  36177. },
  36178. clearCache: false,
  36179. validateProps: ({ itemSize }) => {
  36180. }
  36181. });
  36182. var DynamicSizeList$1 = DynamicSizeList;
  36183. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  36184. let frameHandle = null;
  36185. let xOffset = 0;
  36186. let yOffset = 0;
  36187. const hasReachedEdge = (x, y) => {
  36188. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  36189. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  36190. return xEdgeReached && yEdgeReached;
  36191. };
  36192. const onWheel = (e) => {
  36193. cAF(frameHandle);
  36194. let x = e.deltaX;
  36195. let y = e.deltaY;
  36196. if (Math.abs(x) > Math.abs(y)) {
  36197. y = 0;
  36198. } else {
  36199. x = 0;
  36200. }
  36201. if (e.shiftKey && y !== 0) {
  36202. x = y;
  36203. y = 0;
  36204. }
  36205. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  36206. return;
  36207. xOffset += x;
  36208. yOffset += y;
  36209. e.preventDefault();
  36210. frameHandle = rAF(() => {
  36211. onWheelDelta(xOffset, yOffset);
  36212. xOffset = 0;
  36213. yOffset = 0;
  36214. });
  36215. };
  36216. return {
  36217. hasReachedEdge,
  36218. onWheel
  36219. };
  36220. };
  36221. const createGrid = ({
  36222. name,
  36223. clearCache,
  36224. getColumnPosition,
  36225. getColumnStartIndexForOffset,
  36226. getColumnStopIndexForStartIndex,
  36227. getEstimatedTotalHeight,
  36228. getEstimatedTotalWidth,
  36229. getColumnOffset,
  36230. getRowOffset,
  36231. getRowPosition,
  36232. getRowStartIndexForOffset,
  36233. getRowStopIndexForStartIndex,
  36234. initCache,
  36235. injectToInstance,
  36236. validateProps
  36237. }) => {
  36238. return vue.defineComponent({
  36239. name: name != null ? name : "ElVirtualList",
  36240. props: virtualizedGridProps,
  36241. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  36242. setup(props, { emit, expose, slots }) {
  36243. const ns = useNamespace("vl");
  36244. validateProps(props);
  36245. const instance = vue.getCurrentInstance();
  36246. const cache = vue.ref(initCache(props, instance));
  36247. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  36248. const windowRef = vue.ref();
  36249. const hScrollbar = vue.ref();
  36250. const vScrollbar = vue.ref();
  36251. const innerRef = vue.ref(null);
  36252. const states = vue.ref({
  36253. isScrolling: false,
  36254. scrollLeft: isNumber$1(props.initScrollLeft) ? props.initScrollLeft : 0,
  36255. scrollTop: isNumber$1(props.initScrollTop) ? props.initScrollTop : 0,
  36256. updateRequested: false,
  36257. xAxisScrollDir: FORWARD,
  36258. yAxisScrollDir: FORWARD
  36259. });
  36260. const getItemStyleCache = useCache();
  36261. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  36262. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  36263. const columnsToRender = vue.computed(() => {
  36264. const { totalColumn, totalRow, columnCache } = props;
  36265. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  36266. if (totalColumn === 0 || totalRow === 0) {
  36267. return [0, 0, 0, 0];
  36268. }
  36269. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  36270. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  36271. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  36272. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  36273. return [
  36274. Math.max(0, startIndex - cacheBackward),
  36275. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  36276. startIndex,
  36277. stopIndex
  36278. ];
  36279. });
  36280. const rowsToRender = vue.computed(() => {
  36281. const { totalColumn, totalRow, rowCache } = props;
  36282. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  36283. if (totalColumn === 0 || totalRow === 0) {
  36284. return [0, 0, 0, 0];
  36285. }
  36286. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  36287. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  36288. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  36289. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  36290. return [
  36291. Math.max(0, startIndex - cacheBackward),
  36292. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  36293. startIndex,
  36294. stopIndex
  36295. ];
  36296. });
  36297. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  36298. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  36299. const windowStyle = vue.computed(() => {
  36300. var _a;
  36301. return [
  36302. {
  36303. position: "relative",
  36304. overflow: "hidden",
  36305. WebkitOverflowScrolling: "touch",
  36306. willChange: "transform"
  36307. },
  36308. {
  36309. direction: props.direction,
  36310. height: isNumber$1(props.height) ? `${props.height}px` : props.height,
  36311. width: isNumber$1(props.width) ? `${props.width}px` : props.width
  36312. },
  36313. (_a = props.style) != null ? _a : {}
  36314. ];
  36315. });
  36316. const innerStyle = vue.computed(() => {
  36317. const width = `${vue.unref(estimatedTotalWidth)}px`;
  36318. const height = `${vue.unref(estimatedTotalHeight)}px`;
  36319. return {
  36320. height,
  36321. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  36322. width
  36323. };
  36324. });
  36325. const emitEvents = () => {
  36326. const { totalColumn, totalRow } = props;
  36327. if (totalColumn > 0 && totalRow > 0) {
  36328. const [
  36329. columnCacheStart,
  36330. columnCacheEnd,
  36331. columnVisibleStart,
  36332. columnVisibleEnd
  36333. ] = vue.unref(columnsToRender);
  36334. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  36335. emit(ITEM_RENDER_EVT, {
  36336. columnCacheStart,
  36337. columnCacheEnd,
  36338. rowCacheStart,
  36339. rowCacheEnd,
  36340. columnVisibleStart,
  36341. columnVisibleEnd,
  36342. rowVisibleStart,
  36343. rowVisibleEnd
  36344. });
  36345. }
  36346. const {
  36347. scrollLeft,
  36348. scrollTop,
  36349. updateRequested,
  36350. xAxisScrollDir,
  36351. yAxisScrollDir
  36352. } = vue.unref(states);
  36353. emit(SCROLL_EVT, {
  36354. xAxisScrollDir,
  36355. scrollLeft,
  36356. yAxisScrollDir,
  36357. scrollTop,
  36358. updateRequested
  36359. });
  36360. };
  36361. const onScroll = (e) => {
  36362. const {
  36363. clientHeight,
  36364. clientWidth,
  36365. scrollHeight,
  36366. scrollLeft,
  36367. scrollTop,
  36368. scrollWidth
  36369. } = e.currentTarget;
  36370. const _states = vue.unref(states);
  36371. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  36372. return;
  36373. }
  36374. let _scrollLeft = scrollLeft;
  36375. if (isRTL(props.direction)) {
  36376. switch (getRTLOffsetType()) {
  36377. case RTL_OFFSET_NAG:
  36378. _scrollLeft = -scrollLeft;
  36379. break;
  36380. case RTL_OFFSET_POS_DESC:
  36381. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  36382. break;
  36383. }
  36384. }
  36385. states.value = {
  36386. ..._states,
  36387. isScrolling: true,
  36388. scrollLeft: _scrollLeft,
  36389. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  36390. updateRequested: true,
  36391. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  36392. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  36393. };
  36394. vue.nextTick(() => resetIsScrolling());
  36395. onUpdated();
  36396. emitEvents();
  36397. };
  36398. const onVerticalScroll = (distance, totalSteps) => {
  36399. const height = vue.unref(parsedHeight);
  36400. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  36401. scrollTo({
  36402. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  36403. });
  36404. };
  36405. const onHorizontalScroll = (distance, totalSteps) => {
  36406. const width = vue.unref(parsedWidth);
  36407. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  36408. scrollTo({
  36409. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  36410. });
  36411. };
  36412. const { onWheel } = useGridWheel({
  36413. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  36414. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - vue.unref(parsedWidth)),
  36415. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  36416. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value - vue.unref(parsedHeight))
  36417. }, (x, y) => {
  36418. var _a, _b, _c, _d;
  36419. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  36420. (_d = (_c = hScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  36421. const width = vue.unref(parsedWidth);
  36422. const height = vue.unref(parsedHeight);
  36423. scrollTo({
  36424. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  36425. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  36426. });
  36427. });
  36428. const scrollTo = ({
  36429. scrollLeft = states.value.scrollLeft,
  36430. scrollTop = states.value.scrollTop
  36431. }) => {
  36432. scrollLeft = Math.max(scrollLeft, 0);
  36433. scrollTop = Math.max(scrollTop, 0);
  36434. const _states = vue.unref(states);
  36435. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  36436. return;
  36437. }
  36438. states.value = {
  36439. ..._states,
  36440. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  36441. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  36442. scrollLeft,
  36443. scrollTop,
  36444. updateRequested: true
  36445. };
  36446. vue.nextTick(() => resetIsScrolling());
  36447. onUpdated();
  36448. emitEvents();
  36449. };
  36450. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  36451. const _states = vue.unref(states);
  36452. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  36453. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  36454. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  36455. const _cache = vue.unref(cache);
  36456. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  36457. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  36458. scrollTo({
  36459. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  36460. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  36461. });
  36462. };
  36463. const getItemStyle = (rowIndex, columnIndex) => {
  36464. const { columnWidth, direction, rowHeight } = props;
  36465. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  36466. const key = `${rowIndex},${columnIndex}`;
  36467. if (hasOwn(itemStyleCache, key)) {
  36468. return itemStyleCache[key];
  36469. } else {
  36470. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  36471. const _cache = vue.unref(cache);
  36472. const rtl = isRTL(direction);
  36473. const [height, top] = getRowPosition(props, rowIndex, _cache);
  36474. const [width] = getColumnPosition(props, columnIndex, _cache);
  36475. itemStyleCache[key] = {
  36476. position: "absolute",
  36477. left: rtl ? void 0 : `${left}px`,
  36478. right: rtl ? `${left}px` : void 0,
  36479. top: `${top}px`,
  36480. height: `${height}px`,
  36481. width: `${width}px`
  36482. };
  36483. return itemStyleCache[key];
  36484. }
  36485. };
  36486. const resetIsScrolling = () => {
  36487. states.value.isScrolling = false;
  36488. vue.nextTick(() => {
  36489. getItemStyleCache.value(-1, null, null);
  36490. });
  36491. };
  36492. vue.onMounted(() => {
  36493. if (!isClient)
  36494. return;
  36495. const { initScrollLeft, initScrollTop } = props;
  36496. const windowElement = vue.unref(windowRef);
  36497. if (windowElement) {
  36498. if (isNumber$1(initScrollLeft)) {
  36499. windowElement.scrollLeft = initScrollLeft;
  36500. }
  36501. if (isNumber$1(initScrollTop)) {
  36502. windowElement.scrollTop = initScrollTop;
  36503. }
  36504. }
  36505. emitEvents();
  36506. });
  36507. const onUpdated = () => {
  36508. const { direction } = props;
  36509. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  36510. const windowElement = vue.unref(windowRef);
  36511. if (updateRequested && windowElement) {
  36512. if (direction === RTL) {
  36513. switch (getRTLOffsetType()) {
  36514. case RTL_OFFSET_NAG: {
  36515. windowElement.scrollLeft = -scrollLeft;
  36516. break;
  36517. }
  36518. case RTL_OFFSET_POS_ASC: {
  36519. windowElement.scrollLeft = scrollLeft;
  36520. break;
  36521. }
  36522. default: {
  36523. const { clientWidth, scrollWidth } = windowElement;
  36524. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  36525. break;
  36526. }
  36527. }
  36528. } else {
  36529. windowElement.scrollLeft = Math.max(0, scrollLeft);
  36530. }
  36531. windowElement.scrollTop = Math.max(0, scrollTop);
  36532. }
  36533. };
  36534. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  36535. expose({
  36536. windowRef,
  36537. innerRef,
  36538. getItemStyleCache,
  36539. scrollTo,
  36540. scrollToItem,
  36541. states,
  36542. resetAfterColumnIndex,
  36543. resetAfterRowIndex,
  36544. resetAfter
  36545. });
  36546. const renderScrollbars = () => {
  36547. const {
  36548. scrollbarAlwaysOn,
  36549. scrollbarStartGap,
  36550. scrollbarEndGap,
  36551. totalColumn,
  36552. totalRow
  36553. } = props;
  36554. const width = vue.unref(parsedWidth);
  36555. const height = vue.unref(parsedHeight);
  36556. const estimatedWidth = vue.unref(estimatedTotalWidth);
  36557. const estimatedHeight = vue.unref(estimatedTotalHeight);
  36558. const { scrollLeft, scrollTop } = vue.unref(states);
  36559. const horizontalScrollbar = vue.h(Scrollbar, {
  36560. ref: hScrollbar,
  36561. alwaysOn: scrollbarAlwaysOn,
  36562. startGap: scrollbarStartGap,
  36563. endGap: scrollbarEndGap,
  36564. class: ns.e("horizontal"),
  36565. clientSize: width,
  36566. layout: "horizontal",
  36567. onScroll: onHorizontalScroll,
  36568. ratio: width * 100 / estimatedWidth,
  36569. scrollFrom: scrollLeft / (estimatedWidth - width),
  36570. total: totalRow,
  36571. visible: true
  36572. });
  36573. const verticalScrollbar = vue.h(Scrollbar, {
  36574. ref: vScrollbar,
  36575. alwaysOn: scrollbarAlwaysOn,
  36576. startGap: scrollbarStartGap,
  36577. endGap: scrollbarEndGap,
  36578. class: ns.e("vertical"),
  36579. clientSize: height,
  36580. layout: "vertical",
  36581. onScroll: onVerticalScroll,
  36582. ratio: height * 100 / estimatedHeight,
  36583. scrollFrom: scrollTop / (estimatedHeight - height),
  36584. total: totalColumn,
  36585. visible: true
  36586. });
  36587. return {
  36588. horizontalScrollbar,
  36589. verticalScrollbar
  36590. };
  36591. };
  36592. const renderItems = () => {
  36593. var _a;
  36594. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  36595. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  36596. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  36597. const children = [];
  36598. if (totalRow > 0 && totalColumn > 0) {
  36599. for (let row = rowStart; row <= rowEnd; row++) {
  36600. for (let column = columnStart; column <= columnEnd; column++) {
  36601. children.push((_a = slots.default) == null ? void 0 : _a.call(slots, {
  36602. columnIndex: column,
  36603. data,
  36604. key: itemKey({ columnIndex: column, data, rowIndex: row }),
  36605. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  36606. style: getItemStyle(row, column),
  36607. rowIndex: row
  36608. }));
  36609. }
  36610. }
  36611. }
  36612. return children;
  36613. };
  36614. const renderInner = () => {
  36615. const Inner = vue.resolveDynamicComponent(props.innerElement);
  36616. const children = renderItems();
  36617. return [
  36618. vue.h(Inner, {
  36619. style: vue.unref(innerStyle),
  36620. ref: innerRef
  36621. }, !isString$1(Inner) ? {
  36622. default: () => children
  36623. } : children)
  36624. ];
  36625. };
  36626. const renderWindow = () => {
  36627. const Container = vue.resolveDynamicComponent(props.containerElement);
  36628. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  36629. const Inner = renderInner();
  36630. return vue.h("div", {
  36631. key: 0,
  36632. class: ns.e("wrapper"),
  36633. role: props.role
  36634. }, [
  36635. vue.h(Container, {
  36636. class: props.className,
  36637. style: vue.unref(windowStyle),
  36638. onScroll,
  36639. onWheel,
  36640. ref: windowRef
  36641. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  36642. horizontalScrollbar,
  36643. verticalScrollbar
  36644. ]);
  36645. };
  36646. return renderWindow;
  36647. }
  36648. });
  36649. };
  36650. var createGrid$1 = createGrid;
  36651. const FixedSizeGrid = createGrid$1({
  36652. name: "ElFixedSizeGrid",
  36653. getColumnPosition: ({ columnWidth }, index) => [
  36654. columnWidth,
  36655. index * columnWidth
  36656. ],
  36657. getRowPosition: ({ rowHeight }, index) => [
  36658. rowHeight,
  36659. index * rowHeight
  36660. ],
  36661. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  36662. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  36663. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  36664. width = Number(width);
  36665. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  36666. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  36667. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  36668. if (alignment === "smart") {
  36669. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  36670. alignment = AUTO_ALIGNMENT;
  36671. } else {
  36672. alignment = CENTERED_ALIGNMENT;
  36673. }
  36674. }
  36675. switch (alignment) {
  36676. case START_ALIGNMENT:
  36677. return maxOffset;
  36678. case END_ALIGNMENT:
  36679. return minOffset;
  36680. case CENTERED_ALIGNMENT: {
  36681. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36682. if (middleOffset < Math.ceil(width / 2)) {
  36683. return 0;
  36684. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  36685. return lastColumnOffset;
  36686. } else {
  36687. return middleOffset;
  36688. }
  36689. }
  36690. case AUTO_ALIGNMENT:
  36691. default:
  36692. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  36693. return scrollLeft;
  36694. } else if (minOffset > maxOffset) {
  36695. return minOffset;
  36696. } else if (scrollLeft < minOffset) {
  36697. return minOffset;
  36698. } else {
  36699. return maxOffset;
  36700. }
  36701. }
  36702. },
  36703. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  36704. height = Number(height);
  36705. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  36706. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  36707. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  36708. if (align === SMART_ALIGNMENT) {
  36709. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  36710. align = AUTO_ALIGNMENT;
  36711. } else {
  36712. align = CENTERED_ALIGNMENT;
  36713. }
  36714. }
  36715. switch (align) {
  36716. case START_ALIGNMENT:
  36717. return maxOffset;
  36718. case END_ALIGNMENT:
  36719. return minOffset;
  36720. case CENTERED_ALIGNMENT: {
  36721. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36722. if (middleOffset < Math.ceil(height / 2)) {
  36723. return 0;
  36724. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  36725. return lastRowOffset;
  36726. } else {
  36727. return middleOffset;
  36728. }
  36729. }
  36730. case AUTO_ALIGNMENT:
  36731. default:
  36732. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  36733. return scrollTop;
  36734. } else if (minOffset > maxOffset) {
  36735. return minOffset;
  36736. } else if (scrollTop < minOffset) {
  36737. return minOffset;
  36738. } else {
  36739. return maxOffset;
  36740. }
  36741. }
  36742. },
  36743. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  36744. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  36745. const left = startIndex * columnWidth;
  36746. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  36747. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  36748. },
  36749. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  36750. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  36751. const top = startIndex * rowHeight;
  36752. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  36753. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  36754. },
  36755. initCache: () => void 0,
  36756. clearCache: true,
  36757. validateProps: ({ columnWidth, rowHeight }) => {
  36758. }
  36759. });
  36760. var FixedSizeGrid$1 = FixedSizeGrid;
  36761. const { max, min, floor } = Math;
  36762. const ACCESS_SIZER_KEY_MAP = {
  36763. column: "columnWidth",
  36764. row: "rowHeight"
  36765. };
  36766. const ACCESS_LAST_VISITED_KEY_MAP = {
  36767. column: "lastVisitedColumnIndex",
  36768. row: "lastVisitedRowIndex"
  36769. };
  36770. const getItemFromCache = (props, index, gridCache, type) => {
  36771. const [cachedItems, sizer, lastVisited] = [
  36772. gridCache[type],
  36773. props[ACCESS_SIZER_KEY_MAP[type]],
  36774. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  36775. ];
  36776. if (index > lastVisited) {
  36777. let offset = 0;
  36778. if (lastVisited >= 0) {
  36779. const item = cachedItems[lastVisited];
  36780. offset = item.offset + item.size;
  36781. }
  36782. for (let i = lastVisited + 1; i <= index; i++) {
  36783. const size = sizer(i);
  36784. cachedItems[i] = {
  36785. offset,
  36786. size
  36787. };
  36788. offset += size;
  36789. }
  36790. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  36791. }
  36792. return cachedItems[index];
  36793. };
  36794. const bs = (props, gridCache, low, high, offset, type) => {
  36795. while (low <= high) {
  36796. const mid = low + floor((high - low) / 2);
  36797. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  36798. if (currentOffset === offset) {
  36799. return mid;
  36800. } else if (currentOffset < offset) {
  36801. low = mid + 1;
  36802. } else {
  36803. high = mid - 1;
  36804. }
  36805. }
  36806. return max(0, low - 1);
  36807. };
  36808. const es = (props, gridCache, idx, offset, type) => {
  36809. const total = type === "column" ? props.totalColumn : props.totalRow;
  36810. let exponent = 1;
  36811. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  36812. idx += exponent;
  36813. exponent *= 2;
  36814. }
  36815. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  36816. };
  36817. const findItem = (props, gridCache, offset, type) => {
  36818. const [cache, lastVisitedIndex] = [
  36819. gridCache[type],
  36820. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  36821. ];
  36822. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  36823. if (lastVisitedItemOffset >= offset) {
  36824. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  36825. }
  36826. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  36827. };
  36828. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  36829. let sizeOfVisitedRows = 0;
  36830. if (lastVisitedRowIndex >= totalRow) {
  36831. lastVisitedRowIndex = totalRow - 1;
  36832. }
  36833. if (lastVisitedRowIndex >= 0) {
  36834. const item = row[lastVisitedRowIndex];
  36835. sizeOfVisitedRows = item.offset + item.size;
  36836. }
  36837. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  36838. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  36839. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  36840. };
  36841. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  36842. let sizeOfVisitedColumns = 0;
  36843. if (lastVisitedColumnIndex > totalColumn) {
  36844. lastVisitedColumnIndex = totalColumn - 1;
  36845. }
  36846. if (lastVisitedColumnIndex >= 0) {
  36847. const item = column[lastVisitedColumnIndex];
  36848. sizeOfVisitedColumns = item.offset + item.size;
  36849. }
  36850. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  36851. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  36852. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  36853. };
  36854. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  36855. column: getEstimatedTotalWidth,
  36856. row: getEstimatedTotalHeight
  36857. };
  36858. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  36859. const [size, estimatedSizeAssociates] = [
  36860. type === "row" ? props.height : props.width,
  36861. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  36862. ];
  36863. const item = getItemFromCache(props, index, cache, type);
  36864. const estimatedSize = estimatedSizeAssociates(props, cache);
  36865. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  36866. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  36867. if (alignment === SMART_ALIGNMENT) {
  36868. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  36869. alignment = AUTO_ALIGNMENT;
  36870. } else {
  36871. alignment = CENTERED_ALIGNMENT;
  36872. }
  36873. }
  36874. switch (alignment) {
  36875. case START_ALIGNMENT: {
  36876. return maxOffset;
  36877. }
  36878. case END_ALIGNMENT: {
  36879. return minOffset;
  36880. }
  36881. case CENTERED_ALIGNMENT: {
  36882. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  36883. }
  36884. case AUTO_ALIGNMENT:
  36885. default: {
  36886. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  36887. return scrollOffset;
  36888. } else if (minOffset > maxOffset) {
  36889. return minOffset;
  36890. } else if (scrollOffset < minOffset) {
  36891. return minOffset;
  36892. } else {
  36893. return maxOffset;
  36894. }
  36895. }
  36896. }
  36897. };
  36898. const DynamicSizeGrid = createGrid$1({
  36899. name: "ElDynamicSizeGrid",
  36900. getColumnPosition: (props, idx, cache) => {
  36901. const item = getItemFromCache(props, idx, cache, "column");
  36902. return [item.size, item.offset];
  36903. },
  36904. getRowPosition: (props, idx, cache) => {
  36905. const item = getItemFromCache(props, idx, cache, "row");
  36906. return [item.size, item.offset];
  36907. },
  36908. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  36909. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  36910. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  36911. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  36912. const item = getItemFromCache(props, startIndex, cache, "column");
  36913. const maxOffset = scrollLeft + props.width;
  36914. let offset = item.offset + item.size;
  36915. let stopIndex = startIndex;
  36916. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  36917. stopIndex++;
  36918. offset += getItemFromCache(props, startIndex, cache, "column").size;
  36919. }
  36920. return stopIndex;
  36921. },
  36922. getEstimatedTotalHeight,
  36923. getEstimatedTotalWidth,
  36924. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  36925. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  36926. const { totalRow, height } = props;
  36927. const item = getItemFromCache(props, startIndex, cache, "row");
  36928. const maxOffset = scrollTop + height;
  36929. let offset = item.size + item.offset;
  36930. let stopIndex = startIndex;
  36931. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  36932. stopIndex++;
  36933. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  36934. }
  36935. return stopIndex;
  36936. },
  36937. injectToInstance: (instance, cache) => {
  36938. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  36939. var _a, _b;
  36940. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  36941. if (isNumber$1(columnIndex)) {
  36942. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  36943. }
  36944. if (isNumber$1(rowIndex)) {
  36945. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  36946. }
  36947. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  36948. if (forceUpdate)
  36949. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  36950. };
  36951. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  36952. resetAfter({
  36953. columnIndex
  36954. }, forceUpdate);
  36955. };
  36956. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  36957. resetAfter({
  36958. rowIndex
  36959. }, forceUpdate);
  36960. };
  36961. Object.assign(instance.proxy, {
  36962. resetAfterColumnIndex,
  36963. resetAfterRowIndex,
  36964. resetAfter
  36965. });
  36966. },
  36967. initCache: ({
  36968. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  36969. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  36970. }) => {
  36971. const cache = {
  36972. column: {},
  36973. estimatedColumnWidth,
  36974. estimatedRowHeight,
  36975. lastVisitedColumnIndex: -1,
  36976. lastVisitedRowIndex: -1,
  36977. row: {}
  36978. };
  36979. return cache;
  36980. },
  36981. clearCache: false,
  36982. validateProps: ({ columnWidth, rowHeight }) => {
  36983. }
  36984. });
  36985. var DynamicSizeGrid$1 = DynamicSizeGrid;
  36986. const _sfc_main$D = vue.defineComponent({
  36987. props: {
  36988. item: {
  36989. type: Object,
  36990. required: true
  36991. },
  36992. style: Object,
  36993. height: Number
  36994. },
  36995. setup() {
  36996. const ns = useNamespace("select");
  36997. return {
  36998. ns
  36999. };
  37000. }
  37001. });
  37002. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  37003. return _ctx.item.isTitle ? (vue.openBlock(), vue.createElementBlock("div", {
  37004. key: 0,
  37005. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  37006. style: vue.normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }])
  37007. }, vue.toDisplayString(_ctx.item.label), 7)) : (vue.openBlock(), vue.createElementBlock("div", {
  37008. key: 1,
  37009. class: vue.normalizeClass(_ctx.ns.be("group", "split")),
  37010. style: vue.normalizeStyle(_ctx.style)
  37011. }, [
  37012. vue.createElementVNode("span", {
  37013. class: vue.normalizeClass(_ctx.ns.be("group", "split-dash")),
  37014. style: vue.normalizeStyle({ top: `${_ctx.height / 2}px` })
  37015. }, null, 6)
  37016. ], 6));
  37017. }
  37018. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  37019. function useOption(props, { emit }) {
  37020. return {
  37021. hoverItem: () => {
  37022. if (!props.disabled) {
  37023. emit("hover", props.index);
  37024. }
  37025. },
  37026. selectOptionClick: () => {
  37027. if (!props.disabled) {
  37028. emit("select", props.item, props.index);
  37029. }
  37030. }
  37031. };
  37032. }
  37033. const SelectProps = {
  37034. allowCreate: Boolean,
  37035. autocomplete: {
  37036. type: String,
  37037. default: "none"
  37038. },
  37039. automaticDropdown: Boolean,
  37040. clearable: Boolean,
  37041. clearIcon: {
  37042. type: [String, Object],
  37043. default: circle_close_default
  37044. },
  37045. effect: {
  37046. type: String,
  37047. default: "light"
  37048. },
  37049. collapseTags: Boolean,
  37050. collapseTagsTooltip: {
  37051. type: Boolean,
  37052. default: false
  37053. },
  37054. maxCollapseTags: {
  37055. type: Number,
  37056. default: 1
  37057. },
  37058. defaultFirstOption: Boolean,
  37059. disabled: Boolean,
  37060. estimatedOptionHeight: {
  37061. type: Number,
  37062. default: void 0
  37063. },
  37064. filterable: Boolean,
  37065. filterMethod: Function,
  37066. height: {
  37067. type: Number,
  37068. default: 170
  37069. },
  37070. itemHeight: {
  37071. type: Number,
  37072. default: 34
  37073. },
  37074. id: String,
  37075. loading: Boolean,
  37076. loadingText: String,
  37077. label: String,
  37078. modelValue: [Array, String, Number, Boolean, Object],
  37079. multiple: Boolean,
  37080. multipleLimit: {
  37081. type: Number,
  37082. default: 0
  37083. },
  37084. name: String,
  37085. noDataText: String,
  37086. noMatchText: String,
  37087. remoteMethod: Function,
  37088. reserveKeyword: {
  37089. type: Boolean,
  37090. default: true
  37091. },
  37092. options: {
  37093. type: Array,
  37094. required: true
  37095. },
  37096. placeholder: {
  37097. type: String
  37098. },
  37099. teleported: useTooltipContentProps.teleported,
  37100. persistent: {
  37101. type: Boolean,
  37102. default: true
  37103. },
  37104. popperClass: {
  37105. type: String,
  37106. default: ""
  37107. },
  37108. popperOptions: {
  37109. type: Object,
  37110. default: () => ({})
  37111. },
  37112. remote: Boolean,
  37113. size: {
  37114. type: String,
  37115. validator: isValidComponentSize
  37116. },
  37117. valueKey: {
  37118. type: String,
  37119. default: "value"
  37120. },
  37121. scrollbarAlwaysOn: {
  37122. type: Boolean,
  37123. default: false
  37124. },
  37125. validateEvent: {
  37126. type: Boolean,
  37127. default: true
  37128. },
  37129. placement: {
  37130. type: definePropType(String),
  37131. values: Ee,
  37132. default: "bottom-start"
  37133. }
  37134. };
  37135. const OptionProps = {
  37136. data: Array,
  37137. disabled: Boolean,
  37138. hovering: Boolean,
  37139. item: Object,
  37140. index: Number,
  37141. style: Object,
  37142. selected: Boolean,
  37143. created: Boolean
  37144. };
  37145. const _sfc_main$C = vue.defineComponent({
  37146. props: OptionProps,
  37147. emits: ["select", "hover"],
  37148. setup(props, { emit }) {
  37149. const ns = useNamespace("select");
  37150. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  37151. return {
  37152. ns,
  37153. hoverItem,
  37154. selectOptionClick
  37155. };
  37156. }
  37157. });
  37158. const _hoisted_1$h = ["aria-selected"];
  37159. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  37160. return vue.openBlock(), vue.createElementBlock("li", {
  37161. "aria-selected": _ctx.selected,
  37162. style: vue.normalizeStyle(_ctx.style),
  37163. class: vue.normalizeClass([
  37164. _ctx.ns.be("dropdown", "option-item"),
  37165. _ctx.ns.is("selected", _ctx.selected),
  37166. _ctx.ns.is("disabled", _ctx.disabled),
  37167. _ctx.ns.is("created", _ctx.created),
  37168. { hover: _ctx.hovering }
  37169. ]),
  37170. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  37171. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  37172. }, [
  37173. vue.renderSlot(_ctx.$slots, "default", {
  37174. item: _ctx.item,
  37175. index: _ctx.index,
  37176. disabled: _ctx.disabled
  37177. }, () => [
  37178. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.item.label), 1)
  37179. ])
  37180. ], 46, _hoisted_1$h);
  37181. }
  37182. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  37183. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  37184. var ElSelectMenu = vue.defineComponent({
  37185. name: "ElSelectDropdown",
  37186. props: {
  37187. data: {
  37188. type: Array,
  37189. required: true
  37190. },
  37191. hoveringIndex: Number,
  37192. width: Number
  37193. },
  37194. setup(props, {
  37195. slots,
  37196. expose
  37197. }) {
  37198. const select = vue.inject(selectV2InjectionKey);
  37199. const ns = useNamespace("select");
  37200. const cachedHeights = vue.ref([]);
  37201. const listRef = vue.ref();
  37202. const size = vue.computed(() => props.data.length);
  37203. vue.watch(() => size.value, () => {
  37204. var _a, _b;
  37205. (_b = (_a = select.popper.value).updatePopper) == null ? void 0 : _b.call(_a);
  37206. });
  37207. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  37208. const listProps = vue.computed(() => {
  37209. if (isSized.value) {
  37210. return {
  37211. itemSize: select.props.itemHeight
  37212. };
  37213. }
  37214. return {
  37215. estimatedSize: select.props.estimatedOptionHeight,
  37216. itemSize: (idx) => cachedHeights.value[idx]
  37217. };
  37218. });
  37219. const contains = (arr = [], target) => {
  37220. const {
  37221. props: {
  37222. valueKey
  37223. }
  37224. } = select;
  37225. if (!isObject$1(target)) {
  37226. return arr.includes(target);
  37227. }
  37228. return arr && arr.some((item) => {
  37229. return get(item, valueKey) === get(target, valueKey);
  37230. });
  37231. };
  37232. const isEqual = (selected, target) => {
  37233. if (!isObject$1(target)) {
  37234. return selected === target;
  37235. } else {
  37236. const {
  37237. valueKey
  37238. } = select.props;
  37239. return get(selected, valueKey) === get(target, valueKey);
  37240. }
  37241. };
  37242. const isItemSelected = (modelValue, target) => {
  37243. const {
  37244. valueKey
  37245. } = select.props;
  37246. if (select.props.multiple) {
  37247. return contains(modelValue, get(target, valueKey));
  37248. }
  37249. return isEqual(modelValue, get(target, valueKey));
  37250. };
  37251. const isItemDisabled = (modelValue, selected) => {
  37252. const {
  37253. disabled,
  37254. multiple,
  37255. multipleLimit
  37256. } = select.props;
  37257. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  37258. };
  37259. const isItemHovering = (target) => props.hoveringIndex === target;
  37260. const scrollToItem = (index) => {
  37261. const list = listRef.value;
  37262. if (list) {
  37263. list.scrollToItem(index);
  37264. }
  37265. };
  37266. const resetScrollTop = () => {
  37267. const list = listRef.value;
  37268. if (list) {
  37269. list.resetScrollTop();
  37270. }
  37271. };
  37272. expose({
  37273. listRef,
  37274. isSized,
  37275. isItemDisabled,
  37276. isItemHovering,
  37277. isItemSelected,
  37278. scrollToItem,
  37279. resetScrollTop
  37280. });
  37281. const Item = (itemProps) => {
  37282. const {
  37283. index,
  37284. data,
  37285. style
  37286. } = itemProps;
  37287. const sized = vue.unref(isSized);
  37288. const {
  37289. itemSize,
  37290. estimatedSize
  37291. } = vue.unref(listProps);
  37292. const {
  37293. modelValue
  37294. } = select.props;
  37295. const {
  37296. onSelect,
  37297. onHover
  37298. } = select;
  37299. const item = data[index];
  37300. if (item.type === "Group") {
  37301. return vue.createVNode(GroupItem, {
  37302. "item": item,
  37303. "style": style,
  37304. "height": sized ? itemSize : estimatedSize
  37305. }, null);
  37306. }
  37307. const isSelected = isItemSelected(modelValue, item);
  37308. const isDisabled = isItemDisabled(modelValue, isSelected);
  37309. const isHovering = isItemHovering(index);
  37310. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  37311. "selected": isSelected,
  37312. "disabled": item.disabled || isDisabled,
  37313. "created": !!item.created,
  37314. "hovering": isHovering,
  37315. "item": item,
  37316. "onSelect": onSelect,
  37317. "onHover": onHover
  37318. }), {
  37319. default: (props2) => {
  37320. var _a;
  37321. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props2)) || vue.createVNode("span", null, [item.label]);
  37322. }
  37323. });
  37324. };
  37325. const {
  37326. onKeyboardNavigate,
  37327. onKeyboardSelect
  37328. } = select;
  37329. const onForward = () => {
  37330. onKeyboardNavigate("forward");
  37331. };
  37332. const onBackward = () => {
  37333. onKeyboardNavigate("backward");
  37334. };
  37335. const onEscOrTab = () => {
  37336. select.expanded = false;
  37337. };
  37338. const onKeydown = (e) => {
  37339. const {
  37340. code
  37341. } = e;
  37342. const {
  37343. tab,
  37344. esc,
  37345. down,
  37346. up,
  37347. enter
  37348. } = EVENT_CODE;
  37349. if (code !== tab) {
  37350. e.preventDefault();
  37351. e.stopPropagation();
  37352. }
  37353. switch (code) {
  37354. case tab:
  37355. case esc: {
  37356. onEscOrTab();
  37357. break;
  37358. }
  37359. case down: {
  37360. onForward();
  37361. break;
  37362. }
  37363. case up: {
  37364. onBackward();
  37365. break;
  37366. }
  37367. case enter: {
  37368. onKeyboardSelect();
  37369. break;
  37370. }
  37371. }
  37372. };
  37373. return () => {
  37374. var _a;
  37375. const {
  37376. data,
  37377. width
  37378. } = props;
  37379. const {
  37380. height,
  37381. multiple,
  37382. scrollbarAlwaysOn
  37383. } = select.props;
  37384. if (data.length === 0) {
  37385. return vue.createVNode("div", {
  37386. "class": ns.b("dropdown"),
  37387. "style": {
  37388. width: `${width}px`
  37389. }
  37390. }, [(_a = slots.empty) == null ? void 0 : _a.call(slots)]);
  37391. }
  37392. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  37393. return vue.createVNode("div", {
  37394. "class": [ns.b("dropdown"), ns.is("multiple", multiple)]
  37395. }, [vue.createVNode(List, vue.mergeProps({
  37396. "ref": listRef
  37397. }, vue.unref(listProps), {
  37398. "className": ns.be("dropdown", "list"),
  37399. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  37400. "data": data,
  37401. "height": height,
  37402. "width": width,
  37403. "total": data.length,
  37404. "onKeydown": onKeydown
  37405. }), {
  37406. default: (props2) => vue.createVNode(Item, props2, null)
  37407. })]);
  37408. };
  37409. }
  37410. });
  37411. function useAllowCreate(props, states) {
  37412. const createOptionCount = vue.ref(0);
  37413. const cachedSelectedOption = vue.ref(null);
  37414. const enableAllowCreateMode = vue.computed(() => {
  37415. return props.allowCreate && props.filterable;
  37416. });
  37417. function hasExistingOption(query) {
  37418. const hasValue = (option) => option.value === query;
  37419. return props.options && props.options.some(hasValue) || states.createdOptions.some(hasValue);
  37420. }
  37421. function selectNewOption(option) {
  37422. if (!enableAllowCreateMode.value) {
  37423. return;
  37424. }
  37425. if (props.multiple && option.created) {
  37426. createOptionCount.value++;
  37427. } else {
  37428. cachedSelectedOption.value = option;
  37429. }
  37430. }
  37431. function createNewOption(query) {
  37432. if (enableAllowCreateMode.value) {
  37433. if (query && query.length > 0 && !hasExistingOption(query)) {
  37434. const newOption = {
  37435. value: query,
  37436. label: query,
  37437. created: true,
  37438. disabled: false
  37439. };
  37440. if (states.createdOptions.length >= createOptionCount.value) {
  37441. states.createdOptions[createOptionCount.value] = newOption;
  37442. } else {
  37443. states.createdOptions.push(newOption);
  37444. }
  37445. } else {
  37446. if (props.multiple) {
  37447. states.createdOptions.length = createOptionCount.value;
  37448. } else {
  37449. const selectedOption = cachedSelectedOption.value;
  37450. states.createdOptions.length = 0;
  37451. if (selectedOption && selectedOption.created) {
  37452. states.createdOptions.push(selectedOption);
  37453. }
  37454. }
  37455. }
  37456. }
  37457. }
  37458. function removeNewOption(option) {
  37459. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === option.label) {
  37460. return;
  37461. }
  37462. const idx = states.createdOptions.findIndex((it) => it.value === option.value);
  37463. if (~idx) {
  37464. states.createdOptions.splice(idx, 1);
  37465. createOptionCount.value--;
  37466. }
  37467. }
  37468. function clearAllNewOption() {
  37469. if (enableAllowCreateMode.value) {
  37470. states.createdOptions.length = 0;
  37471. createOptionCount.value = 0;
  37472. }
  37473. }
  37474. return {
  37475. createNewOption,
  37476. removeNewOption,
  37477. selectNewOption,
  37478. clearAllNewOption
  37479. };
  37480. }
  37481. const flattenOptions = (options) => {
  37482. const flattened = [];
  37483. options.forEach((option) => {
  37484. if (isArray$1(option.options)) {
  37485. flattened.push({
  37486. label: option.label,
  37487. isTitle: true,
  37488. type: "Group"
  37489. });
  37490. option.options.forEach((o) => {
  37491. flattened.push(o);
  37492. });
  37493. flattened.push({
  37494. type: "Group"
  37495. });
  37496. } else {
  37497. flattened.push(option);
  37498. }
  37499. });
  37500. return flattened;
  37501. };
  37502. function useInput(handleInput) {
  37503. const isComposing = vue.ref(false);
  37504. const handleCompositionStart = () => {
  37505. isComposing.value = true;
  37506. };
  37507. const handleCompositionUpdate = (event) => {
  37508. const text = event.target.value;
  37509. const lastCharacter = text[text.length - 1] || "";
  37510. isComposing.value = !isKorean(lastCharacter);
  37511. };
  37512. const handleCompositionEnd = (event) => {
  37513. if (isComposing.value) {
  37514. isComposing.value = false;
  37515. if (isFunction$1(handleInput)) {
  37516. handleInput(event);
  37517. }
  37518. }
  37519. };
  37520. return {
  37521. handleCompositionStart,
  37522. handleCompositionUpdate,
  37523. handleCompositionEnd
  37524. };
  37525. }
  37526. const DEFAULT_INPUT_PLACEHOLDER = "";
  37527. const MINIMUM_INPUT_WIDTH = 11;
  37528. const TAG_BASE_WIDTH = {
  37529. larget: 51,
  37530. default: 42,
  37531. small: 33
  37532. };
  37533. const useSelect$1 = (props, emit) => {
  37534. const { t } = useLocale();
  37535. const nsSelectV2 = useNamespace("select-v2");
  37536. const nsInput = useNamespace("input");
  37537. const { form: elForm, formItem: elFormItem } = useFormItem();
  37538. const states = vue.reactive({
  37539. inputValue: DEFAULT_INPUT_PLACEHOLDER,
  37540. displayInputValue: DEFAULT_INPUT_PLACEHOLDER,
  37541. calculatedWidth: 0,
  37542. cachedPlaceholder: "",
  37543. cachedOptions: [],
  37544. createdOptions: [],
  37545. createdLabel: "",
  37546. createdSelected: false,
  37547. currentPlaceholder: "",
  37548. hoveringIndex: -1,
  37549. comboBoxHovering: false,
  37550. isOnComposition: false,
  37551. isSilentBlur: false,
  37552. isComposing: false,
  37553. inputLength: 20,
  37554. selectWidth: 200,
  37555. initialInputHeight: 0,
  37556. previousQuery: null,
  37557. previousValue: void 0,
  37558. query: "",
  37559. selectedLabel: "",
  37560. softFocus: false,
  37561. tagInMultiLine: false
  37562. });
  37563. const selectedIndex = vue.ref(-1);
  37564. const popperSize = vue.ref(-1);
  37565. const controlRef = vue.ref(null);
  37566. const inputRef = vue.ref(null);
  37567. const menuRef = vue.ref(null);
  37568. const popper = vue.ref(null);
  37569. const selectRef = vue.ref(null);
  37570. const selectionRef = vue.ref(null);
  37571. const calculatorRef = vue.ref(null);
  37572. const expanded = vue.ref(false);
  37573. const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  37574. const popupHeight = vue.computed(() => {
  37575. const totalHeight = filteredOptions.value.length * 34;
  37576. return totalHeight > props.height ? props.height : totalHeight;
  37577. });
  37578. const hasModelValue = vue.computed(() => {
  37579. return !isNil(props.modelValue);
  37580. });
  37581. const showClearBtn = vue.computed(() => {
  37582. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : hasModelValue.value;
  37583. const criteria = props.clearable && !selectDisabled.value && states.comboBoxHovering && hasValue;
  37584. return criteria;
  37585. });
  37586. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : arrow_up_default);
  37587. const iconReverse = vue.computed(() => iconComponent.value && nsSelectV2.is("reverse", expanded.value));
  37588. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  37589. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  37590. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  37591. const emptyText = vue.computed(() => {
  37592. const options = filteredOptions.value;
  37593. if (props.loading) {
  37594. return props.loadingText || t("el.select.loading");
  37595. } else {
  37596. if (props.remote && states.inputValue === "" && options.length === 0)
  37597. return false;
  37598. if (props.filterable && states.inputValue && options.length > 0) {
  37599. return props.noMatchText || t("el.select.noMatch");
  37600. }
  37601. if (options.length === 0) {
  37602. return props.noDataText || t("el.select.noData");
  37603. }
  37604. }
  37605. return null;
  37606. });
  37607. const filteredOptions = vue.computed(() => {
  37608. const isValidOption = (o) => {
  37609. const query = states.inputValue;
  37610. const regexp = new RegExp(escapeStringRegexp(query), "i");
  37611. const containsQueryString = query ? regexp.test(o.label || "") : true;
  37612. return containsQueryString;
  37613. };
  37614. if (props.loading) {
  37615. return [];
  37616. }
  37617. return flattenOptions(props.options.concat(states.createdOptions).map((v) => {
  37618. if (isArray$1(v.options)) {
  37619. const filtered = v.options.filter(isValidOption);
  37620. if (filtered.length > 0) {
  37621. return {
  37622. ...v,
  37623. options: filtered
  37624. };
  37625. }
  37626. } else {
  37627. if (props.remote || isValidOption(v)) {
  37628. return v;
  37629. }
  37630. }
  37631. return null;
  37632. }).filter((v) => v !== null));
  37633. });
  37634. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => option.disabled));
  37635. const selectSize = useFormSize();
  37636. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  37637. const tagMaxWidth = vue.computed(() => {
  37638. const select = selectionRef.value;
  37639. const size = collapseTagSize.value || "default";
  37640. const paddingLeft = select ? Number.parseInt(getComputedStyle(select).paddingLeft) : 0;
  37641. const paddingRight = select ? Number.parseInt(getComputedStyle(select).paddingRight) : 0;
  37642. return states.selectWidth - paddingRight - paddingLeft - TAG_BASE_WIDTH[size];
  37643. });
  37644. const calculatePopperSize = () => {
  37645. var _a;
  37646. popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  37647. };
  37648. const inputWrapperStyle = vue.computed(() => {
  37649. return {
  37650. width: `${states.calculatedWidth === 0 ? MINIMUM_INPUT_WIDTH : Math.ceil(states.calculatedWidth) + MINIMUM_INPUT_WIDTH}px`
  37651. };
  37652. });
  37653. const shouldShowPlaceholder = vue.computed(() => {
  37654. if (isArray$1(props.modelValue)) {
  37655. return props.modelValue.length === 0 && !states.displayInputValue;
  37656. }
  37657. return props.filterable ? states.displayInputValue.length === 0 : true;
  37658. });
  37659. const currentPlaceholder = vue.computed(() => {
  37660. const _placeholder = props.placeholder || t("el.select.placeholder");
  37661. return props.multiple || isNil(props.modelValue) ? _placeholder : states.selectedLabel;
  37662. });
  37663. const popperRef = vue.computed(() => {
  37664. var _a, _b;
  37665. return (_b = (_a = popper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  37666. });
  37667. const indexRef = vue.computed(() => {
  37668. if (props.multiple) {
  37669. const len = props.modelValue.length;
  37670. if (props.modelValue.length > 0) {
  37671. return filteredOptions.value.findIndex((o) => o.value === props.modelValue[len - 1]);
  37672. }
  37673. } else {
  37674. if (props.modelValue) {
  37675. return filteredOptions.value.findIndex((o) => o.value === props.modelValue);
  37676. }
  37677. }
  37678. return -1;
  37679. });
  37680. const dropdownMenuVisible = vue.computed({
  37681. get() {
  37682. return expanded.value && emptyText.value !== false;
  37683. },
  37684. set(val) {
  37685. expanded.value = val;
  37686. }
  37687. });
  37688. const showTagList = vue.computed(() => states.cachedOptions.slice(0, props.maxCollapseTags));
  37689. const collapseTagList = vue.computed(() => states.cachedOptions.slice(props.maxCollapseTags));
  37690. const {
  37691. createNewOption,
  37692. removeNewOption,
  37693. selectNewOption,
  37694. clearAllNewOption
  37695. } = useAllowCreate(props, states);
  37696. const {
  37697. handleCompositionStart,
  37698. handleCompositionUpdate,
  37699. handleCompositionEnd
  37700. } = useInput((e) => onInput(e));
  37701. const focusAndUpdatePopup = () => {
  37702. var _a, _b, _c;
  37703. (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  37704. (_c = popper.value) == null ? void 0 : _c.updatePopper();
  37705. };
  37706. const toggleMenu = () => {
  37707. if (props.automaticDropdown)
  37708. return;
  37709. if (!selectDisabled.value) {
  37710. if (states.isComposing)
  37711. states.softFocus = true;
  37712. return vue.nextTick(() => {
  37713. var _a, _b;
  37714. expanded.value = !expanded.value;
  37715. (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  37716. });
  37717. }
  37718. };
  37719. const onInputChange = () => {
  37720. if (props.filterable && states.inputValue !== states.selectedLabel) {
  37721. states.query = states.selectedLabel;
  37722. }
  37723. handleQueryChange(states.inputValue);
  37724. return vue.nextTick(() => {
  37725. createNewOption(states.inputValue);
  37726. });
  37727. };
  37728. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  37729. const handleQueryChange = (val) => {
  37730. if (states.previousQuery === val) {
  37731. return;
  37732. }
  37733. states.previousQuery = val;
  37734. if (props.filterable && isFunction$1(props.filterMethod)) {
  37735. props.filterMethod(val);
  37736. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  37737. props.remoteMethod(val);
  37738. }
  37739. };
  37740. const emitChange = (val) => {
  37741. if (!isEqual$1(props.modelValue, val)) {
  37742. emit(CHANGE_EVENT, val);
  37743. }
  37744. };
  37745. const update = (val) => {
  37746. emit(UPDATE_MODEL_EVENT, val);
  37747. emitChange(val);
  37748. states.previousValue = val == null ? void 0 : val.toString();
  37749. };
  37750. const getValueIndex = (arr = [], value) => {
  37751. if (!isObject$1(value)) {
  37752. return arr.indexOf(value);
  37753. }
  37754. const valueKey = props.valueKey;
  37755. let index = -1;
  37756. arr.some((item, i) => {
  37757. if (get(item, valueKey) === get(value, valueKey)) {
  37758. index = i;
  37759. return true;
  37760. }
  37761. return false;
  37762. });
  37763. return index;
  37764. };
  37765. const getValueKey = (item) => {
  37766. return isObject$1(item) ? get(item, props.valueKey) : item;
  37767. };
  37768. const getLabel = (item) => {
  37769. return isObject$1(item) ? item.label : item;
  37770. };
  37771. const resetInputHeight = () => {
  37772. return vue.nextTick(() => {
  37773. var _a, _b;
  37774. if (!inputRef.value)
  37775. return;
  37776. const selection = selectionRef.value;
  37777. selectRef.value.height = selection.offsetHeight;
  37778. if (expanded.value && emptyText.value !== false) {
  37779. (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37780. }
  37781. });
  37782. };
  37783. const handleResize = () => {
  37784. var _a, _b;
  37785. resetInputWidth();
  37786. calculatePopperSize();
  37787. (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37788. if (props.multiple) {
  37789. return resetInputHeight();
  37790. }
  37791. };
  37792. const resetInputWidth = () => {
  37793. const select = selectionRef.value;
  37794. if (select) {
  37795. states.selectWidth = select.getBoundingClientRect().width;
  37796. }
  37797. };
  37798. const onSelect = (option, idx, byClick = true) => {
  37799. var _a, _b;
  37800. if (props.multiple) {
  37801. let selectedOptions = props.modelValue.slice();
  37802. const index = getValueIndex(selectedOptions, getValueKey(option));
  37803. if (index > -1) {
  37804. selectedOptions = [
  37805. ...selectedOptions.slice(0, index),
  37806. ...selectedOptions.slice(index + 1)
  37807. ];
  37808. states.cachedOptions.splice(index, 1);
  37809. removeNewOption(option);
  37810. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  37811. selectedOptions = [...selectedOptions, getValueKey(option)];
  37812. states.cachedOptions.push(option);
  37813. selectNewOption(option);
  37814. updateHoveringIndex(idx);
  37815. }
  37816. update(selectedOptions);
  37817. if (option.created) {
  37818. states.query = "";
  37819. handleQueryChange("");
  37820. states.inputLength = 20;
  37821. }
  37822. if (props.filterable && !props.reserveKeyword) {
  37823. (_b = (_a = inputRef.value).focus) == null ? void 0 : _b.call(_a);
  37824. onUpdateInputValue("");
  37825. }
  37826. if (props.filterable) {
  37827. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37828. }
  37829. resetInputHeight();
  37830. setSoftFocus();
  37831. } else {
  37832. selectedIndex.value = idx;
  37833. states.selectedLabel = option.label;
  37834. update(getValueKey(option));
  37835. expanded.value = false;
  37836. states.isComposing = false;
  37837. states.isSilentBlur = byClick;
  37838. selectNewOption(option);
  37839. if (!option.created) {
  37840. clearAllNewOption();
  37841. }
  37842. updateHoveringIndex(idx);
  37843. }
  37844. };
  37845. const deleteTag = (event, tag) => {
  37846. const { valueKey } = props;
  37847. const index = props.modelValue.indexOf(get(tag, valueKey));
  37848. if (index > -1 && !selectDisabled.value) {
  37849. const value = [
  37850. ...props.modelValue.slice(0, index),
  37851. ...props.modelValue.slice(index + 1)
  37852. ];
  37853. states.cachedOptions.splice(index, 1);
  37854. update(value);
  37855. emit("remove-tag", get(tag, valueKey));
  37856. states.softFocus = true;
  37857. removeNewOption(tag);
  37858. return vue.nextTick(focusAndUpdatePopup);
  37859. }
  37860. event.stopPropagation();
  37861. };
  37862. const handleFocus = (event) => {
  37863. const focused = states.isComposing;
  37864. states.isComposing = true;
  37865. if (!states.softFocus) {
  37866. if (!focused)
  37867. emit("focus", event);
  37868. } else {
  37869. states.softFocus = false;
  37870. }
  37871. };
  37872. const handleBlur = (event) => {
  37873. states.softFocus = false;
  37874. return vue.nextTick(() => {
  37875. var _a, _b;
  37876. (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  37877. if (calculatorRef.value) {
  37878. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37879. }
  37880. if (states.isSilentBlur) {
  37881. states.isSilentBlur = false;
  37882. } else {
  37883. if (states.isComposing) {
  37884. emit("blur", event);
  37885. }
  37886. }
  37887. states.isComposing = false;
  37888. });
  37889. };
  37890. const handleEsc = () => {
  37891. if (states.displayInputValue.length > 0) {
  37892. onUpdateInputValue("");
  37893. } else {
  37894. expanded.value = false;
  37895. }
  37896. };
  37897. const handleDel = (e) => {
  37898. if (states.displayInputValue.length === 0) {
  37899. e.preventDefault();
  37900. const selected = props.modelValue.slice();
  37901. selected.pop();
  37902. removeNewOption(states.cachedOptions.pop());
  37903. update(selected);
  37904. }
  37905. };
  37906. const handleClear = () => {
  37907. let emptyValue;
  37908. if (isArray$1(props.modelValue)) {
  37909. emptyValue = [];
  37910. } else {
  37911. emptyValue = void 0;
  37912. }
  37913. states.softFocus = true;
  37914. if (props.multiple) {
  37915. states.cachedOptions = [];
  37916. } else {
  37917. states.selectedLabel = "";
  37918. }
  37919. expanded.value = false;
  37920. update(emptyValue);
  37921. emit("clear");
  37922. clearAllNewOption();
  37923. return vue.nextTick(focusAndUpdatePopup);
  37924. };
  37925. const onUpdateInputValue = (val) => {
  37926. states.displayInputValue = val;
  37927. states.inputValue = val;
  37928. };
  37929. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  37930. const options = filteredOptions.value;
  37931. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value) {
  37932. return;
  37933. }
  37934. if (!expanded.value) {
  37935. return toggleMenu();
  37936. }
  37937. if (hoveringIndex === void 0) {
  37938. hoveringIndex = states.hoveringIndex;
  37939. }
  37940. let newIndex = -1;
  37941. if (direction === "forward") {
  37942. newIndex = hoveringIndex + 1;
  37943. if (newIndex >= options.length) {
  37944. newIndex = 0;
  37945. }
  37946. } else if (direction === "backward") {
  37947. newIndex = hoveringIndex - 1;
  37948. if (newIndex < 0 || newIndex >= options.length) {
  37949. newIndex = options.length - 1;
  37950. }
  37951. }
  37952. const option = options[newIndex];
  37953. if (option.disabled || option.type === "Group") {
  37954. return onKeyboardNavigate(direction, newIndex);
  37955. } else {
  37956. updateHoveringIndex(newIndex);
  37957. scrollToItem(newIndex);
  37958. }
  37959. };
  37960. const onKeyboardSelect = () => {
  37961. if (!expanded.value) {
  37962. return toggleMenu();
  37963. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  37964. onSelect(filteredOptions.value[states.hoveringIndex], states.hoveringIndex, false);
  37965. }
  37966. };
  37967. const updateHoveringIndex = (idx) => {
  37968. states.hoveringIndex = idx;
  37969. };
  37970. const resetHoveringIndex = () => {
  37971. states.hoveringIndex = -1;
  37972. };
  37973. const setSoftFocus = () => {
  37974. var _a;
  37975. const _input = inputRef.value;
  37976. if (_input) {
  37977. (_a = _input.focus) == null ? void 0 : _a.call(_input);
  37978. }
  37979. };
  37980. const onInput = (event) => {
  37981. const value = event.target.value;
  37982. onUpdateInputValue(value);
  37983. if (states.displayInputValue.length > 0 && !expanded.value) {
  37984. expanded.value = true;
  37985. }
  37986. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37987. if (props.multiple) {
  37988. resetInputHeight();
  37989. }
  37990. if (props.remote) {
  37991. debouncedOnInputChange();
  37992. } else {
  37993. return onInputChange();
  37994. }
  37995. };
  37996. const handleClickOutside = () => {
  37997. expanded.value = false;
  37998. return handleBlur();
  37999. };
  38000. const handleMenuEnter = () => {
  38001. states.inputValue = states.displayInputValue;
  38002. return vue.nextTick(() => {
  38003. if (~indexRef.value) {
  38004. updateHoveringIndex(indexRef.value);
  38005. scrollToItem(states.hoveringIndex);
  38006. }
  38007. });
  38008. };
  38009. const scrollToItem = (index) => {
  38010. menuRef.value.scrollToItem(index);
  38011. };
  38012. const initStates = () => {
  38013. resetHoveringIndex();
  38014. if (props.multiple) {
  38015. if (props.modelValue.length > 0) {
  38016. let initHovering = false;
  38017. states.cachedOptions.length = 0;
  38018. states.previousValue = props.modelValue.toString();
  38019. props.modelValue.forEach((selected) => {
  38020. const itemIndex = filteredOptions.value.findIndex((option) => getValueKey(option) === selected);
  38021. if (~itemIndex) {
  38022. states.cachedOptions.push(filteredOptions.value[itemIndex]);
  38023. if (!initHovering) {
  38024. updateHoveringIndex(itemIndex);
  38025. }
  38026. initHovering = true;
  38027. }
  38028. });
  38029. } else {
  38030. states.cachedOptions = [];
  38031. states.previousValue = void 0;
  38032. }
  38033. } else {
  38034. if (hasModelValue.value) {
  38035. states.previousValue = props.modelValue;
  38036. const options = filteredOptions.value;
  38037. const selectedItemIndex = options.findIndex((option) => getValueKey(option) === getValueKey(props.modelValue));
  38038. if (~selectedItemIndex) {
  38039. states.selectedLabel = options[selectedItemIndex].label;
  38040. updateHoveringIndex(selectedItemIndex);
  38041. } else {
  38042. states.selectedLabel = `${props.modelValue}`;
  38043. }
  38044. } else {
  38045. states.selectedLabel = "";
  38046. states.previousValue = void 0;
  38047. }
  38048. }
  38049. clearAllNewOption();
  38050. calculatePopperSize();
  38051. };
  38052. vue.watch(expanded, (val) => {
  38053. var _a, _b;
  38054. emit("visible-change", val);
  38055. if (val) {
  38056. (_b = (_a = popper.value).update) == null ? void 0 : _b.call(_a);
  38057. } else {
  38058. states.displayInputValue = "";
  38059. states.previousQuery = null;
  38060. createNewOption("");
  38061. }
  38062. });
  38063. vue.watch(() => props.modelValue, (val, oldVal) => {
  38064. var _a;
  38065. if (!val || val.toString() !== states.previousValue) {
  38066. initStates();
  38067. }
  38068. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  38069. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  38070. }
  38071. }, {
  38072. deep: true
  38073. });
  38074. vue.watch(() => props.options, () => {
  38075. const input = inputRef.value;
  38076. if (!input || input && document.activeElement !== input) {
  38077. initStates();
  38078. }
  38079. }, {
  38080. deep: true
  38081. });
  38082. vue.watch(filteredOptions, () => {
  38083. return vue.nextTick(menuRef.value.resetScrollTop);
  38084. });
  38085. vue.watch(() => dropdownMenuVisible.value, (val) => {
  38086. if (!val) {
  38087. resetHoveringIndex();
  38088. }
  38089. });
  38090. vue.onMounted(() => {
  38091. initStates();
  38092. });
  38093. useResizeObserver(selectRef, handleResize);
  38094. return {
  38095. collapseTagSize,
  38096. currentPlaceholder,
  38097. expanded,
  38098. emptyText,
  38099. popupHeight,
  38100. debounce: debounce$1,
  38101. filteredOptions,
  38102. iconComponent,
  38103. iconReverse,
  38104. inputWrapperStyle,
  38105. popperSize,
  38106. dropdownMenuVisible,
  38107. hasModelValue,
  38108. shouldShowPlaceholder,
  38109. selectDisabled,
  38110. selectSize,
  38111. showClearBtn,
  38112. states,
  38113. tagMaxWidth,
  38114. nsSelectV2,
  38115. nsInput,
  38116. calculatorRef,
  38117. controlRef,
  38118. inputRef,
  38119. menuRef,
  38120. popper,
  38121. selectRef,
  38122. selectionRef,
  38123. popperRef,
  38124. validateState,
  38125. validateIcon,
  38126. showTagList,
  38127. collapseTagList,
  38128. debouncedOnInputChange,
  38129. deleteTag,
  38130. getLabel,
  38131. getValueKey,
  38132. handleBlur,
  38133. handleClear,
  38134. handleClickOutside,
  38135. handleDel,
  38136. handleEsc,
  38137. handleFocus,
  38138. handleMenuEnter,
  38139. handleResize,
  38140. toggleMenu,
  38141. scrollTo: scrollToItem,
  38142. onInput,
  38143. onKeyboardNavigate,
  38144. onKeyboardSelect,
  38145. onSelect,
  38146. onHover: updateHoveringIndex,
  38147. onUpdateInputValue,
  38148. handleCompositionStart,
  38149. handleCompositionEnd,
  38150. handleCompositionUpdate
  38151. };
  38152. };
  38153. var useSelect$2 = useSelect$1;
  38154. const _sfc_main$B = vue.defineComponent({
  38155. name: "ElSelectV2",
  38156. components: {
  38157. ElSelectMenu,
  38158. ElTag,
  38159. ElTooltip,
  38160. ElIcon
  38161. },
  38162. directives: { ClickOutside, ModelText: vue.vModelText },
  38163. props: SelectProps,
  38164. emits: [
  38165. UPDATE_MODEL_EVENT,
  38166. CHANGE_EVENT,
  38167. "remove-tag",
  38168. "clear",
  38169. "visible-change",
  38170. "focus",
  38171. "blur"
  38172. ],
  38173. setup(props, { emit }) {
  38174. const modelValue = vue.computed(() => {
  38175. const { modelValue: rawModelValue, multiple } = props;
  38176. const fallback = multiple ? [] : void 0;
  38177. if (isArray$1(rawModelValue)) {
  38178. return multiple ? rawModelValue : fallback;
  38179. }
  38180. return multiple ? fallback : rawModelValue;
  38181. });
  38182. const API = useSelect$2(vue.reactive({
  38183. ...vue.toRefs(props),
  38184. modelValue
  38185. }), emit);
  38186. vue.provide(selectV2InjectionKey, {
  38187. props: vue.reactive({
  38188. ...vue.toRefs(props),
  38189. height: API.popupHeight,
  38190. modelValue
  38191. }),
  38192. popper: API.popper,
  38193. onSelect: API.onSelect,
  38194. onHover: API.onHover,
  38195. onKeyboardNavigate: API.onKeyboardNavigate,
  38196. onKeyboardSelect: API.onKeyboardSelect
  38197. });
  38198. return {
  38199. ...API,
  38200. modelValue
  38201. };
  38202. }
  38203. });
  38204. const _hoisted_1$g = { key: 0 };
  38205. const _hoisted_2$b = ["id", "autocomplete", "aria-expanded", "aria-labelledby", "disabled", "readonly", "name", "unselectable"];
  38206. const _hoisted_3$5 = ["textContent"];
  38207. const _hoisted_4$3 = ["id", "aria-labelledby", "aria-expanded", "autocomplete", "disabled", "name", "readonly", "unselectable"];
  38208. const _hoisted_5$2 = ["textContent"];
  38209. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  38210. const _component_el_tag = vue.resolveComponent("el-tag");
  38211. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  38212. const _component_el_icon = vue.resolveComponent("el-icon");
  38213. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  38214. const _directive_model_text = vue.resolveDirective("model-text");
  38215. const _directive_click_outside = vue.resolveDirective("click-outside");
  38216. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  38217. ref: "selectRef",
  38218. class: vue.normalizeClass([_ctx.nsSelectV2.b(), _ctx.nsSelectV2.m(_ctx.selectSize)]),
  38219. onClick: _cache[24] || (_cache[24] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"])),
  38220. onMouseenter: _cache[25] || (_cache[25] = ($event) => _ctx.states.comboBoxHovering = true),
  38221. onMouseleave: _cache[26] || (_cache[26] = ($event) => _ctx.states.comboBoxHovering = false)
  38222. }, [
  38223. vue.createVNode(_component_el_tooltip, {
  38224. ref: "popper",
  38225. visible: _ctx.dropdownMenuVisible,
  38226. teleported: _ctx.teleported,
  38227. "popper-class": [_ctx.nsSelectV2.e("popper"), _ctx.popperClass],
  38228. "gpu-acceleration": false,
  38229. "stop-popper-mouse-event": false,
  38230. "popper-options": _ctx.popperOptions,
  38231. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  38232. effect: _ctx.effect,
  38233. placement: _ctx.placement,
  38234. pure: "",
  38235. transition: `${_ctx.nsSelectV2.namespace.value}-zoom-in-top`,
  38236. trigger: "click",
  38237. persistent: _ctx.persistent,
  38238. onBeforeShow: _ctx.handleMenuEnter,
  38239. onHide: _cache[23] || (_cache[23] = ($event) => _ctx.states.inputValue = _ctx.states.displayInputValue)
  38240. }, {
  38241. default: vue.withCtx(() => [
  38242. vue.createElementVNode("div", {
  38243. ref: "selectionRef",
  38244. class: vue.normalizeClass([
  38245. _ctx.nsSelectV2.e("wrapper"),
  38246. _ctx.nsSelectV2.is("focused", _ctx.states.isComposing || _ctx.expanded),
  38247. _ctx.nsSelectV2.is("hovering", _ctx.states.comboBoxHovering),
  38248. _ctx.nsSelectV2.is("filterable", _ctx.filterable),
  38249. _ctx.nsSelectV2.is("disabled", _ctx.selectDisabled)
  38250. ])
  38251. }, [
  38252. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  38253. vue.renderSlot(_ctx.$slots, "prefix")
  38254. ])) : vue.createCommentVNode("v-if", true),
  38255. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  38256. key: 1,
  38257. class: vue.normalizeClass(_ctx.nsSelectV2.e("selection"))
  38258. }, [
  38259. _ctx.collapseTags && _ctx.modelValue.length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  38260. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  38261. return vue.openBlock(), vue.createElementBlock("div", {
  38262. key: _ctx.getValueKey(item),
  38263. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  38264. }, [
  38265. vue.createVNode(_component_el_tag, {
  38266. closable: !_ctx.selectDisabled && !(item == null ? void 0 : item.disable),
  38267. size: _ctx.collapseTagSize,
  38268. type: "info",
  38269. "disable-transitions": "",
  38270. onClose: ($event) => _ctx.deleteTag($event, item)
  38271. }, {
  38272. default: vue.withCtx(() => [
  38273. vue.createElementVNode("span", {
  38274. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  38275. style: vue.normalizeStyle({
  38276. maxWidth: `${_ctx.tagMaxWidth}px`
  38277. })
  38278. }, vue.toDisplayString(item == null ? void 0 : item.label), 7)
  38279. ]),
  38280. _: 2
  38281. }, 1032, ["closable", "size", "onClose"])
  38282. ], 2);
  38283. }), 128)),
  38284. vue.createElementVNode("div", {
  38285. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  38286. }, [
  38287. _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tag, {
  38288. key: 0,
  38289. closable: false,
  38290. size: _ctx.collapseTagSize,
  38291. type: "info",
  38292. "disable-transitions": ""
  38293. }, {
  38294. default: vue.withCtx(() => [
  38295. _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  38296. key: 0,
  38297. disabled: _ctx.dropdownMenuVisible,
  38298. "fallback-placements": ["bottom", "top", "right", "left"],
  38299. effect: _ctx.effect,
  38300. placement: "bottom",
  38301. teleported: false
  38302. }, {
  38303. default: vue.withCtx(() => [
  38304. vue.createElementVNode("span", {
  38305. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  38306. style: vue.normalizeStyle({
  38307. maxWidth: `${_ctx.tagMaxWidth}px`
  38308. })
  38309. }, "+ " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 7)
  38310. ]),
  38311. content: vue.withCtx(() => [
  38312. vue.createElementVNode("div", {
  38313. class: vue.normalizeClass(_ctx.nsSelectV2.e("selection"))
  38314. }, [
  38315. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (selected) => {
  38316. return vue.openBlock(), vue.createElementBlock("div", {
  38317. key: _ctx.getValueKey(selected),
  38318. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  38319. }, [
  38320. vue.createVNode(_component_el_tag, {
  38321. closable: !_ctx.selectDisabled && !selected.disabled,
  38322. size: _ctx.collapseTagSize,
  38323. class: "in-tooltip",
  38324. type: "info",
  38325. "disable-transitions": "",
  38326. onClose: ($event) => _ctx.deleteTag($event, selected)
  38327. }, {
  38328. default: vue.withCtx(() => [
  38329. vue.createElementVNode("span", {
  38330. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  38331. style: vue.normalizeStyle({
  38332. maxWidth: `${_ctx.tagMaxWidth}px`
  38333. })
  38334. }, vue.toDisplayString(_ctx.getLabel(selected)), 7)
  38335. ]),
  38336. _: 2
  38337. }, 1032, ["closable", "size", "onClose"])
  38338. ], 2);
  38339. }), 128))
  38340. ], 2)
  38341. ]),
  38342. _: 1
  38343. }, 8, ["disabled", "effect"])) : (vue.openBlock(), vue.createElementBlock("span", {
  38344. key: 1,
  38345. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  38346. style: vue.normalizeStyle({
  38347. maxWidth: `${_ctx.tagMaxWidth}px`
  38348. })
  38349. }, "+ " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 7))
  38350. ]),
  38351. _: 1
  38352. }, 8, ["size"])) : vue.createCommentVNode("v-if", true)
  38353. ], 2)
  38354. ], 64)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.states.cachedOptions, (selected) => {
  38355. return vue.openBlock(), vue.createElementBlock("div", {
  38356. key: _ctx.getValueKey(selected),
  38357. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  38358. }, [
  38359. vue.createVNode(_component_el_tag, {
  38360. closable: !_ctx.selectDisabled && !selected.disabled,
  38361. size: _ctx.collapseTagSize,
  38362. type: "info",
  38363. "disable-transitions": "",
  38364. onClose: ($event) => _ctx.deleteTag($event, selected)
  38365. }, {
  38366. default: vue.withCtx(() => [
  38367. vue.createElementVNode("span", {
  38368. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  38369. style: vue.normalizeStyle({
  38370. maxWidth: `${_ctx.tagMaxWidth}px`
  38371. })
  38372. }, vue.toDisplayString(_ctx.getLabel(selected)), 7)
  38373. ]),
  38374. _: 2
  38375. }, 1032, ["closable", "size", "onClose"])
  38376. ], 2);
  38377. }), 128)),
  38378. vue.createElementVNode("div", {
  38379. class: vue.normalizeClass([
  38380. _ctx.nsSelectV2.e("selected-item"),
  38381. _ctx.nsSelectV2.e("input-wrapper")
  38382. ]),
  38383. style: vue.normalizeStyle(_ctx.inputWrapperStyle)
  38384. }, [
  38385. vue.withDirectives(vue.createElementVNode("input", {
  38386. id: _ctx.id,
  38387. ref: "inputRef",
  38388. autocomplete: _ctx.autocomplete,
  38389. "aria-autocomplete": "list",
  38390. "aria-haspopup": "listbox",
  38391. autocapitalize: "off",
  38392. "aria-expanded": _ctx.expanded,
  38393. "aria-labelledby": _ctx.label,
  38394. class: vue.normalizeClass([
  38395. _ctx.nsSelectV2.is(_ctx.selectSize),
  38396. _ctx.nsSelectV2.e("combobox-input")
  38397. ]),
  38398. disabled: _ctx.disabled,
  38399. role: "combobox",
  38400. readonly: !_ctx.filterable,
  38401. spellcheck: "false",
  38402. type: "text",
  38403. name: _ctx.name,
  38404. unselectable: _ctx.expanded ? "on" : void 0,
  38405. "onUpdate:modelValue": _cache[0] || (_cache[0] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args)),
  38406. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  38407. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  38408. onInput: _cache[3] || (_cache[3] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  38409. onCompositionstart: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  38410. onCompositionupdate: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  38411. onCompositionend: _cache[6] || (_cache[6] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  38412. onKeydown: [
  38413. _cache[7] || (_cache[7] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  38414. _cache[8] || (_cache[8] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  38415. _cache[9] || (_cache[9] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  38416. _cache[10] || (_cache[10] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  38417. _cache[11] || (_cache[11] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  38418. ]
  38419. }, null, 42, _hoisted_2$b), [
  38420. [_directive_model_text, _ctx.states.displayInputValue]
  38421. ]),
  38422. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  38423. key: 0,
  38424. ref: "calculatorRef",
  38425. "aria-hidden": "true",
  38426. class: vue.normalizeClass(_ctx.nsSelectV2.e("input-calculator")),
  38427. textContent: vue.toDisplayString(_ctx.states.displayInputValue)
  38428. }, null, 10, _hoisted_3$5)) : vue.createCommentVNode("v-if", true)
  38429. ], 6)
  38430. ], 2)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  38431. vue.createElementVNode("div", {
  38432. class: vue.normalizeClass([
  38433. _ctx.nsSelectV2.e("selected-item"),
  38434. _ctx.nsSelectV2.e("input-wrapper")
  38435. ])
  38436. }, [
  38437. vue.withDirectives(vue.createElementVNode("input", {
  38438. id: _ctx.id,
  38439. ref: "inputRef",
  38440. "aria-autocomplete": "list",
  38441. "aria-haspopup": "listbox",
  38442. "aria-labelledby": _ctx.label,
  38443. "aria-expanded": _ctx.expanded,
  38444. autocapitalize: "off",
  38445. autocomplete: _ctx.autocomplete,
  38446. class: vue.normalizeClass(_ctx.nsSelectV2.e("combobox-input")),
  38447. disabled: _ctx.disabled,
  38448. name: _ctx.name,
  38449. role: "combobox",
  38450. readonly: !_ctx.filterable,
  38451. spellcheck: "false",
  38452. type: "text",
  38453. unselectable: _ctx.expanded ? "on" : void 0,
  38454. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  38455. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  38456. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  38457. onFocus: _cache[15] || (_cache[15] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  38458. onBlur: _cache[16] || (_cache[16] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  38459. onInput: _cache[17] || (_cache[17] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  38460. onKeydown: [
  38461. _cache[18] || (_cache[18] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  38462. _cache[19] || (_cache[19] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  38463. _cache[20] || (_cache[20] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  38464. _cache[21] || (_cache[21] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"]))
  38465. ],
  38466. "onUpdate:modelValue": _cache[22] || (_cache[22] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args))
  38467. }, null, 42, _hoisted_4$3), [
  38468. [_directive_model_text, _ctx.states.displayInputValue]
  38469. ])
  38470. ], 2),
  38471. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  38472. key: 0,
  38473. ref: "calculatorRef",
  38474. "aria-hidden": "true",
  38475. class: vue.normalizeClass([
  38476. _ctx.nsSelectV2.e("selected-item"),
  38477. _ctx.nsSelectV2.e("input-calculator")
  38478. ]),
  38479. textContent: vue.toDisplayString(_ctx.states.displayInputValue)
  38480. }, null, 10, _hoisted_5$2)) : vue.createCommentVNode("v-if", true)
  38481. ], 64)),
  38482. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("span", {
  38483. key: 3,
  38484. class: vue.normalizeClass([
  38485. _ctx.nsSelectV2.e("placeholder"),
  38486. _ctx.nsSelectV2.is("transparent", _ctx.multiple ? _ctx.modelValue.length === 0 : !_ctx.hasModelValue)
  38487. ])
  38488. }, vue.toDisplayString(_ctx.currentPlaceholder), 3)) : vue.createCommentVNode("v-if", true),
  38489. vue.createElementVNode("span", {
  38490. class: vue.normalizeClass(_ctx.nsSelectV2.e("suffix"))
  38491. }, [
  38492. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  38493. key: 0,
  38494. class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  38495. }, {
  38496. default: vue.withCtx(() => [
  38497. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  38498. ]),
  38499. _: 1
  38500. }, 8, ["class"])), [
  38501. [vue.vShow, !_ctx.showClearBtn]
  38502. ]) : vue.createCommentVNode("v-if", true),
  38503. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  38504. key: 1,
  38505. class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon")]),
  38506. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  38507. }, {
  38508. default: vue.withCtx(() => [
  38509. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  38510. ]),
  38511. _: 1
  38512. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  38513. _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  38514. key: 2,
  38515. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  38516. }, {
  38517. default: vue.withCtx(() => [
  38518. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  38519. ]),
  38520. _: 1
  38521. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  38522. ], 2)
  38523. ], 2)
  38524. ]),
  38525. content: vue.withCtx(() => [
  38526. vue.createVNode(_component_el_select_menu, {
  38527. ref: "menuRef",
  38528. data: _ctx.filteredOptions,
  38529. width: _ctx.popperSize,
  38530. "hovering-index": _ctx.states.hoveringIndex,
  38531. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  38532. }, {
  38533. default: vue.withCtx((scope) => [
  38534. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  38535. ]),
  38536. empty: vue.withCtx(() => [
  38537. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  38538. vue.createElementVNode("p", {
  38539. class: vue.normalizeClass(_ctx.nsSelectV2.e("empty"))
  38540. }, vue.toDisplayString(_ctx.emptyText ? _ctx.emptyText : ""), 3)
  38541. ])
  38542. ]),
  38543. _: 3
  38544. }, 8, ["data", "width", "hovering-index", "scrollbar-always-on"])
  38545. ]),
  38546. _: 3
  38547. }, 8, ["visible", "teleported", "popper-class", "popper-options", "effect", "placement", "transition", "persistent", "onBeforeShow"])
  38548. ], 34)), [
  38549. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  38550. ]);
  38551. }
  38552. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  38553. Select.install = (app) => {
  38554. app.component(Select.name, Select);
  38555. };
  38556. const _Select = Select;
  38557. const ElSelectV2 = _Select;
  38558. const skeletonProps = buildProps({
  38559. animated: {
  38560. type: Boolean,
  38561. default: false
  38562. },
  38563. count: {
  38564. type: Number,
  38565. default: 1
  38566. },
  38567. rows: {
  38568. type: Number,
  38569. default: 3
  38570. },
  38571. loading: {
  38572. type: Boolean,
  38573. default: true
  38574. },
  38575. throttle: {
  38576. type: Number
  38577. }
  38578. });
  38579. const skeletonItemProps = buildProps({
  38580. variant: {
  38581. type: String,
  38582. values: [
  38583. "circle",
  38584. "rect",
  38585. "h1",
  38586. "h3",
  38587. "text",
  38588. "caption",
  38589. "p",
  38590. "image",
  38591. "button"
  38592. ],
  38593. default: "text"
  38594. }
  38595. });
  38596. const __default__$t = vue.defineComponent({
  38597. name: "ElSkeletonItem"
  38598. });
  38599. const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
  38600. ...__default__$t,
  38601. props: skeletonItemProps,
  38602. setup(__props) {
  38603. const ns = useNamespace("skeleton");
  38604. return (_ctx, _cache) => {
  38605. return vue.openBlock(), vue.createElementBlock("div", {
  38606. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  38607. }, [
  38608. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  38609. ], 2);
  38610. };
  38611. }
  38612. });
  38613. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__file", "skeleton-item.vue"]]);
  38614. const __default__$s = vue.defineComponent({
  38615. name: "ElSkeleton"
  38616. });
  38617. const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
  38618. ...__default__$s,
  38619. props: skeletonProps,
  38620. setup(__props, { expose }) {
  38621. const props = __props;
  38622. const ns = useNamespace("skeleton");
  38623. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  38624. expose({
  38625. uiLoading
  38626. });
  38627. return (_ctx, _cache) => {
  38628. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  38629. key: 0,
  38630. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  38631. }, _ctx.$attrs), [
  38632. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  38633. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  38634. _ctx.loading ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  38635. vue.createVNode(SkeletonItem, {
  38636. class: vue.normalizeClass(vue.unref(ns).is("first")),
  38637. variant: "p"
  38638. }, null, 8, ["class"]),
  38639. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  38640. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  38641. key: item,
  38642. class: vue.normalizeClass([
  38643. vue.unref(ns).e("paragraph"),
  38644. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  38645. ]),
  38646. variant: "p"
  38647. }, null, 8, ["class"]);
  38648. }), 128))
  38649. ]) : vue.createCommentVNode("v-if", true)
  38650. ], 64);
  38651. }), 128))
  38652. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  38653. };
  38654. }
  38655. });
  38656. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__file", "skeleton.vue"]]);
  38657. const ElSkeleton = withInstall(Skeleton, {
  38658. SkeletonItem
  38659. });
  38660. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  38661. const sliderContextKey = Symbol("sliderContextKey");
  38662. const sliderProps = buildProps({
  38663. modelValue: {
  38664. type: definePropType([Number, Array]),
  38665. default: 0
  38666. },
  38667. id: {
  38668. type: String,
  38669. default: void 0
  38670. },
  38671. min: {
  38672. type: Number,
  38673. default: 0
  38674. },
  38675. max: {
  38676. type: Number,
  38677. default: 100
  38678. },
  38679. step: {
  38680. type: Number,
  38681. default: 1
  38682. },
  38683. showInput: Boolean,
  38684. showInputControls: {
  38685. type: Boolean,
  38686. default: true
  38687. },
  38688. size: useSizeProp,
  38689. inputSize: useSizeProp,
  38690. showStops: Boolean,
  38691. showTooltip: {
  38692. type: Boolean,
  38693. default: true
  38694. },
  38695. formatTooltip: {
  38696. type: definePropType(Function),
  38697. default: void 0
  38698. },
  38699. disabled: Boolean,
  38700. range: Boolean,
  38701. vertical: Boolean,
  38702. height: String,
  38703. debounce: {
  38704. type: Number,
  38705. default: 300
  38706. },
  38707. label: {
  38708. type: String,
  38709. default: void 0
  38710. },
  38711. rangeStartLabel: {
  38712. type: String,
  38713. default: void 0
  38714. },
  38715. rangeEndLabel: {
  38716. type: String,
  38717. default: void 0
  38718. },
  38719. formatValueText: {
  38720. type: definePropType(Function),
  38721. default: void 0
  38722. },
  38723. tooltipClass: {
  38724. type: String,
  38725. default: void 0
  38726. },
  38727. placement: {
  38728. type: String,
  38729. values: Ee,
  38730. default: "top"
  38731. },
  38732. marks: {
  38733. type: definePropType(Object)
  38734. },
  38735. validateEvent: {
  38736. type: Boolean,
  38737. default: true
  38738. }
  38739. });
  38740. const isValidValue$1 = (value) => isNumber$1(value) || isArray$1(value) && value.every(isNumber$1);
  38741. const sliderEmits = {
  38742. [UPDATE_MODEL_EVENT]: isValidValue$1,
  38743. [INPUT_EVENT]: isValidValue$1,
  38744. [CHANGE_EVENT]: isValidValue$1
  38745. };
  38746. const useLifecycle = (props, initData, resetSize) => {
  38747. const sliderWrapper = vue.ref();
  38748. vue.onMounted(async () => {
  38749. if (props.range) {
  38750. if (Array.isArray(props.modelValue)) {
  38751. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  38752. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  38753. } else {
  38754. initData.firstValue = props.min;
  38755. initData.secondValue = props.max;
  38756. }
  38757. initData.oldValue = [initData.firstValue, initData.secondValue];
  38758. } else {
  38759. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  38760. initData.firstValue = props.min;
  38761. } else {
  38762. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  38763. }
  38764. initData.oldValue = initData.firstValue;
  38765. }
  38766. useEventListener(window, "resize", resetSize);
  38767. await vue.nextTick();
  38768. resetSize();
  38769. });
  38770. return {
  38771. sliderWrapper
  38772. };
  38773. };
  38774. const useMarks = (props) => {
  38775. return vue.computed(() => {
  38776. if (!props.marks) {
  38777. return [];
  38778. }
  38779. const marksKeys = Object.keys(props.marks);
  38780. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  38781. point,
  38782. position: (point - props.min) * 100 / (props.max - props.min),
  38783. mark: props.marks[point]
  38784. }));
  38785. });
  38786. };
  38787. const useSlide = (props, initData, emit) => {
  38788. const { form: elForm, formItem: elFormItem } = useFormItem();
  38789. const slider = vue.shallowRef();
  38790. const firstButton = vue.ref();
  38791. const secondButton = vue.ref();
  38792. const buttonRefs = {
  38793. firstButton,
  38794. secondButton
  38795. };
  38796. const sliderDisabled = vue.computed(() => {
  38797. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  38798. });
  38799. const minValue = vue.computed(() => {
  38800. return Math.min(initData.firstValue, initData.secondValue);
  38801. });
  38802. const maxValue = vue.computed(() => {
  38803. return Math.max(initData.firstValue, initData.secondValue);
  38804. });
  38805. const barSize = vue.computed(() => {
  38806. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  38807. });
  38808. const barStart = vue.computed(() => {
  38809. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  38810. });
  38811. const runwayStyle = vue.computed(() => {
  38812. return props.vertical ? { height: props.height } : {};
  38813. });
  38814. const barStyle = vue.computed(() => {
  38815. return props.vertical ? {
  38816. height: barSize.value,
  38817. bottom: barStart.value
  38818. } : {
  38819. width: barSize.value,
  38820. left: barStart.value
  38821. };
  38822. });
  38823. const resetSize = () => {
  38824. if (slider.value) {
  38825. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  38826. }
  38827. };
  38828. const getButtonRefByPercent = (percent) => {
  38829. const targetValue = props.min + percent * (props.max - props.min) / 100;
  38830. if (!props.range) {
  38831. return firstButton;
  38832. }
  38833. let buttonRefName;
  38834. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  38835. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  38836. } else {
  38837. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  38838. }
  38839. return buttonRefs[buttonRefName];
  38840. };
  38841. const setPosition = (percent) => {
  38842. const buttonRef = getButtonRefByPercent(percent);
  38843. buttonRef.value.setPosition(percent);
  38844. return buttonRef;
  38845. };
  38846. const setFirstValue = (firstValue) => {
  38847. initData.firstValue = firstValue;
  38848. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  38849. };
  38850. const setSecondValue = (secondValue) => {
  38851. initData.secondValue = secondValue;
  38852. if (props.range) {
  38853. _emit([minValue.value, maxValue.value]);
  38854. }
  38855. };
  38856. const _emit = (val) => {
  38857. emit(UPDATE_MODEL_EVENT, val);
  38858. emit(INPUT_EVENT, val);
  38859. };
  38860. const emitChange = async () => {
  38861. await vue.nextTick();
  38862. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  38863. };
  38864. const handleSliderPointerEvent = (event) => {
  38865. var _a, _b, _c, _d, _e, _f;
  38866. if (sliderDisabled.value || initData.dragging)
  38867. return;
  38868. resetSize();
  38869. let newPercent = 0;
  38870. if (props.vertical) {
  38871. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  38872. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  38873. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  38874. } else {
  38875. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  38876. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  38877. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  38878. }
  38879. if (newPercent < 0 || newPercent > 100)
  38880. return;
  38881. return setPosition(newPercent);
  38882. };
  38883. const onSliderWrapperPrevent = (event) => {
  38884. var _a, _b;
  38885. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  38886. event.preventDefault();
  38887. }
  38888. };
  38889. const onSliderDown = async (event) => {
  38890. const buttonRef = handleSliderPointerEvent(event);
  38891. if (buttonRef) {
  38892. await vue.nextTick();
  38893. buttonRef.value.onButtonDown(event);
  38894. }
  38895. };
  38896. const onSliderClick = (event) => {
  38897. const buttonRef = handleSliderPointerEvent(event);
  38898. if (buttonRef) {
  38899. emitChange();
  38900. }
  38901. };
  38902. return {
  38903. elFormItem,
  38904. slider,
  38905. firstButton,
  38906. secondButton,
  38907. sliderDisabled,
  38908. minValue,
  38909. maxValue,
  38910. runwayStyle,
  38911. barStyle,
  38912. resetSize,
  38913. setPosition,
  38914. emitChange,
  38915. onSliderWrapperPrevent,
  38916. onSliderClick,
  38917. onSliderDown,
  38918. setFirstValue,
  38919. setSecondValue
  38920. };
  38921. };
  38922. const { left, down, right, up, home, end, pageUp, pageDown } = EVENT_CODE;
  38923. const useTooltip = (props, formatTooltip, showTooltip) => {
  38924. const tooltip = vue.ref();
  38925. const tooltipVisible = vue.ref(false);
  38926. const enableFormat = vue.computed(() => {
  38927. return formatTooltip.value instanceof Function;
  38928. });
  38929. const formatValue = vue.computed(() => {
  38930. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  38931. });
  38932. const displayTooltip = debounce(() => {
  38933. showTooltip.value && (tooltipVisible.value = true);
  38934. }, 50);
  38935. const hideTooltip = debounce(() => {
  38936. showTooltip.value && (tooltipVisible.value = false);
  38937. }, 50);
  38938. return {
  38939. tooltip,
  38940. tooltipVisible,
  38941. formatValue,
  38942. displayTooltip,
  38943. hideTooltip
  38944. };
  38945. };
  38946. const useSliderButton = (props, initData, emit) => {
  38947. const {
  38948. disabled,
  38949. min,
  38950. max,
  38951. step,
  38952. showTooltip,
  38953. precision,
  38954. sliderSize,
  38955. formatTooltip,
  38956. emitChange,
  38957. resetSize,
  38958. updateDragging
  38959. } = vue.inject(sliderContextKey);
  38960. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  38961. const button = vue.ref();
  38962. const currentPosition = vue.computed(() => {
  38963. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  38964. });
  38965. const wrapperStyle = vue.computed(() => {
  38966. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  38967. });
  38968. const handleMouseEnter = () => {
  38969. initData.hovering = true;
  38970. displayTooltip();
  38971. };
  38972. const handleMouseLeave = () => {
  38973. initData.hovering = false;
  38974. if (!initData.dragging) {
  38975. hideTooltip();
  38976. }
  38977. };
  38978. const onButtonDown = (event) => {
  38979. if (disabled.value)
  38980. return;
  38981. event.preventDefault();
  38982. onDragStart(event);
  38983. window.addEventListener("mousemove", onDragging);
  38984. window.addEventListener("touchmove", onDragging);
  38985. window.addEventListener("mouseup", onDragEnd);
  38986. window.addEventListener("touchend", onDragEnd);
  38987. window.addEventListener("contextmenu", onDragEnd);
  38988. button.value.focus();
  38989. };
  38990. const incrementPosition = (amount) => {
  38991. if (disabled.value)
  38992. return;
  38993. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  38994. setPosition(initData.newPosition);
  38995. emitChange();
  38996. };
  38997. const onLeftKeyDown = () => {
  38998. incrementPosition(-step.value);
  38999. };
  39000. const onRightKeyDown = () => {
  39001. incrementPosition(step.value);
  39002. };
  39003. const onPageDownKeyDown = () => {
  39004. incrementPosition(-step.value * 4);
  39005. };
  39006. const onPageUpKeyDown = () => {
  39007. incrementPosition(step.value * 4);
  39008. };
  39009. const onHomeKeyDown = () => {
  39010. if (disabled.value)
  39011. return;
  39012. setPosition(0);
  39013. emitChange();
  39014. };
  39015. const onEndKeyDown = () => {
  39016. if (disabled.value)
  39017. return;
  39018. setPosition(100);
  39019. emitChange();
  39020. };
  39021. const onKeyDown = (event) => {
  39022. let isPreventDefault = true;
  39023. if ([left, down].includes(event.key)) {
  39024. onLeftKeyDown();
  39025. } else if ([right, up].includes(event.key)) {
  39026. onRightKeyDown();
  39027. } else if (event.key === home) {
  39028. onHomeKeyDown();
  39029. } else if (event.key === end) {
  39030. onEndKeyDown();
  39031. } else if (event.key === pageDown) {
  39032. onPageDownKeyDown();
  39033. } else if (event.key === pageUp) {
  39034. onPageUpKeyDown();
  39035. } else {
  39036. isPreventDefault = false;
  39037. }
  39038. isPreventDefault && event.preventDefault();
  39039. };
  39040. const getClientXY = (event) => {
  39041. let clientX;
  39042. let clientY;
  39043. if (event.type.startsWith("touch")) {
  39044. clientY = event.touches[0].clientY;
  39045. clientX = event.touches[0].clientX;
  39046. } else {
  39047. clientY = event.clientY;
  39048. clientX = event.clientX;
  39049. }
  39050. return {
  39051. clientX,
  39052. clientY
  39053. };
  39054. };
  39055. const onDragStart = (event) => {
  39056. initData.dragging = true;
  39057. initData.isClick = true;
  39058. const { clientX, clientY } = getClientXY(event);
  39059. if (props.vertical) {
  39060. initData.startY = clientY;
  39061. } else {
  39062. initData.startX = clientX;
  39063. }
  39064. initData.startPosition = Number.parseFloat(currentPosition.value);
  39065. initData.newPosition = initData.startPosition;
  39066. };
  39067. const onDragging = (event) => {
  39068. if (initData.dragging) {
  39069. initData.isClick = false;
  39070. displayTooltip();
  39071. resetSize();
  39072. let diff;
  39073. const { clientX, clientY } = getClientXY(event);
  39074. if (props.vertical) {
  39075. initData.currentY = clientY;
  39076. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  39077. } else {
  39078. initData.currentX = clientX;
  39079. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  39080. }
  39081. initData.newPosition = initData.startPosition + diff;
  39082. setPosition(initData.newPosition);
  39083. }
  39084. };
  39085. const onDragEnd = () => {
  39086. if (initData.dragging) {
  39087. setTimeout(() => {
  39088. initData.dragging = false;
  39089. if (!initData.hovering) {
  39090. hideTooltip();
  39091. }
  39092. if (!initData.isClick) {
  39093. setPosition(initData.newPosition);
  39094. }
  39095. emitChange();
  39096. }, 0);
  39097. window.removeEventListener("mousemove", onDragging);
  39098. window.removeEventListener("touchmove", onDragging);
  39099. window.removeEventListener("mouseup", onDragEnd);
  39100. window.removeEventListener("touchend", onDragEnd);
  39101. window.removeEventListener("contextmenu", onDragEnd);
  39102. }
  39103. };
  39104. const setPosition = async (newPosition) => {
  39105. if (newPosition === null || Number.isNaN(+newPosition))
  39106. return;
  39107. if (newPosition < 0) {
  39108. newPosition = 0;
  39109. } else if (newPosition > 100) {
  39110. newPosition = 100;
  39111. }
  39112. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  39113. const steps = Math.round(newPosition / lengthPerStep);
  39114. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  39115. value = Number.parseFloat(value.toFixed(precision.value));
  39116. if (value !== props.modelValue) {
  39117. emit(UPDATE_MODEL_EVENT, value);
  39118. }
  39119. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  39120. initData.oldValue = props.modelValue;
  39121. }
  39122. await vue.nextTick();
  39123. initData.dragging && displayTooltip();
  39124. tooltip.value.updatePopper();
  39125. };
  39126. vue.watch(() => initData.dragging, (val) => {
  39127. updateDragging(val);
  39128. });
  39129. return {
  39130. disabled,
  39131. button,
  39132. tooltip,
  39133. tooltipVisible,
  39134. showTooltip,
  39135. wrapperStyle,
  39136. formatValue,
  39137. handleMouseEnter,
  39138. handleMouseLeave,
  39139. onButtonDown,
  39140. onKeyDown,
  39141. setPosition
  39142. };
  39143. };
  39144. const useStops = (props, initData, minValue, maxValue) => {
  39145. const stops = vue.computed(() => {
  39146. if (!props.showStops || props.min > props.max)
  39147. return [];
  39148. if (props.step === 0) {
  39149. return [];
  39150. }
  39151. const stopCount = (props.max - props.min) / props.step;
  39152. const stepWidth = 100 * props.step / (props.max - props.min);
  39153. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  39154. if (props.range) {
  39155. return result.filter((step) => {
  39156. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  39157. });
  39158. } else {
  39159. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  39160. }
  39161. });
  39162. const getStopStyle = (position) => {
  39163. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  39164. };
  39165. return {
  39166. stops,
  39167. getStopStyle
  39168. };
  39169. };
  39170. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  39171. const _emit = (val) => {
  39172. emit(UPDATE_MODEL_EVENT, val);
  39173. emit(INPUT_EVENT, val);
  39174. };
  39175. const valueChanged = () => {
  39176. if (props.range) {
  39177. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  39178. } else {
  39179. return props.modelValue !== initData.oldValue;
  39180. }
  39181. };
  39182. const setValues = () => {
  39183. var _a, _b;
  39184. if (props.min > props.max) {
  39185. throwError("Slider", "min should not be greater than max.");
  39186. }
  39187. const val = props.modelValue;
  39188. if (props.range && Array.isArray(val)) {
  39189. if (val[1] < props.min) {
  39190. _emit([props.min, props.min]);
  39191. } else if (val[0] > props.max) {
  39192. _emit([props.max, props.max]);
  39193. } else if (val[0] < props.min) {
  39194. _emit([props.min, val[1]]);
  39195. } else if (val[1] > props.max) {
  39196. _emit([val[0], props.max]);
  39197. } else {
  39198. initData.firstValue = val[0];
  39199. initData.secondValue = val[1];
  39200. if (valueChanged()) {
  39201. if (props.validateEvent) {
  39202. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  39203. }
  39204. initData.oldValue = val.slice();
  39205. }
  39206. }
  39207. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  39208. if (val < props.min) {
  39209. _emit(props.min);
  39210. } else if (val > props.max) {
  39211. _emit(props.max);
  39212. } else {
  39213. initData.firstValue = val;
  39214. if (valueChanged()) {
  39215. if (props.validateEvent) {
  39216. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  39217. }
  39218. initData.oldValue = val;
  39219. }
  39220. }
  39221. }
  39222. };
  39223. setValues();
  39224. vue.watch(() => initData.dragging, (val) => {
  39225. if (!val) {
  39226. setValues();
  39227. }
  39228. });
  39229. vue.watch(() => props.modelValue, (val, oldVal) => {
  39230. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  39231. return;
  39232. }
  39233. setValues();
  39234. }, {
  39235. deep: true
  39236. });
  39237. vue.watch(() => [props.min, props.max], () => {
  39238. setValues();
  39239. });
  39240. };
  39241. const sliderButtonProps = buildProps({
  39242. modelValue: {
  39243. type: Number,
  39244. default: 0
  39245. },
  39246. vertical: Boolean,
  39247. tooltipClass: String,
  39248. placement: {
  39249. type: String,
  39250. values: Ee,
  39251. default: "top"
  39252. }
  39253. });
  39254. const sliderButtonEmits = {
  39255. [UPDATE_MODEL_EVENT]: (value) => isNumber$1(value)
  39256. };
  39257. const _hoisted_1$f = ["tabindex"];
  39258. const __default__$r = vue.defineComponent({
  39259. name: "ElSliderButton"
  39260. });
  39261. const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
  39262. ...__default__$r,
  39263. props: sliderButtonProps,
  39264. emits: sliderButtonEmits,
  39265. setup(__props, { expose, emit }) {
  39266. const props = __props;
  39267. const ns = useNamespace("slider");
  39268. const initData = vue.reactive({
  39269. hovering: false,
  39270. dragging: false,
  39271. isClick: false,
  39272. startX: 0,
  39273. currentX: 0,
  39274. startY: 0,
  39275. currentY: 0,
  39276. startPosition: 0,
  39277. newPosition: 0,
  39278. oldValue: props.modelValue
  39279. });
  39280. const {
  39281. disabled,
  39282. button,
  39283. tooltip,
  39284. showTooltip,
  39285. tooltipVisible,
  39286. wrapperStyle,
  39287. formatValue,
  39288. handleMouseEnter,
  39289. handleMouseLeave,
  39290. onButtonDown,
  39291. onKeyDown,
  39292. setPosition
  39293. } = useSliderButton(props, initData, emit);
  39294. const { hovering, dragging } = vue.toRefs(initData);
  39295. expose({
  39296. onButtonDown,
  39297. onKeyDown,
  39298. setPosition,
  39299. hovering,
  39300. dragging
  39301. });
  39302. return (_ctx, _cache) => {
  39303. return vue.openBlock(), vue.createElementBlock("div", {
  39304. ref_key: "button",
  39305. ref: button,
  39306. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  39307. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  39308. tabindex: vue.unref(disabled) ? -1 : 0,
  39309. onMouseenter: _cache[0] || (_cache[0] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  39310. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  39311. onMousedown: _cache[2] || (_cache[2] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  39312. onTouchstart: _cache[3] || (_cache[3] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  39313. onFocus: _cache[4] || (_cache[4] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  39314. onBlur: _cache[5] || (_cache[5] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  39315. onKeydown: _cache[6] || (_cache[6] = (...args) => vue.unref(onKeyDown) && vue.unref(onKeyDown)(...args))
  39316. }, [
  39317. vue.createVNode(vue.unref(ElTooltip), {
  39318. ref_key: "tooltip",
  39319. ref: tooltip,
  39320. visible: vue.unref(tooltipVisible),
  39321. placement: _ctx.placement,
  39322. "fallback-placements": ["top", "bottom", "right", "left"],
  39323. "stop-popper-mouse-event": false,
  39324. "popper-class": _ctx.tooltipClass,
  39325. disabled: !vue.unref(showTooltip),
  39326. persistent: ""
  39327. }, {
  39328. content: vue.withCtx(() => [
  39329. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  39330. ]),
  39331. default: vue.withCtx(() => [
  39332. vue.createElementVNode("div", {
  39333. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  39334. }, null, 2)
  39335. ]),
  39336. _: 1
  39337. }, 8, ["visible", "placement", "popper-class", "disabled"])
  39338. ], 46, _hoisted_1$f);
  39339. };
  39340. }
  39341. });
  39342. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "button.vue"]]);
  39343. const sliderMarkerProps = buildProps({
  39344. mark: {
  39345. type: definePropType([String, Object]),
  39346. default: void 0
  39347. }
  39348. });
  39349. var SliderMarker = vue.defineComponent({
  39350. name: "ElSliderMarker",
  39351. props: sliderMarkerProps,
  39352. setup(props) {
  39353. const ns = useNamespace("slider");
  39354. const label = vue.computed(() => {
  39355. return isString$1(props.mark) ? props.mark : props.mark.label;
  39356. });
  39357. const style = vue.computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  39358. return () => vue.h("div", {
  39359. class: ns.e("marks-text"),
  39360. style: style.value
  39361. }, label.value);
  39362. }
  39363. });
  39364. const _hoisted_1$e = ["id", "role", "aria-label", "aria-labelledby"];
  39365. const _hoisted_2$a = { key: 1 };
  39366. const __default__$q = vue.defineComponent({
  39367. name: "ElSlider"
  39368. });
  39369. const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
  39370. ...__default__$q,
  39371. props: sliderProps,
  39372. emits: sliderEmits,
  39373. setup(__props, { expose, emit }) {
  39374. const props = __props;
  39375. const ns = useNamespace("slider");
  39376. const { t } = useLocale();
  39377. const initData = vue.reactive({
  39378. firstValue: 0,
  39379. secondValue: 0,
  39380. oldValue: 0,
  39381. dragging: false,
  39382. sliderSize: 1
  39383. });
  39384. const {
  39385. elFormItem,
  39386. slider,
  39387. firstButton,
  39388. secondButton,
  39389. sliderDisabled,
  39390. minValue,
  39391. maxValue,
  39392. runwayStyle,
  39393. barStyle,
  39394. resetSize,
  39395. emitChange,
  39396. onSliderWrapperPrevent,
  39397. onSliderClick,
  39398. onSliderDown,
  39399. setFirstValue,
  39400. setSecondValue
  39401. } = useSlide(props, initData, emit);
  39402. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  39403. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  39404. formItemContext: elFormItem
  39405. });
  39406. const sliderWrapperSize = useFormSize();
  39407. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  39408. const groupLabel = vue.computed(() => {
  39409. return props.label || t("el.slider.defaultLabel", {
  39410. min: props.min,
  39411. max: props.max
  39412. });
  39413. });
  39414. const firstButtonLabel = vue.computed(() => {
  39415. if (props.range) {
  39416. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  39417. } else {
  39418. return groupLabel.value;
  39419. }
  39420. });
  39421. const firstValueText = vue.computed(() => {
  39422. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  39423. });
  39424. const secondButtonLabel = vue.computed(() => {
  39425. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  39426. });
  39427. const secondValueText = vue.computed(() => {
  39428. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  39429. });
  39430. const sliderKls = vue.computed(() => [
  39431. ns.b(),
  39432. ns.m(sliderWrapperSize.value),
  39433. ns.is("vertical", props.vertical),
  39434. { [ns.m("with-input")]: props.showInput }
  39435. ]);
  39436. const markList = useMarks(props);
  39437. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  39438. const precision = vue.computed(() => {
  39439. const precisions = [props.min, props.max, props.step].map((item) => {
  39440. const decimal = `${item}`.split(".")[1];
  39441. return decimal ? decimal.length : 0;
  39442. });
  39443. return Math.max.apply(null, precisions);
  39444. });
  39445. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  39446. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  39447. const updateDragging = (val) => {
  39448. initData.dragging = val;
  39449. };
  39450. vue.provide(sliderContextKey, {
  39451. ...vue.toRefs(props),
  39452. sliderSize,
  39453. disabled: sliderDisabled,
  39454. precision,
  39455. emitChange,
  39456. resetSize,
  39457. updateDragging
  39458. });
  39459. expose({
  39460. onSliderClick
  39461. });
  39462. return (_ctx, _cache) => {
  39463. var _a, _b;
  39464. return vue.openBlock(), vue.createElementBlock("div", {
  39465. id: _ctx.range ? vue.unref(inputId) : void 0,
  39466. ref_key: "sliderWrapper",
  39467. ref: sliderWrapper,
  39468. class: vue.normalizeClass(vue.unref(sliderKls)),
  39469. role: _ctx.range ? "group" : void 0,
  39470. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  39471. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0,
  39472. onTouchstart: _cache[2] || (_cache[2] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args)),
  39473. onTouchmove: _cache[3] || (_cache[3] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args))
  39474. }, [
  39475. vue.createElementVNode("div", {
  39476. ref_key: "slider",
  39477. ref: slider,
  39478. class: vue.normalizeClass([
  39479. vue.unref(ns).e("runway"),
  39480. { "show-input": _ctx.showInput && !_ctx.range },
  39481. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  39482. ]),
  39483. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  39484. onMousedown: _cache[0] || (_cache[0] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args)),
  39485. onTouchstart: _cache[1] || (_cache[1] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args))
  39486. }, [
  39487. vue.createElementVNode("div", {
  39488. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  39489. style: vue.normalizeStyle(vue.unref(barStyle))
  39490. }, null, 6),
  39491. vue.createVNode(SliderButton, {
  39492. id: !_ctx.range ? vue.unref(inputId) : void 0,
  39493. ref_key: "firstButton",
  39494. ref: firstButton,
  39495. "model-value": vue.unref(firstValue),
  39496. vertical: _ctx.vertical,
  39497. "tooltip-class": _ctx.tooltipClass,
  39498. placement: _ctx.placement,
  39499. role: "slider",
  39500. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  39501. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  39502. "aria-valuemin": _ctx.min,
  39503. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  39504. "aria-valuenow": vue.unref(firstValue),
  39505. "aria-valuetext": vue.unref(firstValueText),
  39506. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  39507. "aria-disabled": vue.unref(sliderDisabled),
  39508. "onUpdate:modelValue": vue.unref(setFirstValue)
  39509. }, 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"]),
  39510. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  39511. key: 0,
  39512. ref_key: "secondButton",
  39513. ref: secondButton,
  39514. "model-value": vue.unref(secondValue),
  39515. vertical: _ctx.vertical,
  39516. "tooltip-class": _ctx.tooltipClass,
  39517. placement: _ctx.placement,
  39518. role: "slider",
  39519. "aria-label": vue.unref(secondButtonLabel),
  39520. "aria-valuemin": vue.unref(firstValue),
  39521. "aria-valuemax": _ctx.max,
  39522. "aria-valuenow": vue.unref(secondValue),
  39523. "aria-valuetext": vue.unref(secondValueText),
  39524. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  39525. "aria-disabled": vue.unref(sliderDisabled),
  39526. "onUpdate:modelValue": vue.unref(setSecondValue)
  39527. }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : vue.createCommentVNode("v-if", true),
  39528. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [
  39529. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  39530. return vue.openBlock(), vue.createElementBlock("div", {
  39531. key,
  39532. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  39533. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  39534. }, null, 6);
  39535. }), 128))
  39536. ])) : vue.createCommentVNode("v-if", true),
  39537. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  39538. vue.createElementVNode("div", null, [
  39539. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  39540. return vue.openBlock(), vue.createElementBlock("div", {
  39541. key,
  39542. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  39543. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  39544. }, null, 6);
  39545. }), 128))
  39546. ]),
  39547. vue.createElementVNode("div", {
  39548. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  39549. }, [
  39550. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  39551. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  39552. key,
  39553. mark: item.mark,
  39554. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position))
  39555. }, null, 8, ["mark", "style"]);
  39556. }), 128))
  39557. ], 2)
  39558. ], 64)) : vue.createCommentVNode("v-if", true)
  39559. ], 38),
  39560. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  39561. key: 0,
  39562. ref: "input",
  39563. "model-value": vue.unref(firstValue),
  39564. class: vue.normalizeClass(vue.unref(ns).e("input")),
  39565. step: _ctx.step,
  39566. disabled: vue.unref(sliderDisabled),
  39567. controls: _ctx.showInputControls,
  39568. min: _ctx.min,
  39569. max: _ctx.max,
  39570. debounce: _ctx.debounce,
  39571. size: vue.unref(sliderInputSize),
  39572. "onUpdate:modelValue": vue.unref(setFirstValue),
  39573. onChange: vue.unref(emitChange)
  39574. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  39575. ], 42, _hoisted_1$e);
  39576. };
  39577. }
  39578. });
  39579. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "slider.vue"]]);
  39580. const ElSlider = withInstall(Slider);
  39581. const spaceItemProps = buildProps({
  39582. prefixCls: {
  39583. type: String
  39584. }
  39585. });
  39586. const SpaceItem = vue.defineComponent({
  39587. name: "ElSpaceItem",
  39588. props: spaceItemProps,
  39589. setup(props, { slots }) {
  39590. const ns = useNamespace("space");
  39591. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  39592. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  39593. }
  39594. });
  39595. var Item = SpaceItem;
  39596. const SIZE_MAP = {
  39597. small: 8,
  39598. default: 12,
  39599. large: 16
  39600. };
  39601. function useSpace(props) {
  39602. const ns = useNamespace("space");
  39603. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  39604. const horizontalSize = vue.ref(0);
  39605. const verticalSize = vue.ref(0);
  39606. const containerStyle = vue.computed(() => {
  39607. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  39608. const alignment = {
  39609. alignItems: props.alignment
  39610. };
  39611. return [wrapKls, alignment, props.style];
  39612. });
  39613. const itemStyle = vue.computed(() => {
  39614. const itemBaseStyle = {
  39615. paddingBottom: `${verticalSize.value}px`,
  39616. marginRight: `${horizontalSize.value}px`
  39617. };
  39618. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  39619. return [itemBaseStyle, fillStyle];
  39620. });
  39621. vue.watchEffect(() => {
  39622. const { size = "small", wrap, direction: dir, fill } = props;
  39623. if (isArray$1(size)) {
  39624. const [h = 0, v = 0] = size;
  39625. horizontalSize.value = h;
  39626. verticalSize.value = v;
  39627. } else {
  39628. let val;
  39629. if (isNumber$1(size)) {
  39630. val = size;
  39631. } else {
  39632. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  39633. }
  39634. if ((wrap || fill) && dir === "horizontal") {
  39635. horizontalSize.value = verticalSize.value = val;
  39636. } else {
  39637. if (dir === "horizontal") {
  39638. horizontalSize.value = val;
  39639. verticalSize.value = 0;
  39640. } else {
  39641. verticalSize.value = val;
  39642. horizontalSize.value = 0;
  39643. }
  39644. }
  39645. }
  39646. });
  39647. return {
  39648. classes,
  39649. containerStyle,
  39650. itemStyle
  39651. };
  39652. }
  39653. const spaceProps = buildProps({
  39654. direction: {
  39655. type: String,
  39656. values: ["horizontal", "vertical"],
  39657. default: "horizontal"
  39658. },
  39659. class: {
  39660. type: definePropType([
  39661. String,
  39662. Object,
  39663. Array
  39664. ]),
  39665. default: ""
  39666. },
  39667. style: {
  39668. type: definePropType([String, Array, Object]),
  39669. default: ""
  39670. },
  39671. alignment: {
  39672. type: definePropType(String),
  39673. default: "center"
  39674. },
  39675. prefixCls: {
  39676. type: String
  39677. },
  39678. spacer: {
  39679. type: definePropType([Object, String, Number, Array]),
  39680. default: null,
  39681. validator: (val) => vue.isVNode(val) || isNumber$1(val) || isString$1(val)
  39682. },
  39683. wrap: Boolean,
  39684. fill: Boolean,
  39685. fillRatio: {
  39686. type: Number,
  39687. default: 100
  39688. },
  39689. size: {
  39690. type: [String, Array, Number],
  39691. values: componentSizes,
  39692. validator: (val) => {
  39693. return isNumber$1(val) || isArray$1(val) && val.length === 2 && val.every(isNumber$1);
  39694. }
  39695. }
  39696. });
  39697. const Space = vue.defineComponent({
  39698. name: "ElSpace",
  39699. props: spaceProps,
  39700. setup(props, { slots }) {
  39701. const { classes, containerStyle, itemStyle } = useSpace(props);
  39702. function extractChildren(children, parentKey = "", extractedChildren = []) {
  39703. const { prefixCls } = props;
  39704. children.forEach((child, loopKey) => {
  39705. if (isFragment(child)) {
  39706. if (isArray$1(child.children)) {
  39707. child.children.forEach((nested, key) => {
  39708. if (isFragment(nested) && isArray$1(nested.children)) {
  39709. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  39710. } else {
  39711. extractedChildren.push(vue.createVNode(Item, {
  39712. style: itemStyle.value,
  39713. prefixCls,
  39714. key: `nested-${parentKey + key}`
  39715. }, {
  39716. default: () => [nested]
  39717. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  39718. }
  39719. });
  39720. }
  39721. } else if (isValidElementNode(child)) {
  39722. extractedChildren.push(vue.createVNode(Item, {
  39723. style: itemStyle.value,
  39724. prefixCls,
  39725. key: `LoopKey${parentKey + loopKey}`
  39726. }, {
  39727. default: () => [child]
  39728. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  39729. }
  39730. });
  39731. return extractedChildren;
  39732. }
  39733. return () => {
  39734. var _a;
  39735. const { spacer, direction } = props;
  39736. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  39737. if (((_a = children.children) != null ? _a : []).length === 0)
  39738. return null;
  39739. if (isArray$1(children.children)) {
  39740. let extractedChildren = extractChildren(children.children);
  39741. if (spacer) {
  39742. const len = extractedChildren.length - 1;
  39743. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  39744. const children2 = [...acc, child];
  39745. if (idx !== len) {
  39746. children2.push(vue.createVNode("span", {
  39747. style: [
  39748. itemStyle.value,
  39749. direction === "vertical" ? "width: 100%" : null
  39750. ],
  39751. key: idx
  39752. }, [
  39753. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  39754. ], PatchFlags.STYLE));
  39755. }
  39756. return children2;
  39757. }, []);
  39758. }
  39759. return vue.createVNode("div", {
  39760. class: classes.value,
  39761. style: containerStyle.value
  39762. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  39763. }
  39764. return children.children;
  39765. };
  39766. }
  39767. });
  39768. const ElSpace = withInstall(Space);
  39769. const statisticProps = buildProps({
  39770. decimalSeparator: {
  39771. type: String,
  39772. default: "."
  39773. },
  39774. groupSeparator: {
  39775. type: String,
  39776. default: ","
  39777. },
  39778. precision: {
  39779. type: Number,
  39780. default: 0
  39781. },
  39782. formatter: Function,
  39783. value: {
  39784. type: definePropType([Number, Object]),
  39785. default: 0
  39786. },
  39787. prefix: String,
  39788. suffix: String,
  39789. title: String,
  39790. valueStyle: {
  39791. type: definePropType([String, Object, Array])
  39792. }
  39793. });
  39794. const __default__$p = vue.defineComponent({
  39795. name: "ElStatistic"
  39796. });
  39797. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  39798. ...__default__$p,
  39799. props: statisticProps,
  39800. setup(__props, { expose }) {
  39801. const props = __props;
  39802. const ns = useNamespace("statistic");
  39803. const displayValue = vue.computed(() => {
  39804. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  39805. if (isFunction$1(formatter))
  39806. return formatter(value);
  39807. if (!isNumber$1(value))
  39808. return value;
  39809. let [integer, decimal = ""] = String(value).split(".");
  39810. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  39811. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  39812. return [integer, decimal].join(decimal ? decimalSeparator : "");
  39813. });
  39814. expose({
  39815. displayValue
  39816. });
  39817. return (_ctx, _cache) => {
  39818. return vue.openBlock(), vue.createElementBlock("div", {
  39819. class: vue.normalizeClass(vue.unref(ns).b())
  39820. }, [
  39821. _ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  39822. key: 0,
  39823. class: vue.normalizeClass(vue.unref(ns).e("head"))
  39824. }, [
  39825. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  39826. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  39827. ])
  39828. ], 2)) : vue.createCommentVNode("v-if", true),
  39829. vue.createElementVNode("div", {
  39830. class: vue.normalizeClass(vue.unref(ns).e("content"))
  39831. }, [
  39832. _ctx.$slots.prefix || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  39833. key: 0,
  39834. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  39835. }, [
  39836. vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
  39837. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.prefix), 1)
  39838. ])
  39839. ], 2)) : vue.createCommentVNode("v-if", true),
  39840. vue.createElementVNode("span", {
  39841. class: vue.normalizeClass(vue.unref(ns).e("number")),
  39842. style: vue.normalizeStyle(_ctx.valueStyle)
  39843. }, vue.toDisplayString(vue.unref(displayValue)), 7),
  39844. _ctx.$slots.suffix || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("div", {
  39845. key: 1,
  39846. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  39847. }, [
  39848. vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
  39849. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.suffix), 1)
  39850. ])
  39851. ], 2)) : vue.createCommentVNode("v-if", true)
  39852. ], 2)
  39853. ], 2);
  39854. };
  39855. }
  39856. });
  39857. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "statistic.vue"]]);
  39858. const ElStatistic = withInstall(Statistic);
  39859. const countdownProps = buildProps({
  39860. format: {
  39861. type: String,
  39862. default: "HH:mm:ss"
  39863. },
  39864. prefix: String,
  39865. suffix: String,
  39866. title: String,
  39867. value: {
  39868. type: definePropType([Number, Object]),
  39869. default: 0
  39870. },
  39871. valueStyle: {
  39872. type: definePropType([String, Object, Array])
  39873. }
  39874. });
  39875. const countdownEmits = {
  39876. finish: () => true,
  39877. [CHANGE_EVENT]: (value) => isNumber$1(value)
  39878. };
  39879. const timeUnits = [
  39880. ["Y", 1e3 * 60 * 60 * 24 * 365],
  39881. ["M", 1e3 * 60 * 60 * 24 * 30],
  39882. ["D", 1e3 * 60 * 60 * 24],
  39883. ["H", 1e3 * 60 * 60],
  39884. ["m", 1e3 * 60],
  39885. ["s", 1e3],
  39886. ["S", 1]
  39887. ];
  39888. const getTime = (value) => {
  39889. return isNumber$1(value) ? new Date(value).getTime() : value.valueOf();
  39890. };
  39891. const formatTime$1 = (timestamp, format) => {
  39892. let timeLeft = timestamp;
  39893. const escapeRegex = /\[([^\]]*)]/g;
  39894. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  39895. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  39896. if (replaceRegex.test(current)) {
  39897. const value = Math.floor(timeLeft / unit);
  39898. timeLeft -= value * unit;
  39899. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  39900. }
  39901. return current;
  39902. }, format);
  39903. return replacedText.replace(escapeRegex, "$1");
  39904. };
  39905. const __default__$o = vue.defineComponent({
  39906. name: "ElCountdown"
  39907. });
  39908. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  39909. ...__default__$o,
  39910. props: countdownProps,
  39911. emits: countdownEmits,
  39912. setup(__props, { expose, emit }) {
  39913. const props = __props;
  39914. let timer;
  39915. const rawValue = vue.ref(getTime(props.value) - Date.now());
  39916. const displayValue = vue.computed(() => formatTime$1(rawValue.value, props.format));
  39917. const formatter = (val) => formatTime$1(val, props.format);
  39918. const stopTimer = () => {
  39919. if (timer) {
  39920. cAF(timer);
  39921. timer = void 0;
  39922. }
  39923. };
  39924. const startTimer = () => {
  39925. const timestamp = getTime(props.value);
  39926. const frameFunc = () => {
  39927. let diff = timestamp - Date.now();
  39928. emit("change", diff);
  39929. if (diff <= 0) {
  39930. diff = 0;
  39931. stopTimer();
  39932. emit("finish");
  39933. } else {
  39934. timer = rAF(frameFunc);
  39935. }
  39936. rawValue.value = diff;
  39937. };
  39938. timer = rAF(frameFunc);
  39939. };
  39940. vue.watch(() => [props.value, props.format], () => {
  39941. stopTimer();
  39942. startTimer();
  39943. }, {
  39944. immediate: true
  39945. });
  39946. vue.onBeforeUnmount(() => {
  39947. stopTimer();
  39948. });
  39949. expose({
  39950. displayValue
  39951. });
  39952. return (_ctx, _cache) => {
  39953. return vue.openBlock(), vue.createBlock(vue.unref(ElStatistic), {
  39954. value: rawValue.value,
  39955. title: _ctx.title,
  39956. prefix: _ctx.prefix,
  39957. suffix: _ctx.suffix,
  39958. "value-style": _ctx.valueStyle,
  39959. formatter
  39960. }, vue.createSlots({ _: 2 }, [
  39961. vue.renderList(_ctx.$slots, (_, name) => {
  39962. return {
  39963. name,
  39964. fn: vue.withCtx(() => [
  39965. vue.renderSlot(_ctx.$slots, name)
  39966. ])
  39967. };
  39968. })
  39969. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  39970. };
  39971. }
  39972. });
  39973. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "countdown.vue"]]);
  39974. const ElCountdown = withInstall(Countdown);
  39975. const stepsProps = buildProps({
  39976. space: {
  39977. type: [Number, String],
  39978. default: ""
  39979. },
  39980. active: {
  39981. type: Number,
  39982. default: 0
  39983. },
  39984. direction: {
  39985. type: String,
  39986. default: "horizontal",
  39987. values: ["horizontal", "vertical"]
  39988. },
  39989. alignCenter: {
  39990. type: Boolean
  39991. },
  39992. simple: {
  39993. type: Boolean
  39994. },
  39995. finishStatus: {
  39996. type: String,
  39997. values: ["wait", "process", "finish", "error", "success"],
  39998. default: "finish"
  39999. },
  40000. processStatus: {
  40001. type: String,
  40002. values: ["wait", "process", "finish", "error", "success"],
  40003. default: "process"
  40004. }
  40005. });
  40006. const stepsEmits = {
  40007. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber$1)
  40008. };
  40009. const __default__$n = vue.defineComponent({
  40010. name: "ElSteps"
  40011. });
  40012. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  40013. ...__default__$n,
  40014. props: stepsProps,
  40015. emits: stepsEmits,
  40016. setup(__props, { emit }) {
  40017. const props = __props;
  40018. const ns = useNamespace("steps");
  40019. const steps = vue.ref([]);
  40020. vue.watch(steps, () => {
  40021. steps.value.forEach((instance, index) => {
  40022. instance.setIndex(index);
  40023. });
  40024. });
  40025. vue.provide("ElSteps", { props, steps });
  40026. vue.watch(() => props.active, (newVal, oldVal) => {
  40027. emit(CHANGE_EVENT, newVal, oldVal);
  40028. });
  40029. return (_ctx, _cache) => {
  40030. return vue.openBlock(), vue.createElementBlock("div", {
  40031. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  40032. }, [
  40033. vue.renderSlot(_ctx.$slots, "default")
  40034. ], 2);
  40035. };
  40036. }
  40037. });
  40038. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "steps.vue"]]);
  40039. const stepProps = buildProps({
  40040. title: {
  40041. type: String,
  40042. default: ""
  40043. },
  40044. icon: {
  40045. type: iconPropType
  40046. },
  40047. description: {
  40048. type: String,
  40049. default: ""
  40050. },
  40051. status: {
  40052. type: String,
  40053. values: ["", "wait", "process", "finish", "error", "success"],
  40054. default: ""
  40055. }
  40056. });
  40057. const __default__$m = vue.defineComponent({
  40058. name: "ElStep"
  40059. });
  40060. const _sfc_main$t = vue.defineComponent({
  40061. ...__default__$m,
  40062. props: stepProps,
  40063. setup(__props) {
  40064. const props = __props;
  40065. const ns = useNamespace("step");
  40066. const index = vue.ref(-1);
  40067. const lineStyle = vue.ref({});
  40068. const internalStatus = vue.ref("");
  40069. const parent = vue.inject("ElSteps");
  40070. const currentInstance = vue.getCurrentInstance();
  40071. vue.onMounted(() => {
  40072. vue.watch([
  40073. () => parent.props.active,
  40074. () => parent.props.processStatus,
  40075. () => parent.props.finishStatus
  40076. ], ([active]) => {
  40077. updateStatus(active);
  40078. }, { immediate: true });
  40079. });
  40080. vue.onBeforeUnmount(() => {
  40081. parent.steps.value = parent.steps.value.filter((instance) => instance.uid !== (currentInstance == null ? void 0 : currentInstance.uid));
  40082. });
  40083. const currentStatus = vue.computed(() => {
  40084. return props.status || internalStatus.value;
  40085. });
  40086. const prevStatus = vue.computed(() => {
  40087. const prevStep = parent.steps.value[index.value - 1];
  40088. return prevStep ? prevStep.currentStatus : "wait";
  40089. });
  40090. const isCenter = vue.computed(() => {
  40091. return parent.props.alignCenter;
  40092. });
  40093. const isVertical = vue.computed(() => {
  40094. return parent.props.direction === "vertical";
  40095. });
  40096. const isSimple = vue.computed(() => {
  40097. return parent.props.simple;
  40098. });
  40099. const stepsCount = vue.computed(() => {
  40100. return parent.steps.value.length;
  40101. });
  40102. const isLast = vue.computed(() => {
  40103. var _a;
  40104. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  40105. });
  40106. const space = vue.computed(() => {
  40107. return isSimple.value ? "" : parent.props.space;
  40108. });
  40109. const style = vue.computed(() => {
  40110. const style2 = {
  40111. flexBasis: isNumber$1(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  40112. };
  40113. if (isVertical.value)
  40114. return style2;
  40115. if (isLast.value) {
  40116. style2.maxWidth = `${100 / stepsCount.value}%`;
  40117. }
  40118. return style2;
  40119. });
  40120. const setIndex = (val) => {
  40121. index.value = val;
  40122. };
  40123. const calcProgress = (status) => {
  40124. const isWait = status === "wait";
  40125. const style2 = {
  40126. transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
  40127. };
  40128. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  40129. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  40130. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  40131. lineStyle.value = style2;
  40132. };
  40133. const updateStatus = (activeIndex) => {
  40134. if (activeIndex > index.value) {
  40135. internalStatus.value = parent.props.finishStatus;
  40136. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  40137. internalStatus.value = parent.props.processStatus;
  40138. } else {
  40139. internalStatus.value = "wait";
  40140. }
  40141. const prevChild = parent.steps.value[index.value - 1];
  40142. if (prevChild)
  40143. prevChild.calcProgress(internalStatus.value);
  40144. };
  40145. const stepItemState = vue.reactive({
  40146. uid: vue.computed(() => currentInstance == null ? void 0 : currentInstance.uid),
  40147. currentStatus,
  40148. setIndex,
  40149. calcProgress
  40150. });
  40151. parent.steps.value = [...parent.steps.value, stepItemState];
  40152. return (_ctx, _cache) => {
  40153. return vue.openBlock(), vue.createElementBlock("div", {
  40154. style: vue.normalizeStyle(vue.unref(style)),
  40155. class: vue.normalizeClass([
  40156. vue.unref(ns).b(),
  40157. vue.unref(ns).is(vue.unref(isSimple) ? "simple" : vue.unref(parent).props.direction),
  40158. vue.unref(ns).is("flex", vue.unref(isLast) && !vue.unref(space) && !vue.unref(isCenter)),
  40159. vue.unref(ns).is("center", vue.unref(isCenter) && !vue.unref(isVertical) && !vue.unref(isSimple))
  40160. ])
  40161. }, [
  40162. vue.createCommentVNode(" icon & line "),
  40163. vue.createElementVNode("div", {
  40164. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  40165. }, [
  40166. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  40167. key: 0,
  40168. class: vue.normalizeClass(vue.unref(ns).e("line"))
  40169. }, [
  40170. vue.createElementVNode("i", {
  40171. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  40172. style: vue.normalizeStyle(lineStyle.value)
  40173. }, null, 6)
  40174. ], 2)) : vue.createCommentVNode("v-if", true),
  40175. vue.createElementVNode("div", {
  40176. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  40177. }, [
  40178. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  40179. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40180. key: 0,
  40181. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  40182. }, {
  40183. default: vue.withCtx(() => [
  40184. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  40185. ]),
  40186. _: 1
  40187. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40188. key: 1,
  40189. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  40190. }, {
  40191. default: vue.withCtx(() => [
  40192. vue.createVNode(vue.unref(check_default))
  40193. ]),
  40194. _: 1
  40195. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40196. key: 2,
  40197. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  40198. }, {
  40199. default: vue.withCtx(() => [
  40200. vue.createVNode(vue.unref(close_default))
  40201. ]),
  40202. _: 1
  40203. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  40204. key: 3,
  40205. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  40206. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  40207. ])
  40208. ], 2)
  40209. ], 2),
  40210. vue.createCommentVNode(" title & description "),
  40211. vue.createElementVNode("div", {
  40212. class: vue.normalizeClass(vue.unref(ns).e("main"))
  40213. }, [
  40214. vue.createElementVNode("div", {
  40215. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  40216. }, [
  40217. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  40218. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  40219. ])
  40220. ], 2),
  40221. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  40222. key: 0,
  40223. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  40224. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  40225. key: 1,
  40226. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  40227. }, [
  40228. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  40229. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  40230. ])
  40231. ], 2))
  40232. ], 2)
  40233. ], 6);
  40234. };
  40235. }
  40236. });
  40237. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "item.vue"]]);
  40238. const ElSteps = withInstall(Steps, {
  40239. Step
  40240. });
  40241. const ElStep = withNoopInstall(Step);
  40242. const switchProps = buildProps({
  40243. modelValue: {
  40244. type: [Boolean, String, Number],
  40245. default: false
  40246. },
  40247. value: {
  40248. type: [Boolean, String, Number],
  40249. default: false
  40250. },
  40251. disabled: {
  40252. type: Boolean,
  40253. default: false
  40254. },
  40255. width: {
  40256. type: [String, Number],
  40257. default: ""
  40258. },
  40259. inlinePrompt: {
  40260. type: Boolean,
  40261. default: false
  40262. },
  40263. activeIcon: {
  40264. type: iconPropType
  40265. },
  40266. inactiveIcon: {
  40267. type: iconPropType
  40268. },
  40269. activeText: {
  40270. type: String,
  40271. default: ""
  40272. },
  40273. inactiveText: {
  40274. type: String,
  40275. default: ""
  40276. },
  40277. activeColor: {
  40278. type: String,
  40279. default: ""
  40280. },
  40281. inactiveColor: {
  40282. type: String,
  40283. default: ""
  40284. },
  40285. borderColor: {
  40286. type: String,
  40287. default: ""
  40288. },
  40289. activeValue: {
  40290. type: [Boolean, String, Number],
  40291. default: true
  40292. },
  40293. inactiveValue: {
  40294. type: [Boolean, String, Number],
  40295. default: false
  40296. },
  40297. name: {
  40298. type: String,
  40299. default: ""
  40300. },
  40301. validateEvent: {
  40302. type: Boolean,
  40303. default: true
  40304. },
  40305. id: String,
  40306. loading: {
  40307. type: Boolean,
  40308. default: false
  40309. },
  40310. beforeChange: {
  40311. type: definePropType(Function)
  40312. },
  40313. size: {
  40314. type: String,
  40315. validator: isValidComponentSize
  40316. },
  40317. tabindex: {
  40318. type: [String, Number]
  40319. }
  40320. });
  40321. const switchEmits = {
  40322. [UPDATE_MODEL_EVENT]: (val) => isBoolean$1(val) || isString$1(val) || isNumber$1(val),
  40323. [CHANGE_EVENT]: (val) => isBoolean$1(val) || isString$1(val) || isNumber$1(val),
  40324. [INPUT_EVENT]: (val) => isBoolean$1(val) || isString$1(val) || isNumber$1(val)
  40325. };
  40326. const _hoisted_1$d = ["onClick"];
  40327. const _hoisted_2$9 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  40328. const _hoisted_3$4 = ["aria-hidden"];
  40329. const _hoisted_4$2 = ["aria-hidden"];
  40330. const _hoisted_5$1 = ["aria-hidden"];
  40331. const COMPONENT_NAME$8 = "ElSwitch";
  40332. const __default__$l = vue.defineComponent({
  40333. name: COMPONENT_NAME$8
  40334. });
  40335. const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
  40336. ...__default__$l,
  40337. props: switchProps,
  40338. emits: switchEmits,
  40339. setup(__props, { expose, emit }) {
  40340. const props = __props;
  40341. const vm = vue.getCurrentInstance();
  40342. const { formItem } = useFormItem();
  40343. const switchSize = useFormSize();
  40344. const ns = useNamespace("switch");
  40345. useDeprecated({
  40346. from: '"value"',
  40347. replacement: '"model-value" or "v-model"',
  40348. scope: COMPONENT_NAME$8,
  40349. version: "2.3.0",
  40350. ref: "https://element-plus.org/en-US/component/switch.html#attributes",
  40351. type: "Attribute"
  40352. }, vue.computed(() => {
  40353. var _a;
  40354. return !!((_a = vm.vnode.props) == null ? void 0 : _a.value);
  40355. }));
  40356. const { inputId } = useFormItemInputId(props, {
  40357. formItemContext: formItem
  40358. });
  40359. const switchDisabled = useFormDisabled(vue.computed(() => props.loading));
  40360. const isControlled = vue.ref(props.modelValue !== false);
  40361. const input = vue.ref();
  40362. const core = vue.ref();
  40363. const switchKls = vue.computed(() => [
  40364. ns.b(),
  40365. ns.m(switchSize.value),
  40366. ns.is("disabled", switchDisabled.value),
  40367. ns.is("checked", checked.value)
  40368. ]);
  40369. const coreStyle = vue.computed(() => ({
  40370. width: addUnit(props.width)
  40371. }));
  40372. vue.watch(() => props.modelValue, () => {
  40373. isControlled.value = true;
  40374. });
  40375. vue.watch(() => props.value, () => {
  40376. isControlled.value = false;
  40377. });
  40378. const actualValue = vue.computed(() => {
  40379. return isControlled.value ? props.modelValue : props.value;
  40380. });
  40381. const checked = vue.computed(() => actualValue.value === props.activeValue);
  40382. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  40383. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  40384. emit(CHANGE_EVENT, props.inactiveValue);
  40385. emit(INPUT_EVENT, props.inactiveValue);
  40386. }
  40387. vue.watch(checked, (val) => {
  40388. var _a;
  40389. input.value.checked = val;
  40390. if (props.validateEvent) {
  40391. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  40392. }
  40393. });
  40394. const handleChange = () => {
  40395. const val = checked.value ? props.inactiveValue : props.activeValue;
  40396. emit(UPDATE_MODEL_EVENT, val);
  40397. emit(CHANGE_EVENT, val);
  40398. emit(INPUT_EVENT, val);
  40399. vue.nextTick(() => {
  40400. input.value.checked = checked.value;
  40401. });
  40402. };
  40403. const switchValue = () => {
  40404. if (switchDisabled.value)
  40405. return;
  40406. const { beforeChange } = props;
  40407. if (!beforeChange) {
  40408. handleChange();
  40409. return;
  40410. }
  40411. const shouldChange = beforeChange();
  40412. const isPromiseOrBool = [
  40413. isPromise(shouldChange),
  40414. isBoolean$1(shouldChange)
  40415. ].includes(true);
  40416. if (!isPromiseOrBool) {
  40417. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  40418. }
  40419. if (isPromise(shouldChange)) {
  40420. shouldChange.then((result) => {
  40421. if (result) {
  40422. handleChange();
  40423. }
  40424. }).catch((e) => {
  40425. });
  40426. } else if (shouldChange) {
  40427. handleChange();
  40428. }
  40429. };
  40430. const styles = vue.computed(() => {
  40431. return ns.cssVarBlock({
  40432. ...props.activeColor ? { "on-color": props.activeColor } : null,
  40433. ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
  40434. ...props.borderColor ? { "border-color": props.borderColor } : null
  40435. });
  40436. });
  40437. const focus = () => {
  40438. var _a, _b;
  40439. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  40440. };
  40441. vue.onMounted(() => {
  40442. input.value.checked = checked.value;
  40443. });
  40444. expose({
  40445. focus,
  40446. checked
  40447. });
  40448. return (_ctx, _cache) => {
  40449. return vue.openBlock(), vue.createElementBlock("div", {
  40450. class: vue.normalizeClass(vue.unref(switchKls)),
  40451. style: vue.normalizeStyle(vue.unref(styles)),
  40452. onClick: vue.withModifiers(switchValue, ["prevent"])
  40453. }, [
  40454. vue.createElementVNode("input", {
  40455. id: vue.unref(inputId),
  40456. ref_key: "input",
  40457. ref: input,
  40458. class: vue.normalizeClass(vue.unref(ns).e("input")),
  40459. type: "checkbox",
  40460. role: "switch",
  40461. "aria-checked": vue.unref(checked),
  40462. "aria-disabled": vue.unref(switchDisabled),
  40463. name: _ctx.name,
  40464. "true-value": _ctx.activeValue,
  40465. "false-value": _ctx.inactiveValue,
  40466. disabled: vue.unref(switchDisabled),
  40467. tabindex: _ctx.tabindex,
  40468. onChange: handleChange,
  40469. onKeydown: vue.withKeys(switchValue, ["enter"])
  40470. }, null, 42, _hoisted_2$9),
  40471. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  40472. key: 0,
  40473. class: vue.normalizeClass([
  40474. vue.unref(ns).e("label"),
  40475. vue.unref(ns).em("label", "left"),
  40476. vue.unref(ns).is("active", !vue.unref(checked))
  40477. ])
  40478. }, [
  40479. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  40480. default: vue.withCtx(() => [
  40481. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  40482. ]),
  40483. _: 1
  40484. })) : vue.createCommentVNode("v-if", true),
  40485. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  40486. key: 1,
  40487. "aria-hidden": vue.unref(checked)
  40488. }, vue.toDisplayString(_ctx.inactiveText), 9, _hoisted_3$4)) : vue.createCommentVNode("v-if", true)
  40489. ], 2)) : vue.createCommentVNode("v-if", true),
  40490. vue.createElementVNode("span", {
  40491. ref_key: "core",
  40492. ref: core,
  40493. class: vue.normalizeClass(vue.unref(ns).e("core")),
  40494. style: vue.normalizeStyle(vue.unref(coreStyle))
  40495. }, [
  40496. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  40497. key: 0,
  40498. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  40499. }, [
  40500. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40501. key: 0,
  40502. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  40503. }, {
  40504. default: vue.withCtx(() => [
  40505. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  40506. ]),
  40507. _: 1
  40508. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  40509. key: 1,
  40510. class: vue.normalizeClass(vue.unref(ns).is("text")),
  40511. "aria-hidden": !vue.unref(checked)
  40512. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$2)) : vue.createCommentVNode("v-if", true)
  40513. ], 2)) : vue.createCommentVNode("v-if", true),
  40514. vue.createElementVNode("div", {
  40515. class: vue.normalizeClass(vue.unref(ns).e("action"))
  40516. }, [
  40517. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40518. key: 0,
  40519. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  40520. }, {
  40521. default: vue.withCtx(() => [
  40522. vue.createVNode(vue.unref(loading_default))
  40523. ]),
  40524. _: 1
  40525. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  40526. ], 2)
  40527. ], 6),
  40528. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  40529. key: 1,
  40530. class: vue.normalizeClass([
  40531. vue.unref(ns).e("label"),
  40532. vue.unref(ns).em("label", "right"),
  40533. vue.unref(ns).is("active", vue.unref(checked))
  40534. ])
  40535. }, [
  40536. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  40537. default: vue.withCtx(() => [
  40538. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  40539. ]),
  40540. _: 1
  40541. })) : vue.createCommentVNode("v-if", true),
  40542. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  40543. key: 1,
  40544. "aria-hidden": !vue.unref(checked)
  40545. }, vue.toDisplayString(_ctx.activeText), 9, _hoisted_5$1)) : vue.createCommentVNode("v-if", true)
  40546. ], 2)) : vue.createCommentVNode("v-if", true)
  40547. ], 14, _hoisted_1$d);
  40548. };
  40549. }
  40550. });
  40551. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "switch.vue"]]);
  40552. const ElSwitch = withInstall(Switch);
  40553. var matchHtmlRegExp = /["'&<>]/;
  40554. var escapeHtml_1 = escapeHtml;
  40555. function escapeHtml(string) {
  40556. var str = "" + string;
  40557. var match = matchHtmlRegExp.exec(str);
  40558. if (!match) {
  40559. return str;
  40560. }
  40561. var escape;
  40562. var html = "";
  40563. var index = 0;
  40564. var lastIndex = 0;
  40565. for (index = match.index; index < str.length; index++) {
  40566. switch (str.charCodeAt(index)) {
  40567. case 34:
  40568. escape = "&quot;";
  40569. break;
  40570. case 38:
  40571. escape = "&amp;";
  40572. break;
  40573. case 39:
  40574. escape = "&#39;";
  40575. break;
  40576. case 60:
  40577. escape = "&lt;";
  40578. break;
  40579. case 62:
  40580. escape = "&gt;";
  40581. break;
  40582. default:
  40583. continue;
  40584. }
  40585. if (lastIndex !== index) {
  40586. html += str.substring(lastIndex, index);
  40587. }
  40588. lastIndex = index + 1;
  40589. html += escape;
  40590. }
  40591. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  40592. }
  40593. /*!
  40594. * escape-html
  40595. * Copyright(c) 2012-2013 TJ Holowaychuk
  40596. * Copyright(c) 2015 Andreas Lubbe
  40597. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  40598. * MIT Licensed
  40599. */
  40600. const getCell = function(event) {
  40601. var _a;
  40602. return (_a = event.target) == null ? void 0 : _a.closest("td");
  40603. };
  40604. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  40605. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  40606. return array;
  40607. }
  40608. if (typeof reverse === "string") {
  40609. reverse = reverse === "descending" ? -1 : 1;
  40610. } else {
  40611. reverse = reverse && reverse < 0 ? -1 : 1;
  40612. }
  40613. const getKey = sortMethod ? null : function(value, index) {
  40614. if (sortBy) {
  40615. if (!Array.isArray(sortBy)) {
  40616. sortBy = [sortBy];
  40617. }
  40618. return sortBy.map((by) => {
  40619. if (typeof by === "string") {
  40620. return get(value, by);
  40621. } else {
  40622. return by(value, index, array);
  40623. }
  40624. });
  40625. }
  40626. if (sortKey !== "$key") {
  40627. if (isObject$1(value) && "$value" in value)
  40628. value = value.$value;
  40629. }
  40630. return [isObject$1(value) ? get(value, sortKey) : value];
  40631. };
  40632. const compare = function(a, b) {
  40633. if (sortMethod) {
  40634. return sortMethod(a.value, b.value);
  40635. }
  40636. for (let i = 0, len = a.key.length; i < len; i++) {
  40637. if (a.key[i] < b.key[i]) {
  40638. return -1;
  40639. }
  40640. if (a.key[i] > b.key[i]) {
  40641. return 1;
  40642. }
  40643. }
  40644. return 0;
  40645. };
  40646. return array.map((value, index) => {
  40647. return {
  40648. value,
  40649. index,
  40650. key: getKey ? getKey(value, index) : null
  40651. };
  40652. }).sort((a, b) => {
  40653. let order = compare(a, b);
  40654. if (!order) {
  40655. order = a.index - b.index;
  40656. }
  40657. return order * +reverse;
  40658. }).map((item) => item.value);
  40659. };
  40660. const getColumnById = function(table, columnId) {
  40661. let column = null;
  40662. table.columns.forEach((item) => {
  40663. if (item.id === columnId) {
  40664. column = item;
  40665. }
  40666. });
  40667. return column;
  40668. };
  40669. const getColumnByKey = function(table, columnKey) {
  40670. let column = null;
  40671. for (let i = 0; i < table.columns.length; i++) {
  40672. const item = table.columns[i];
  40673. if (item.columnKey === columnKey) {
  40674. column = item;
  40675. break;
  40676. }
  40677. }
  40678. if (!column)
  40679. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  40680. return column;
  40681. };
  40682. const getColumnByCell = function(table, cell, namespace) {
  40683. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  40684. if (matches) {
  40685. return getColumnById(table, matches[0]);
  40686. }
  40687. return null;
  40688. };
  40689. const getRowIdentity = (row, rowKey) => {
  40690. if (!row)
  40691. throw new Error("Row is required when get row identity");
  40692. if (typeof rowKey === "string") {
  40693. if (!rowKey.includes(".")) {
  40694. return `${row[rowKey]}`;
  40695. }
  40696. const key = rowKey.split(".");
  40697. let current = row;
  40698. for (const element of key) {
  40699. current = current[element];
  40700. }
  40701. return `${current}`;
  40702. } else if (typeof rowKey === "function") {
  40703. return rowKey.call(null, row);
  40704. }
  40705. };
  40706. const getKeysMap = function(array, rowKey) {
  40707. const arrayMap = {};
  40708. (array || []).forEach((row, index) => {
  40709. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  40710. });
  40711. return arrayMap;
  40712. };
  40713. function mergeOptions(defaults, config) {
  40714. const options = {};
  40715. let key;
  40716. for (key in defaults) {
  40717. options[key] = defaults[key];
  40718. }
  40719. for (key in config) {
  40720. if (hasOwn(config, key)) {
  40721. const value = config[key];
  40722. if (typeof value !== "undefined") {
  40723. options[key] = value;
  40724. }
  40725. }
  40726. }
  40727. return options;
  40728. }
  40729. function parseWidth(width) {
  40730. if (width === "")
  40731. return width;
  40732. if (width !== void 0) {
  40733. width = Number.parseInt(width, 10);
  40734. if (Number.isNaN(width)) {
  40735. width = "";
  40736. }
  40737. }
  40738. return width;
  40739. }
  40740. function parseMinWidth(minWidth) {
  40741. if (minWidth === "")
  40742. return minWidth;
  40743. if (minWidth !== void 0) {
  40744. minWidth = parseWidth(minWidth);
  40745. if (Number.isNaN(minWidth)) {
  40746. minWidth = 80;
  40747. }
  40748. }
  40749. return minWidth;
  40750. }
  40751. function parseHeight(height) {
  40752. if (typeof height === "number") {
  40753. return height;
  40754. }
  40755. if (typeof height === "string") {
  40756. if (/^\d+(?:px)?$/.test(height)) {
  40757. return Number.parseInt(height, 10);
  40758. } else {
  40759. return height;
  40760. }
  40761. }
  40762. return null;
  40763. }
  40764. function compose(...funcs) {
  40765. if (funcs.length === 0) {
  40766. return (arg) => arg;
  40767. }
  40768. if (funcs.length === 1) {
  40769. return funcs[0];
  40770. }
  40771. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  40772. }
  40773. function toggleRowStatus(statusArr, row, newVal) {
  40774. let changed = false;
  40775. const index = statusArr.indexOf(row);
  40776. const included = index !== -1;
  40777. const toggleStatus = (type) => {
  40778. if (type === "add") {
  40779. statusArr.push(row);
  40780. } else {
  40781. statusArr.splice(index, 1);
  40782. }
  40783. changed = true;
  40784. if (isArray$1(row.children)) {
  40785. row.children.forEach((item) => {
  40786. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included);
  40787. });
  40788. }
  40789. };
  40790. if (isBoolean$1(newVal)) {
  40791. if (newVal && !included) {
  40792. toggleStatus("add");
  40793. } else if (!newVal && included) {
  40794. toggleStatus("remove");
  40795. }
  40796. } else {
  40797. included ? toggleStatus("remove") : toggleStatus("add");
  40798. }
  40799. return changed;
  40800. }
  40801. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  40802. const isNil = (array) => !(Array.isArray(array) && array.length);
  40803. function _walker(parent, children, level) {
  40804. cb(parent, children, level);
  40805. children.forEach((item) => {
  40806. if (item[lazyKey]) {
  40807. cb(item, null, level + 1);
  40808. return;
  40809. }
  40810. const children2 = item[childrenKey];
  40811. if (!isNil(children2)) {
  40812. _walker(item, children2, level + 1);
  40813. }
  40814. });
  40815. }
  40816. root.forEach((item) => {
  40817. if (item[lazyKey]) {
  40818. cb(item, null, 0);
  40819. return;
  40820. }
  40821. const children = item[childrenKey];
  40822. if (!isNil(children)) {
  40823. _walker(item, children, 0);
  40824. }
  40825. });
  40826. }
  40827. let removePopper;
  40828. function createTablePopper(parentNode, trigger, popperContent, nextZIndex, tooltipOptions) {
  40829. tooltipOptions = merge({
  40830. enterable: true,
  40831. showArrow: true
  40832. }, tooltipOptions);
  40833. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  40834. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  40835. function renderContent() {
  40836. const isLight = tooltipOptions.effect === "light";
  40837. const content2 = document.createElement("div");
  40838. content2.className = [
  40839. `${ns}-popper`,
  40840. isLight ? "is-light" : "is-dark",
  40841. tooltipOptions.popperClass || ""
  40842. ].join(" ");
  40843. popperContent = escapeHtml_1(popperContent);
  40844. content2.innerHTML = popperContent;
  40845. content2.style.zIndex = String(nextZIndex());
  40846. parentNode == null ? void 0 : parentNode.appendChild(content2);
  40847. return content2;
  40848. }
  40849. function renderArrow() {
  40850. const arrow = document.createElement("div");
  40851. arrow.className = `${ns}-popper__arrow`;
  40852. return arrow;
  40853. }
  40854. function showPopper() {
  40855. popperInstance && popperInstance.update();
  40856. }
  40857. removePopper == null ? void 0 : removePopper();
  40858. removePopper = () => {
  40859. try {
  40860. popperInstance && popperInstance.destroy();
  40861. content && (parentNode == null ? void 0 : parentNode.removeChild(content));
  40862. trigger.removeEventListener("mouseenter", onOpen);
  40863. trigger.removeEventListener("mouseleave", onClose);
  40864. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  40865. removePopper = void 0;
  40866. } catch (e) {
  40867. }
  40868. };
  40869. let popperInstance = null;
  40870. let onOpen = showPopper;
  40871. let onClose = removePopper;
  40872. if (tooltipOptions.enterable) {
  40873. ({ onOpen, onClose } = useDelayedToggle({
  40874. showAfter: tooltipOptions.showAfter,
  40875. hideAfter: tooltipOptions.hideAfter,
  40876. open: showPopper,
  40877. close: removePopper
  40878. }));
  40879. }
  40880. const content = renderContent();
  40881. content.onmouseenter = onOpen;
  40882. content.onmouseleave = onClose;
  40883. const modifiers = [];
  40884. if (tooltipOptions.offset) {
  40885. modifiers.push({
  40886. name: "offset",
  40887. options: {
  40888. offset: [0, tooltipOptions.offset]
  40889. }
  40890. });
  40891. }
  40892. if (tooltipOptions.showArrow) {
  40893. const arrow = content.appendChild(renderArrow());
  40894. modifiers.push({
  40895. name: "arrow",
  40896. options: {
  40897. element: arrow,
  40898. padding: 10
  40899. }
  40900. });
  40901. }
  40902. const popperOptions = tooltipOptions.popperOptions || {};
  40903. popperInstance = yn(trigger, content, {
  40904. placement: tooltipOptions.placement || "top",
  40905. strategy: "fixed",
  40906. ...popperOptions,
  40907. modifiers: popperOptions.modifiers ? modifiers.concat(popperOptions.modifiers) : modifiers
  40908. });
  40909. trigger.addEventListener("mouseenter", onOpen);
  40910. trigger.addEventListener("mouseleave", onClose);
  40911. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  40912. return popperInstance;
  40913. }
  40914. function getCurrentColumns(column) {
  40915. if (column.children) {
  40916. return flatMap(column.children, getCurrentColumns);
  40917. } else {
  40918. return [column];
  40919. }
  40920. }
  40921. function getColSpan(colSpan, column) {
  40922. return colSpan + column.colSpan;
  40923. }
  40924. const isFixedColumn = (index, fixed, store, realColumns) => {
  40925. let start = 0;
  40926. let after = index;
  40927. const columns = store.states.columns.value;
  40928. if (realColumns) {
  40929. const curColumns = getCurrentColumns(realColumns[index]);
  40930. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  40931. start = preColumns.reduce(getColSpan, 0);
  40932. after = start + curColumns.reduce(getColSpan, 0) - 1;
  40933. } else {
  40934. start = index;
  40935. }
  40936. let fixedLayout;
  40937. switch (fixed) {
  40938. case "left":
  40939. if (after < store.states.fixedLeafColumnsLength.value) {
  40940. fixedLayout = "left";
  40941. }
  40942. break;
  40943. case "right":
  40944. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  40945. fixedLayout = "right";
  40946. }
  40947. break;
  40948. default:
  40949. if (after < store.states.fixedLeafColumnsLength.value) {
  40950. fixedLayout = "left";
  40951. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  40952. fixedLayout = "right";
  40953. }
  40954. }
  40955. return fixedLayout ? {
  40956. direction: fixedLayout,
  40957. start,
  40958. after
  40959. } : {};
  40960. };
  40961. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  40962. const classes = [];
  40963. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  40964. if (direction) {
  40965. const isLeft = direction === "left";
  40966. classes.push(`${namespace}-fixed-column--${direction}`);
  40967. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  40968. classes.push("is-last-column");
  40969. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  40970. classes.push("is-first-column");
  40971. }
  40972. }
  40973. return classes;
  40974. };
  40975. function getOffset(offset, column) {
  40976. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  40977. }
  40978. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  40979. const {
  40980. direction,
  40981. start = 0,
  40982. after = 0
  40983. } = isFixedColumn(index, fixed, store, realColumns);
  40984. if (!direction) {
  40985. return;
  40986. }
  40987. const styles = {};
  40988. const isLeft = direction === "left";
  40989. const columns = store.states.columns.value;
  40990. if (isLeft) {
  40991. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  40992. } else {
  40993. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  40994. }
  40995. return styles;
  40996. };
  40997. const ensurePosition = (style, key) => {
  40998. if (!style)
  40999. return;
  41000. if (!Number.isNaN(style[key])) {
  41001. style[key] = `${style[key]}px`;
  41002. }
  41003. };
  41004. function useExpand(watcherData) {
  41005. const instance = vue.getCurrentInstance();
  41006. const defaultExpandAll = vue.ref(false);
  41007. const expandRows = vue.ref([]);
  41008. const updateExpandRows = () => {
  41009. const data = watcherData.data.value || [];
  41010. const rowKey = watcherData.rowKey.value;
  41011. if (defaultExpandAll.value) {
  41012. expandRows.value = data.slice();
  41013. } else if (rowKey) {
  41014. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  41015. expandRows.value = data.reduce((prev, row) => {
  41016. const rowId = getRowIdentity(row, rowKey);
  41017. const rowInfo = expandRowsMap[rowId];
  41018. if (rowInfo) {
  41019. prev.push(row);
  41020. }
  41021. return prev;
  41022. }, []);
  41023. } else {
  41024. expandRows.value = [];
  41025. }
  41026. };
  41027. const toggleRowExpansion = (row, expanded) => {
  41028. const changed = toggleRowStatus(expandRows.value, row, expanded);
  41029. if (changed) {
  41030. instance.emit("expand-change", row, expandRows.value.slice());
  41031. }
  41032. };
  41033. const setExpandRowKeys = (rowKeys) => {
  41034. instance.store.assertRowKey();
  41035. const data = watcherData.data.value || [];
  41036. const rowKey = watcherData.rowKey.value;
  41037. const keysMap = getKeysMap(data, rowKey);
  41038. expandRows.value = rowKeys.reduce((prev, cur) => {
  41039. const info = keysMap[cur];
  41040. if (info) {
  41041. prev.push(info.row);
  41042. }
  41043. return prev;
  41044. }, []);
  41045. };
  41046. const isRowExpanded = (row) => {
  41047. const rowKey = watcherData.rowKey.value;
  41048. if (rowKey) {
  41049. const expandMap = getKeysMap(expandRows.value, rowKey);
  41050. return !!expandMap[getRowIdentity(row, rowKey)];
  41051. }
  41052. return expandRows.value.includes(row);
  41053. };
  41054. return {
  41055. updateExpandRows,
  41056. toggleRowExpansion,
  41057. setExpandRowKeys,
  41058. isRowExpanded,
  41059. states: {
  41060. expandRows,
  41061. defaultExpandAll
  41062. }
  41063. };
  41064. }
  41065. function useCurrent(watcherData) {
  41066. const instance = vue.getCurrentInstance();
  41067. const _currentRowKey = vue.ref(null);
  41068. const currentRow = vue.ref(null);
  41069. const setCurrentRowKey = (key) => {
  41070. instance.store.assertRowKey();
  41071. _currentRowKey.value = key;
  41072. setCurrentRowByKey(key);
  41073. };
  41074. const restoreCurrentRowKey = () => {
  41075. _currentRowKey.value = null;
  41076. };
  41077. const setCurrentRowByKey = (key) => {
  41078. const { data, rowKey } = watcherData;
  41079. let _currentRow = null;
  41080. if (rowKey.value) {
  41081. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  41082. }
  41083. currentRow.value = _currentRow;
  41084. instance.emit("current-change", currentRow.value, null);
  41085. };
  41086. const updateCurrentRow = (_currentRow) => {
  41087. const oldCurrentRow = currentRow.value;
  41088. if (_currentRow && _currentRow !== oldCurrentRow) {
  41089. currentRow.value = _currentRow;
  41090. instance.emit("current-change", currentRow.value, oldCurrentRow);
  41091. return;
  41092. }
  41093. if (!_currentRow && oldCurrentRow) {
  41094. currentRow.value = null;
  41095. instance.emit("current-change", null, oldCurrentRow);
  41096. }
  41097. };
  41098. const updateCurrentRowData = () => {
  41099. const rowKey = watcherData.rowKey.value;
  41100. const data = watcherData.data.value || [];
  41101. const oldCurrentRow = currentRow.value;
  41102. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  41103. if (rowKey) {
  41104. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  41105. setCurrentRowByKey(currentRowKey);
  41106. } else {
  41107. currentRow.value = null;
  41108. }
  41109. if (currentRow.value === null) {
  41110. instance.emit("current-change", null, oldCurrentRow);
  41111. }
  41112. } else if (_currentRowKey.value) {
  41113. setCurrentRowByKey(_currentRowKey.value);
  41114. restoreCurrentRowKey();
  41115. }
  41116. };
  41117. return {
  41118. setCurrentRowKey,
  41119. restoreCurrentRowKey,
  41120. setCurrentRowByKey,
  41121. updateCurrentRow,
  41122. updateCurrentRowData,
  41123. states: {
  41124. _currentRowKey,
  41125. currentRow
  41126. }
  41127. };
  41128. }
  41129. function useTree$2(watcherData) {
  41130. const expandRowKeys = vue.ref([]);
  41131. const treeData = vue.ref({});
  41132. const indent = vue.ref(16);
  41133. const lazy = vue.ref(false);
  41134. const lazyTreeNodeMap = vue.ref({});
  41135. const lazyColumnIdentifier = vue.ref("hasChildren");
  41136. const childrenColumnName = vue.ref("children");
  41137. const instance = vue.getCurrentInstance();
  41138. const normalizedData = vue.computed(() => {
  41139. if (!watcherData.rowKey.value)
  41140. return {};
  41141. const data = watcherData.data.value || [];
  41142. return normalize(data);
  41143. });
  41144. const normalizedLazyNode = vue.computed(() => {
  41145. const rowKey = watcherData.rowKey.value;
  41146. const keys = Object.keys(lazyTreeNodeMap.value);
  41147. const res = {};
  41148. if (!keys.length)
  41149. return res;
  41150. keys.forEach((key) => {
  41151. if (lazyTreeNodeMap.value[key].length) {
  41152. const item = { children: [] };
  41153. lazyTreeNodeMap.value[key].forEach((row) => {
  41154. const currentRowKey = getRowIdentity(row, rowKey);
  41155. item.children.push(currentRowKey);
  41156. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  41157. res[currentRowKey] = { children: [] };
  41158. }
  41159. });
  41160. res[key] = item;
  41161. }
  41162. });
  41163. return res;
  41164. });
  41165. const normalize = (data) => {
  41166. const rowKey = watcherData.rowKey.value;
  41167. const res = {};
  41168. walkTreeNode(data, (parent, children, level) => {
  41169. const parentId = getRowIdentity(parent, rowKey);
  41170. if (Array.isArray(children)) {
  41171. res[parentId] = {
  41172. children: children.map((row) => getRowIdentity(row, rowKey)),
  41173. level
  41174. };
  41175. } else if (lazy.value) {
  41176. res[parentId] = {
  41177. children: [],
  41178. lazy: true,
  41179. level
  41180. };
  41181. }
  41182. }, childrenColumnName.value, lazyColumnIdentifier.value);
  41183. return res;
  41184. };
  41185. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  41186. var _a2;
  41187. const nested = normalizedData.value;
  41188. const normalizedLazyNode_ = normalizedLazyNode.value;
  41189. const keys = Object.keys(nested);
  41190. const newTreeData = {};
  41191. if (keys.length) {
  41192. const oldTreeData = vue.unref(treeData);
  41193. const rootLazyRowKeys = [];
  41194. const getExpanded = (oldValue, key) => {
  41195. if (ifChangeExpandRowKeys) {
  41196. if (expandRowKeys.value) {
  41197. return ifExpandAll || expandRowKeys.value.includes(key);
  41198. } else {
  41199. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  41200. }
  41201. } else {
  41202. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  41203. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  41204. }
  41205. };
  41206. keys.forEach((key) => {
  41207. const oldValue = oldTreeData[key];
  41208. const newValue = { ...nested[key] };
  41209. newValue.expanded = getExpanded(oldValue, key);
  41210. if (newValue.lazy) {
  41211. const { loaded = false, loading = false } = oldValue || {};
  41212. newValue.loaded = !!loaded;
  41213. newValue.loading = !!loading;
  41214. rootLazyRowKeys.push(key);
  41215. }
  41216. newTreeData[key] = newValue;
  41217. });
  41218. const lazyKeys = Object.keys(normalizedLazyNode_);
  41219. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  41220. lazyKeys.forEach((key) => {
  41221. const oldValue = oldTreeData[key];
  41222. const lazyNodeChildren = normalizedLazyNode_[key].children;
  41223. if (rootLazyRowKeys.includes(key)) {
  41224. if (newTreeData[key].children.length !== 0) {
  41225. throw new Error("[ElTable]children must be an empty array.");
  41226. }
  41227. newTreeData[key].children = lazyNodeChildren;
  41228. } else {
  41229. const { loaded = false, loading = false } = oldValue || {};
  41230. newTreeData[key] = {
  41231. lazy: true,
  41232. loaded: !!loaded,
  41233. loading: !!loading,
  41234. expanded: getExpanded(oldValue, key),
  41235. children: lazyNodeChildren,
  41236. level: ""
  41237. };
  41238. }
  41239. });
  41240. }
  41241. }
  41242. treeData.value = newTreeData;
  41243. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  41244. };
  41245. vue.watch(() => expandRowKeys.value, () => {
  41246. updateTreeData(true);
  41247. });
  41248. vue.watch(() => normalizedData.value, () => {
  41249. updateTreeData();
  41250. });
  41251. vue.watch(() => normalizedLazyNode.value, () => {
  41252. updateTreeData();
  41253. });
  41254. const updateTreeExpandKeys = (value) => {
  41255. expandRowKeys.value = value;
  41256. updateTreeData();
  41257. };
  41258. const toggleTreeExpansion = (row, expanded) => {
  41259. instance.store.assertRowKey();
  41260. const rowKey = watcherData.rowKey.value;
  41261. const id = getRowIdentity(row, rowKey);
  41262. const data = id && treeData.value[id];
  41263. if (id && data && "expanded" in data) {
  41264. const oldExpanded = data.expanded;
  41265. expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
  41266. treeData.value[id].expanded = expanded;
  41267. if (oldExpanded !== expanded) {
  41268. instance.emit("expand-change", row, expanded);
  41269. }
  41270. instance.store.updateTableScrollY();
  41271. }
  41272. };
  41273. const loadOrToggle = (row) => {
  41274. instance.store.assertRowKey();
  41275. const rowKey = watcherData.rowKey.value;
  41276. const id = getRowIdentity(row, rowKey);
  41277. const data = treeData.value[id];
  41278. if (lazy.value && data && "loaded" in data && !data.loaded) {
  41279. loadData(row, id, data);
  41280. } else {
  41281. toggleTreeExpansion(row, void 0);
  41282. }
  41283. };
  41284. const loadData = (row, key, treeNode) => {
  41285. const { load } = instance.props;
  41286. if (load && !treeData.value[key].loaded) {
  41287. treeData.value[key].loading = true;
  41288. load(row, treeNode, (data) => {
  41289. if (!Array.isArray(data)) {
  41290. throw new TypeError("[ElTable] data must be an array");
  41291. }
  41292. treeData.value[key].loading = false;
  41293. treeData.value[key].loaded = true;
  41294. treeData.value[key].expanded = true;
  41295. if (data.length) {
  41296. lazyTreeNodeMap.value[key] = data;
  41297. }
  41298. instance.emit("expand-change", row, true);
  41299. });
  41300. }
  41301. };
  41302. return {
  41303. loadData,
  41304. loadOrToggle,
  41305. toggleTreeExpansion,
  41306. updateTreeExpandKeys,
  41307. updateTreeData,
  41308. normalize,
  41309. states: {
  41310. expandRowKeys,
  41311. treeData,
  41312. indent,
  41313. lazy,
  41314. lazyTreeNodeMap,
  41315. lazyColumnIdentifier,
  41316. childrenColumnName
  41317. }
  41318. };
  41319. }
  41320. const sortData = (data, states) => {
  41321. const sortingColumn = states.sortingColumn;
  41322. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  41323. return data;
  41324. }
  41325. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  41326. };
  41327. const doFlattenColumns = (columns) => {
  41328. const result = [];
  41329. columns.forEach((column) => {
  41330. if (column.children) {
  41331. result.push.apply(result, doFlattenColumns(column.children));
  41332. } else {
  41333. result.push(column);
  41334. }
  41335. });
  41336. return result;
  41337. };
  41338. function useWatcher$1() {
  41339. var _a;
  41340. const instance = vue.getCurrentInstance();
  41341. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  41342. const rowKey = vue.ref(null);
  41343. const data = vue.ref([]);
  41344. const _data = vue.ref([]);
  41345. const isComplex = vue.ref(false);
  41346. const _columns = vue.ref([]);
  41347. const originColumns = vue.ref([]);
  41348. const columns = vue.ref([]);
  41349. const fixedColumns = vue.ref([]);
  41350. const rightFixedColumns = vue.ref([]);
  41351. const leafColumns = vue.ref([]);
  41352. const fixedLeafColumns = vue.ref([]);
  41353. const rightFixedLeafColumns = vue.ref([]);
  41354. const updateOrderFns = [];
  41355. const leafColumnsLength = vue.ref(0);
  41356. const fixedLeafColumnsLength = vue.ref(0);
  41357. const rightFixedLeafColumnsLength = vue.ref(0);
  41358. const isAllSelected = vue.ref(false);
  41359. const selection = vue.ref([]);
  41360. const reserveSelection = vue.ref(false);
  41361. const selectOnIndeterminate = vue.ref(false);
  41362. const selectable = vue.ref(null);
  41363. const filters = vue.ref({});
  41364. const filteredData = vue.ref(null);
  41365. const sortingColumn = vue.ref(null);
  41366. const sortProp = vue.ref(null);
  41367. const sortOrder = vue.ref(null);
  41368. const hoverRow = vue.ref(null);
  41369. vue.watch(data, () => instance.state && scheduleLayout(false), {
  41370. deep: true
  41371. });
  41372. const assertRowKey = () => {
  41373. if (!rowKey.value)
  41374. throw new Error("[ElTable] prop row-key is required");
  41375. };
  41376. const updateChildFixed = (column) => {
  41377. var _a2;
  41378. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  41379. childColumn.fixed = column.fixed;
  41380. updateChildFixed(childColumn);
  41381. });
  41382. };
  41383. const updateColumns = () => {
  41384. _columns.value.forEach((column) => {
  41385. updateChildFixed(column);
  41386. });
  41387. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  41388. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  41389. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  41390. _columns.value[0].fixed = true;
  41391. fixedColumns.value.unshift(_columns.value[0]);
  41392. }
  41393. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  41394. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  41395. const leafColumns2 = doFlattenColumns(notFixedColumns);
  41396. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  41397. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  41398. leafColumnsLength.value = leafColumns2.length;
  41399. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  41400. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  41401. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  41402. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  41403. };
  41404. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  41405. if (needUpdateColumns) {
  41406. updateColumns();
  41407. }
  41408. if (immediate) {
  41409. instance.state.doLayout();
  41410. } else {
  41411. instance.state.debouncedUpdateLayout();
  41412. }
  41413. };
  41414. const isSelected = (row) => {
  41415. return selection.value.includes(row);
  41416. };
  41417. const clearSelection = () => {
  41418. isAllSelected.value = false;
  41419. const oldSelection = selection.value;
  41420. if (oldSelection.length) {
  41421. selection.value = [];
  41422. instance.emit("selection-change", []);
  41423. }
  41424. };
  41425. const cleanSelection = () => {
  41426. let deleted;
  41427. if (rowKey.value) {
  41428. deleted = [];
  41429. const selectedMap = getKeysMap(selection.value, rowKey.value);
  41430. const dataMap = getKeysMap(data.value, rowKey.value);
  41431. for (const key in selectedMap) {
  41432. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  41433. deleted.push(selectedMap[key].row);
  41434. }
  41435. }
  41436. } else {
  41437. deleted = selection.value.filter((item) => !data.value.includes(item));
  41438. }
  41439. if (deleted.length) {
  41440. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  41441. selection.value = newSelection;
  41442. instance.emit("selection-change", newSelection.slice());
  41443. }
  41444. };
  41445. const getSelectionRows = () => {
  41446. return (selection.value || []).slice();
  41447. };
  41448. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  41449. const changed = toggleRowStatus(selection.value, row, selected);
  41450. if (changed) {
  41451. const newSelection = (selection.value || []).slice();
  41452. if (emitChange) {
  41453. instance.emit("select", newSelection, row);
  41454. }
  41455. instance.emit("selection-change", newSelection);
  41456. }
  41457. };
  41458. const _toggleAllSelection = () => {
  41459. var _a2, _b;
  41460. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  41461. isAllSelected.value = value;
  41462. let selectionChanged = false;
  41463. let childrenCount = 0;
  41464. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  41465. data.value.forEach((row, index) => {
  41466. const rowIndex = index + childrenCount;
  41467. if (selectable.value) {
  41468. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  41469. selectionChanged = true;
  41470. }
  41471. } else {
  41472. if (toggleRowStatus(selection.value, row, value)) {
  41473. selectionChanged = true;
  41474. }
  41475. }
  41476. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  41477. });
  41478. if (selectionChanged) {
  41479. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  41480. }
  41481. instance.emit("select-all", selection.value);
  41482. };
  41483. const updateSelectionByRowKey = () => {
  41484. const selectedMap = getKeysMap(selection.value, rowKey.value);
  41485. data.value.forEach((row) => {
  41486. const rowId = getRowIdentity(row, rowKey.value);
  41487. const rowInfo = selectedMap[rowId];
  41488. if (rowInfo) {
  41489. selection.value[rowInfo.index] = row;
  41490. }
  41491. });
  41492. };
  41493. const updateAllSelected = () => {
  41494. var _a2, _b, _c;
  41495. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  41496. isAllSelected.value = false;
  41497. return;
  41498. }
  41499. let selectedMap;
  41500. if (rowKey.value) {
  41501. selectedMap = getKeysMap(selection.value, rowKey.value);
  41502. }
  41503. const isSelected2 = function(row) {
  41504. if (selectedMap) {
  41505. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  41506. } else {
  41507. return selection.value.includes(row);
  41508. }
  41509. };
  41510. let isAllSelected_ = true;
  41511. let selectedCount = 0;
  41512. let childrenCount = 0;
  41513. for (let i = 0, j = (data.value || []).length; i < j; i++) {
  41514. const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value;
  41515. const rowIndex = i + childrenCount;
  41516. const item = data.value[i];
  41517. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  41518. if (!isSelected2(item)) {
  41519. if (!selectable.value || isRowSelectable) {
  41520. isAllSelected_ = false;
  41521. break;
  41522. }
  41523. } else {
  41524. selectedCount++;
  41525. }
  41526. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  41527. }
  41528. if (selectedCount === 0)
  41529. isAllSelected_ = false;
  41530. isAllSelected.value = isAllSelected_;
  41531. };
  41532. const getChildrenCount = (rowKey2) => {
  41533. var _a2;
  41534. if (!instance || !instance.store)
  41535. return 0;
  41536. const { treeData } = instance.store.states;
  41537. let count = 0;
  41538. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  41539. if (children) {
  41540. count += children.length;
  41541. children.forEach((childKey) => {
  41542. count += getChildrenCount(childKey);
  41543. });
  41544. }
  41545. return count;
  41546. };
  41547. const updateFilters = (columns2, values) => {
  41548. if (!Array.isArray(columns2)) {
  41549. columns2 = [columns2];
  41550. }
  41551. const filters_ = {};
  41552. columns2.forEach((col) => {
  41553. filters.value[col.id] = values;
  41554. filters_[col.columnKey || col.id] = values;
  41555. });
  41556. return filters_;
  41557. };
  41558. const updateSort = (column, prop, order) => {
  41559. if (sortingColumn.value && sortingColumn.value !== column) {
  41560. sortingColumn.value.order = null;
  41561. }
  41562. sortingColumn.value = column;
  41563. sortProp.value = prop;
  41564. sortOrder.value = order;
  41565. };
  41566. const execFilter = () => {
  41567. let sourceData = vue.unref(_data);
  41568. Object.keys(filters.value).forEach((columnId) => {
  41569. const values = filters.value[columnId];
  41570. if (!values || values.length === 0)
  41571. return;
  41572. const column = getColumnById({
  41573. columns: columns.value
  41574. }, columnId);
  41575. if (column && column.filterMethod) {
  41576. sourceData = sourceData.filter((row) => {
  41577. return values.some((value) => column.filterMethod.call(null, value, row, column));
  41578. });
  41579. }
  41580. });
  41581. filteredData.value = sourceData;
  41582. };
  41583. const execSort = () => {
  41584. data.value = sortData(filteredData.value, {
  41585. sortingColumn: sortingColumn.value,
  41586. sortProp: sortProp.value,
  41587. sortOrder: sortOrder.value
  41588. });
  41589. };
  41590. const execQuery = (ignore = void 0) => {
  41591. if (!(ignore && ignore.filter)) {
  41592. execFilter();
  41593. }
  41594. execSort();
  41595. };
  41596. const clearFilter = (columnKeys) => {
  41597. const { tableHeaderRef } = instance.refs;
  41598. if (!tableHeaderRef)
  41599. return;
  41600. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  41601. const keys = Object.keys(panels);
  41602. if (!keys.length)
  41603. return;
  41604. if (typeof columnKeys === "string") {
  41605. columnKeys = [columnKeys];
  41606. }
  41607. if (Array.isArray(columnKeys)) {
  41608. const columns_ = columnKeys.map((key) => getColumnByKey({
  41609. columns: columns.value
  41610. }, key));
  41611. keys.forEach((key) => {
  41612. const column = columns_.find((col) => col.id === key);
  41613. if (column) {
  41614. column.filteredValue = [];
  41615. }
  41616. });
  41617. instance.store.commit("filterChange", {
  41618. column: columns_,
  41619. values: [],
  41620. silent: true,
  41621. multi: true
  41622. });
  41623. } else {
  41624. keys.forEach((key) => {
  41625. const column = columns.value.find((col) => col.id === key);
  41626. if (column) {
  41627. column.filteredValue = [];
  41628. }
  41629. });
  41630. filters.value = {};
  41631. instance.store.commit("filterChange", {
  41632. column: {},
  41633. values: [],
  41634. silent: true
  41635. });
  41636. }
  41637. };
  41638. const clearSort = () => {
  41639. if (!sortingColumn.value)
  41640. return;
  41641. updateSort(null, null, null);
  41642. instance.store.commit("changeSortCondition", {
  41643. silent: true
  41644. });
  41645. };
  41646. const {
  41647. setExpandRowKeys,
  41648. toggleRowExpansion,
  41649. updateExpandRows,
  41650. states: expandStates,
  41651. isRowExpanded
  41652. } = useExpand({
  41653. data,
  41654. rowKey
  41655. });
  41656. const {
  41657. updateTreeExpandKeys,
  41658. toggleTreeExpansion,
  41659. updateTreeData,
  41660. loadOrToggle,
  41661. states: treeStates
  41662. } = useTree$2({
  41663. data,
  41664. rowKey
  41665. });
  41666. const {
  41667. updateCurrentRowData,
  41668. updateCurrentRow,
  41669. setCurrentRowKey,
  41670. states: currentData
  41671. } = useCurrent({
  41672. data,
  41673. rowKey
  41674. });
  41675. const setExpandRowKeysAdapter = (val) => {
  41676. setExpandRowKeys(val);
  41677. updateTreeExpandKeys(val);
  41678. };
  41679. const toggleRowExpansionAdapter = (row, expanded) => {
  41680. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  41681. if (hasExpandColumn) {
  41682. toggleRowExpansion(row, expanded);
  41683. } else {
  41684. toggleTreeExpansion(row, expanded);
  41685. }
  41686. };
  41687. return {
  41688. assertRowKey,
  41689. updateColumns,
  41690. scheduleLayout,
  41691. isSelected,
  41692. clearSelection,
  41693. cleanSelection,
  41694. getSelectionRows,
  41695. toggleRowSelection,
  41696. _toggleAllSelection,
  41697. toggleAllSelection: null,
  41698. updateSelectionByRowKey,
  41699. updateAllSelected,
  41700. updateFilters,
  41701. updateCurrentRow,
  41702. updateSort,
  41703. execFilter,
  41704. execSort,
  41705. execQuery,
  41706. clearFilter,
  41707. clearSort,
  41708. toggleRowExpansion,
  41709. setExpandRowKeysAdapter,
  41710. setCurrentRowKey,
  41711. toggleRowExpansionAdapter,
  41712. isRowExpanded,
  41713. updateExpandRows,
  41714. updateCurrentRowData,
  41715. loadOrToggle,
  41716. updateTreeData,
  41717. states: {
  41718. tableSize,
  41719. rowKey,
  41720. data,
  41721. _data,
  41722. isComplex,
  41723. _columns,
  41724. originColumns,
  41725. columns,
  41726. fixedColumns,
  41727. rightFixedColumns,
  41728. leafColumns,
  41729. fixedLeafColumns,
  41730. rightFixedLeafColumns,
  41731. updateOrderFns,
  41732. leafColumnsLength,
  41733. fixedLeafColumnsLength,
  41734. rightFixedLeafColumnsLength,
  41735. isAllSelected,
  41736. selection,
  41737. reserveSelection,
  41738. selectOnIndeterminate,
  41739. selectable,
  41740. filters,
  41741. filteredData,
  41742. sortingColumn,
  41743. sortProp,
  41744. sortOrder,
  41745. hoverRow,
  41746. ...expandStates,
  41747. ...treeStates,
  41748. ...currentData
  41749. }
  41750. };
  41751. }
  41752. function replaceColumn(array, column) {
  41753. return array.map((item) => {
  41754. var _a;
  41755. if (item.id === column.id) {
  41756. return column;
  41757. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  41758. item.children = replaceColumn(item.children, column);
  41759. }
  41760. return item;
  41761. });
  41762. }
  41763. function sortColumn(array) {
  41764. array.forEach((item) => {
  41765. var _a, _b;
  41766. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  41767. if ((_b = item.children) == null ? void 0 : _b.length) {
  41768. sortColumn(item.children);
  41769. }
  41770. });
  41771. array.sort((cur, pre) => cur.no - pre.no);
  41772. }
  41773. function useStore() {
  41774. const instance = vue.getCurrentInstance();
  41775. const watcher = useWatcher$1();
  41776. const ns = useNamespace("table");
  41777. const mutations = {
  41778. setData(states, data) {
  41779. const dataInstanceChanged = vue.unref(states._data) !== data;
  41780. states.data.value = data;
  41781. states._data.value = data;
  41782. instance.store.execQuery();
  41783. instance.store.updateCurrentRowData();
  41784. instance.store.updateExpandRows();
  41785. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  41786. if (vue.unref(states.reserveSelection)) {
  41787. instance.store.assertRowKey();
  41788. instance.store.updateSelectionByRowKey();
  41789. } else {
  41790. if (dataInstanceChanged) {
  41791. instance.store.clearSelection();
  41792. } else {
  41793. instance.store.cleanSelection();
  41794. }
  41795. }
  41796. instance.store.updateAllSelected();
  41797. if (instance.$ready) {
  41798. instance.store.scheduleLayout();
  41799. }
  41800. },
  41801. insertColumn(states, column, parent, updateColumnOrder) {
  41802. const array = vue.unref(states._columns);
  41803. let newColumns = [];
  41804. if (!parent) {
  41805. array.push(column);
  41806. newColumns = array;
  41807. } else {
  41808. if (parent && !parent.children) {
  41809. parent.children = [];
  41810. }
  41811. parent.children.push(column);
  41812. newColumns = replaceColumn(array, parent);
  41813. }
  41814. sortColumn(newColumns);
  41815. states._columns.value = newColumns;
  41816. states.updateOrderFns.push(updateColumnOrder);
  41817. if (column.type === "selection") {
  41818. states.selectable.value = column.selectable;
  41819. states.reserveSelection.value = column.reserveSelection;
  41820. }
  41821. if (instance.$ready) {
  41822. instance.store.updateColumns();
  41823. instance.store.scheduleLayout();
  41824. }
  41825. },
  41826. updateColumnOrder(states, column) {
  41827. var _a;
  41828. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  41829. if (newColumnIndex === column.no)
  41830. return;
  41831. sortColumn(states._columns.value);
  41832. if (instance.$ready) {
  41833. instance.store.updateColumns();
  41834. }
  41835. },
  41836. removeColumn(states, column, parent, updateColumnOrder) {
  41837. const array = vue.unref(states._columns) || [];
  41838. if (parent) {
  41839. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  41840. vue.nextTick(() => {
  41841. var _a;
  41842. if (((_a = parent.children) == null ? void 0 : _a.length) === 0) {
  41843. delete parent.children;
  41844. }
  41845. });
  41846. states._columns.value = replaceColumn(array, parent);
  41847. } else {
  41848. const index = array.indexOf(column);
  41849. if (index > -1) {
  41850. array.splice(index, 1);
  41851. states._columns.value = array;
  41852. }
  41853. }
  41854. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  41855. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  41856. if (instance.$ready) {
  41857. instance.store.updateColumns();
  41858. instance.store.scheduleLayout();
  41859. }
  41860. },
  41861. sort(states, options) {
  41862. const { prop, order, init } = options;
  41863. if (prop) {
  41864. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  41865. if (column) {
  41866. column.order = order;
  41867. instance.store.updateSort(column, prop, order);
  41868. instance.store.commit("changeSortCondition", { init });
  41869. }
  41870. }
  41871. },
  41872. changeSortCondition(states, options) {
  41873. const { sortingColumn, sortProp, sortOrder } = states;
  41874. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  41875. if (orderValue === null) {
  41876. states.sortingColumn.value = null;
  41877. states.sortProp.value = null;
  41878. }
  41879. const ignore = { filter: true };
  41880. instance.store.execQuery(ignore);
  41881. if (!options || !(options.silent || options.init)) {
  41882. instance.emit("sort-change", {
  41883. column: columnValue,
  41884. prop: propValue,
  41885. order: orderValue
  41886. });
  41887. }
  41888. instance.store.updateTableScrollY();
  41889. },
  41890. filterChange(_states, options) {
  41891. const { column, values, silent } = options;
  41892. const newFilters = instance.store.updateFilters(column, values);
  41893. instance.store.execQuery();
  41894. if (!silent) {
  41895. instance.emit("filter-change", newFilters);
  41896. }
  41897. instance.store.updateTableScrollY();
  41898. },
  41899. toggleAllSelection() {
  41900. instance.store.toggleAllSelection();
  41901. },
  41902. rowSelectedChanged(_states, row) {
  41903. instance.store.toggleRowSelection(row);
  41904. instance.store.updateAllSelected();
  41905. },
  41906. setHoverRow(states, row) {
  41907. states.hoverRow.value = row;
  41908. },
  41909. setCurrentRow(_states, row) {
  41910. instance.store.updateCurrentRow(row);
  41911. }
  41912. };
  41913. const commit = function(name, ...args) {
  41914. const mutations2 = instance.store.mutations;
  41915. if (mutations2[name]) {
  41916. mutations2[name].apply(instance, [instance.store.states].concat(args));
  41917. } else {
  41918. throw new Error(`Action not found: ${name}`);
  41919. }
  41920. };
  41921. const updateTableScrollY = function() {
  41922. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  41923. };
  41924. return {
  41925. ns,
  41926. ...watcher,
  41927. mutations,
  41928. commit,
  41929. updateTableScrollY
  41930. };
  41931. }
  41932. const InitialStateMap = {
  41933. rowKey: "rowKey",
  41934. defaultExpandAll: "defaultExpandAll",
  41935. selectOnIndeterminate: "selectOnIndeterminate",
  41936. indent: "indent",
  41937. lazy: "lazy",
  41938. data: "data",
  41939. ["treeProps.hasChildren"]: {
  41940. key: "lazyColumnIdentifier",
  41941. default: "hasChildren"
  41942. },
  41943. ["treeProps.children"]: {
  41944. key: "childrenColumnName",
  41945. default: "children"
  41946. }
  41947. };
  41948. function createStore(table, props) {
  41949. if (!table) {
  41950. throw new Error("Table is required.");
  41951. }
  41952. const store = useStore();
  41953. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  41954. Object.keys(InitialStateMap).forEach((key) => {
  41955. handleValue(getArrKeysValue(props, key), key, store);
  41956. });
  41957. proxyTableProps(store, props);
  41958. return store;
  41959. }
  41960. function proxyTableProps(store, props) {
  41961. Object.keys(InitialStateMap).forEach((key) => {
  41962. vue.watch(() => getArrKeysValue(props, key), (value) => {
  41963. handleValue(value, key, store);
  41964. });
  41965. });
  41966. }
  41967. function handleValue(value, propsKey, store) {
  41968. let newVal = value;
  41969. let storeKey = InitialStateMap[propsKey];
  41970. if (typeof InitialStateMap[propsKey] === "object") {
  41971. storeKey = storeKey.key;
  41972. newVal = newVal || InitialStateMap[propsKey].default;
  41973. }
  41974. store.states[storeKey].value = newVal;
  41975. }
  41976. function getArrKeysValue(props, keys) {
  41977. if (keys.includes(".")) {
  41978. const keyList = keys.split(".");
  41979. let value = props;
  41980. keyList.forEach((key) => {
  41981. value = value[key];
  41982. });
  41983. return value;
  41984. } else {
  41985. return props[keys];
  41986. }
  41987. }
  41988. class TableLayout {
  41989. constructor(options) {
  41990. this.observers = [];
  41991. this.table = null;
  41992. this.store = null;
  41993. this.columns = [];
  41994. this.fit = true;
  41995. this.showHeader = true;
  41996. this.height = vue.ref(null);
  41997. this.scrollX = vue.ref(false);
  41998. this.scrollY = vue.ref(false);
  41999. this.bodyWidth = vue.ref(null);
  42000. this.fixedWidth = vue.ref(null);
  42001. this.rightFixedWidth = vue.ref(null);
  42002. this.gutterWidth = 0;
  42003. for (const name in options) {
  42004. if (hasOwn(options, name)) {
  42005. if (vue.isRef(this[name])) {
  42006. this[name].value = options[name];
  42007. } else {
  42008. this[name] = options[name];
  42009. }
  42010. }
  42011. }
  42012. if (!this.table) {
  42013. throw new Error("Table is required for Table Layout");
  42014. }
  42015. if (!this.store) {
  42016. throw new Error("Store is required for Table Layout");
  42017. }
  42018. }
  42019. updateScrollY() {
  42020. const height = this.height.value;
  42021. if (height === null)
  42022. return false;
  42023. const scrollBarRef = this.table.refs.scrollBarRef;
  42024. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  42025. let scrollY = true;
  42026. const prevScrollY = this.scrollY.value;
  42027. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  42028. this.scrollY.value = scrollY;
  42029. return prevScrollY !== scrollY;
  42030. }
  42031. return false;
  42032. }
  42033. setHeight(value, prop = "height") {
  42034. if (!isClient)
  42035. return;
  42036. const el = this.table.vnode.el;
  42037. value = parseHeight(value);
  42038. this.height.value = Number(value);
  42039. if (!el && (value || value === 0))
  42040. return vue.nextTick(() => this.setHeight(value, prop));
  42041. if (typeof value === "number") {
  42042. el.style[prop] = `${value}px`;
  42043. this.updateElsHeight();
  42044. } else if (typeof value === "string") {
  42045. el.style[prop] = value;
  42046. this.updateElsHeight();
  42047. }
  42048. }
  42049. setMaxHeight(value) {
  42050. this.setHeight(value, "max-height");
  42051. }
  42052. getFlattenColumns() {
  42053. const flattenColumns = [];
  42054. const columns = this.table.store.states.columns.value;
  42055. columns.forEach((column) => {
  42056. if (column.isColumnGroup) {
  42057. flattenColumns.push.apply(flattenColumns, column.columns);
  42058. } else {
  42059. flattenColumns.push(column);
  42060. }
  42061. });
  42062. return flattenColumns;
  42063. }
  42064. updateElsHeight() {
  42065. this.updateScrollY();
  42066. this.notifyObservers("scrollable");
  42067. }
  42068. headerDisplayNone(elm) {
  42069. if (!elm)
  42070. return true;
  42071. let headerChild = elm;
  42072. while (headerChild.tagName !== "DIV") {
  42073. if (getComputedStyle(headerChild).display === "none") {
  42074. return true;
  42075. }
  42076. headerChild = headerChild.parentElement;
  42077. }
  42078. return false;
  42079. }
  42080. updateColumnsWidth() {
  42081. if (!isClient)
  42082. return;
  42083. const fit = this.fit;
  42084. const bodyWidth = this.table.vnode.el.clientWidth;
  42085. let bodyMinWidth = 0;
  42086. const flattenColumns = this.getFlattenColumns();
  42087. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  42088. flattenColumns.forEach((column) => {
  42089. if (typeof column.width === "number" && column.realWidth)
  42090. column.realWidth = null;
  42091. });
  42092. if (flexColumns.length > 0 && fit) {
  42093. flattenColumns.forEach((column) => {
  42094. bodyMinWidth += Number(column.width || column.minWidth || 80);
  42095. });
  42096. if (bodyMinWidth <= bodyWidth) {
  42097. this.scrollX.value = false;
  42098. const totalFlexWidth = bodyWidth - bodyMinWidth;
  42099. if (flexColumns.length === 1) {
  42100. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  42101. } else {
  42102. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  42103. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  42104. let noneFirstWidth = 0;
  42105. flexColumns.forEach((column, index) => {
  42106. if (index === 0)
  42107. return;
  42108. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  42109. noneFirstWidth += flexWidth;
  42110. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  42111. });
  42112. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  42113. }
  42114. } else {
  42115. this.scrollX.value = true;
  42116. flexColumns.forEach((column) => {
  42117. column.realWidth = Number(column.minWidth);
  42118. });
  42119. }
  42120. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  42121. this.table.state.resizeState.value.width = this.bodyWidth.value;
  42122. } else {
  42123. flattenColumns.forEach((column) => {
  42124. if (!column.width && !column.minWidth) {
  42125. column.realWidth = 80;
  42126. } else {
  42127. column.realWidth = Number(column.width || column.minWidth);
  42128. }
  42129. bodyMinWidth += column.realWidth;
  42130. });
  42131. this.scrollX.value = bodyMinWidth > bodyWidth;
  42132. this.bodyWidth.value = bodyMinWidth;
  42133. }
  42134. const fixedColumns = this.store.states.fixedColumns.value;
  42135. if (fixedColumns.length > 0) {
  42136. let fixedWidth = 0;
  42137. fixedColumns.forEach((column) => {
  42138. fixedWidth += Number(column.realWidth || column.width);
  42139. });
  42140. this.fixedWidth.value = fixedWidth;
  42141. }
  42142. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  42143. if (rightFixedColumns.length > 0) {
  42144. let rightFixedWidth = 0;
  42145. rightFixedColumns.forEach((column) => {
  42146. rightFixedWidth += Number(column.realWidth || column.width);
  42147. });
  42148. this.rightFixedWidth.value = rightFixedWidth;
  42149. }
  42150. this.notifyObservers("columns");
  42151. }
  42152. addObserver(observer) {
  42153. this.observers.push(observer);
  42154. }
  42155. removeObserver(observer) {
  42156. const index = this.observers.indexOf(observer);
  42157. if (index !== -1) {
  42158. this.observers.splice(index, 1);
  42159. }
  42160. }
  42161. notifyObservers(event) {
  42162. const observers = this.observers;
  42163. observers.forEach((observer) => {
  42164. var _a, _b;
  42165. switch (event) {
  42166. case "columns":
  42167. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  42168. break;
  42169. case "scrollable":
  42170. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  42171. break;
  42172. default:
  42173. throw new Error(`Table Layout don't have event ${event}.`);
  42174. }
  42175. });
  42176. }
  42177. }
  42178. var TableLayout$1 = TableLayout;
  42179. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  42180. const _sfc_main$r = vue.defineComponent({
  42181. name: "ElTableFilterPanel",
  42182. components: {
  42183. ElCheckbox,
  42184. ElCheckboxGroup,
  42185. ElScrollbar,
  42186. ElTooltip,
  42187. ElIcon,
  42188. ArrowDown: arrow_down_default,
  42189. ArrowUp: arrow_up_default
  42190. },
  42191. directives: { ClickOutside },
  42192. props: {
  42193. placement: {
  42194. type: String,
  42195. default: "bottom-start"
  42196. },
  42197. store: {
  42198. type: Object
  42199. },
  42200. column: {
  42201. type: Object
  42202. },
  42203. upDataColumn: {
  42204. type: Function
  42205. }
  42206. },
  42207. setup(props) {
  42208. const instance = vue.getCurrentInstance();
  42209. const { t } = useLocale();
  42210. const ns = useNamespace("table-filter");
  42211. const parent = instance == null ? void 0 : instance.parent;
  42212. if (!parent.filterPanels.value[props.column.id]) {
  42213. parent.filterPanels.value[props.column.id] = instance;
  42214. }
  42215. const tooltipVisible = vue.ref(false);
  42216. const tooltip = vue.ref(null);
  42217. const filters = vue.computed(() => {
  42218. return props.column && props.column.filters;
  42219. });
  42220. const filterValue = vue.computed({
  42221. get: () => {
  42222. var _a;
  42223. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  42224. },
  42225. set: (value) => {
  42226. if (filteredValue.value) {
  42227. if (typeof value !== "undefined" && value !== null) {
  42228. filteredValue.value.splice(0, 1, value);
  42229. } else {
  42230. filteredValue.value.splice(0, 1);
  42231. }
  42232. }
  42233. }
  42234. });
  42235. const filteredValue = vue.computed({
  42236. get() {
  42237. if (props.column) {
  42238. return props.column.filteredValue || [];
  42239. }
  42240. return [];
  42241. },
  42242. set(value) {
  42243. if (props.column) {
  42244. props.upDataColumn("filteredValue", value);
  42245. }
  42246. }
  42247. });
  42248. const multiple = vue.computed(() => {
  42249. if (props.column) {
  42250. return props.column.filterMultiple;
  42251. }
  42252. return true;
  42253. });
  42254. const isActive = (filter) => {
  42255. return filter.value === filterValue.value;
  42256. };
  42257. const hidden = () => {
  42258. tooltipVisible.value = false;
  42259. };
  42260. const showFilterPanel = (e) => {
  42261. e.stopPropagation();
  42262. tooltipVisible.value = !tooltipVisible.value;
  42263. };
  42264. const hideFilterPanel = () => {
  42265. tooltipVisible.value = false;
  42266. };
  42267. const handleConfirm = () => {
  42268. confirmFilter(filteredValue.value);
  42269. hidden();
  42270. };
  42271. const handleReset = () => {
  42272. filteredValue.value = [];
  42273. confirmFilter(filteredValue.value);
  42274. hidden();
  42275. };
  42276. const handleSelect = (_filterValue) => {
  42277. filterValue.value = _filterValue;
  42278. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  42279. confirmFilter(filteredValue.value);
  42280. } else {
  42281. confirmFilter([]);
  42282. }
  42283. hidden();
  42284. };
  42285. const confirmFilter = (filteredValue2) => {
  42286. props.store.commit("filterChange", {
  42287. column: props.column,
  42288. values: filteredValue2
  42289. });
  42290. props.store.updateAllSelected();
  42291. };
  42292. vue.watch(tooltipVisible, (value) => {
  42293. if (props.column) {
  42294. props.upDataColumn("filterOpened", value);
  42295. }
  42296. }, {
  42297. immediate: true
  42298. });
  42299. const popperPaneRef = vue.computed(() => {
  42300. var _a, _b;
  42301. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  42302. });
  42303. return {
  42304. tooltipVisible,
  42305. multiple,
  42306. filteredValue,
  42307. filterValue,
  42308. filters,
  42309. handleConfirm,
  42310. handleReset,
  42311. handleSelect,
  42312. isActive,
  42313. t,
  42314. ns,
  42315. showFilterPanel,
  42316. hideFilterPanel,
  42317. popperPaneRef,
  42318. tooltip
  42319. };
  42320. }
  42321. });
  42322. const _hoisted_1$c = { key: 0 };
  42323. const _hoisted_2$8 = ["disabled"];
  42324. const _hoisted_3$3 = ["label", "onClick"];
  42325. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  42326. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  42327. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  42328. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  42329. const _component_arrow_up = vue.resolveComponent("arrow-up");
  42330. const _component_arrow_down = vue.resolveComponent("arrow-down");
  42331. const _component_el_icon = vue.resolveComponent("el-icon");
  42332. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  42333. const _directive_click_outside = vue.resolveDirective("click-outside");
  42334. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  42335. ref: "tooltip",
  42336. visible: _ctx.tooltipVisible,
  42337. offset: 0,
  42338. placement: _ctx.placement,
  42339. "show-arrow": false,
  42340. "stop-popper-mouse-event": false,
  42341. teleported: "",
  42342. effect: "light",
  42343. pure: "",
  42344. "popper-class": _ctx.ns.b(),
  42345. persistent: ""
  42346. }, {
  42347. content: vue.withCtx(() => [
  42348. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
  42349. vue.createElementVNode("div", {
  42350. class: vue.normalizeClass(_ctx.ns.e("content"))
  42351. }, [
  42352. vue.createVNode(_component_el_scrollbar, {
  42353. "wrap-class": _ctx.ns.e("wrap")
  42354. }, {
  42355. default: vue.withCtx(() => [
  42356. vue.createVNode(_component_el_checkbox_group, {
  42357. modelValue: _ctx.filteredValue,
  42358. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  42359. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  42360. }, {
  42361. default: vue.withCtx(() => [
  42362. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  42363. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  42364. key: filter.value,
  42365. label: filter.value
  42366. }, {
  42367. default: vue.withCtx(() => [
  42368. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  42369. ]),
  42370. _: 2
  42371. }, 1032, ["label"]);
  42372. }), 128))
  42373. ]),
  42374. _: 1
  42375. }, 8, ["modelValue", "class"])
  42376. ]),
  42377. _: 1
  42378. }, 8, ["wrap-class"])
  42379. ], 2),
  42380. vue.createElementVNode("div", {
  42381. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  42382. }, [
  42383. vue.createElementVNode("button", {
  42384. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  42385. disabled: _ctx.filteredValue.length === 0,
  42386. type: "button",
  42387. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  42388. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$8),
  42389. vue.createElementVNode("button", {
  42390. type: "button",
  42391. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  42392. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  42393. ], 2)
  42394. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  42395. key: 1,
  42396. class: vue.normalizeClass(_ctx.ns.e("list"))
  42397. }, [
  42398. vue.createElementVNode("li", {
  42399. class: vue.normalizeClass([
  42400. _ctx.ns.e("list-item"),
  42401. {
  42402. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  42403. }
  42404. ]),
  42405. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  42406. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  42407. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  42408. return vue.openBlock(), vue.createElementBlock("li", {
  42409. key: filter.value,
  42410. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  42411. label: filter.value,
  42412. onClick: ($event) => _ctx.handleSelect(filter.value)
  42413. }, vue.toDisplayString(filter.text), 11, _hoisted_3$3);
  42414. }), 128))
  42415. ], 2))
  42416. ]),
  42417. default: vue.withCtx(() => [
  42418. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  42419. class: vue.normalizeClass([
  42420. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  42421. `${_ctx.ns.namespace.value}-none-outline`
  42422. ]),
  42423. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  42424. }, [
  42425. vue.createVNode(_component_el_icon, null, {
  42426. default: vue.withCtx(() => [
  42427. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  42428. ]),
  42429. _: 1
  42430. })
  42431. ], 2)), [
  42432. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  42433. ])
  42434. ]),
  42435. _: 1
  42436. }, 8, ["visible", "placement", "popper-class"]);
  42437. }
  42438. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  42439. function useLayoutObserver(root) {
  42440. const instance = vue.getCurrentInstance();
  42441. vue.onBeforeMount(() => {
  42442. tableLayout.value.addObserver(instance);
  42443. });
  42444. vue.onMounted(() => {
  42445. onColumnsChange(tableLayout.value);
  42446. onScrollableChange(tableLayout.value);
  42447. });
  42448. vue.onUpdated(() => {
  42449. onColumnsChange(tableLayout.value);
  42450. onScrollableChange(tableLayout.value);
  42451. });
  42452. vue.onUnmounted(() => {
  42453. tableLayout.value.removeObserver(instance);
  42454. });
  42455. const tableLayout = vue.computed(() => {
  42456. const layout = root.layout;
  42457. if (!layout) {
  42458. throw new Error("Can not find table layout.");
  42459. }
  42460. return layout;
  42461. });
  42462. const onColumnsChange = (layout) => {
  42463. var _a;
  42464. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  42465. if (!cols.length)
  42466. return;
  42467. const flattenColumns = layout.getFlattenColumns();
  42468. const columnsMap = {};
  42469. flattenColumns.forEach((column) => {
  42470. columnsMap[column.id] = column;
  42471. });
  42472. for (let i = 0, j = cols.length; i < j; i++) {
  42473. const col = cols[i];
  42474. const name = col.getAttribute("name");
  42475. const column = columnsMap[name];
  42476. if (column) {
  42477. col.setAttribute("width", column.realWidth || column.width);
  42478. }
  42479. }
  42480. };
  42481. const onScrollableChange = (layout) => {
  42482. var _a, _b;
  42483. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  42484. for (let i = 0, j = cols.length; i < j; i++) {
  42485. const col = cols[i];
  42486. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  42487. }
  42488. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  42489. for (let i = 0, j = ths.length; i < j; i++) {
  42490. const th = ths[i];
  42491. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  42492. th.style.display = layout.scrollY.value ? "" : "none";
  42493. }
  42494. };
  42495. return {
  42496. tableLayout: tableLayout.value,
  42497. onColumnsChange,
  42498. onScrollableChange
  42499. };
  42500. }
  42501. const TABLE_INJECTION_KEY = Symbol("ElTable");
  42502. function useEvent(props, emit) {
  42503. const instance = vue.getCurrentInstance();
  42504. const parent = vue.inject(TABLE_INJECTION_KEY);
  42505. const handleFilterClick = (event) => {
  42506. event.stopPropagation();
  42507. return;
  42508. };
  42509. const handleHeaderClick = (event, column) => {
  42510. if (!column.filters && column.sortable) {
  42511. handleSortClick(event, column, false);
  42512. } else if (column.filterable && !column.sortable) {
  42513. handleFilterClick(event);
  42514. }
  42515. parent == null ? void 0 : parent.emit("header-click", column, event);
  42516. };
  42517. const handleHeaderContextMenu = (event, column) => {
  42518. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  42519. };
  42520. const draggingColumn = vue.ref(null);
  42521. const dragging = vue.ref(false);
  42522. const dragState = vue.ref({});
  42523. const handleMouseDown = (event, column) => {
  42524. if (!isClient)
  42525. return;
  42526. if (column.children && column.children.length > 0)
  42527. return;
  42528. if (draggingColumn.value && props.border) {
  42529. dragging.value = true;
  42530. const table = parent;
  42531. emit("set-drag-visible", true);
  42532. const tableEl = table == null ? void 0 : table.vnode.el;
  42533. const tableLeft = tableEl.getBoundingClientRect().left;
  42534. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  42535. const columnRect = columnEl.getBoundingClientRect();
  42536. const minLeft = columnRect.left - tableLeft + 30;
  42537. addClass(columnEl, "noclick");
  42538. dragState.value = {
  42539. startMouseLeft: event.clientX,
  42540. startLeft: columnRect.right - tableLeft,
  42541. startColumnLeft: columnRect.left - tableLeft,
  42542. tableLeft
  42543. };
  42544. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  42545. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  42546. document.onselectstart = function() {
  42547. return false;
  42548. };
  42549. document.ondragstart = function() {
  42550. return false;
  42551. };
  42552. const handleMouseMove2 = (event2) => {
  42553. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  42554. const proxyLeft = dragState.value.startLeft + deltaLeft;
  42555. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  42556. };
  42557. const handleMouseUp = () => {
  42558. if (dragging.value) {
  42559. const { startColumnLeft, startLeft } = dragState.value;
  42560. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  42561. const columnWidth = finalLeft - startColumnLeft;
  42562. column.width = column.realWidth = columnWidth;
  42563. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  42564. requestAnimationFrame(() => {
  42565. props.store.scheduleLayout(false, true);
  42566. });
  42567. document.body.style.cursor = "";
  42568. dragging.value = false;
  42569. draggingColumn.value = null;
  42570. dragState.value = {};
  42571. emit("set-drag-visible", false);
  42572. }
  42573. document.removeEventListener("mousemove", handleMouseMove2);
  42574. document.removeEventListener("mouseup", handleMouseUp);
  42575. document.onselectstart = null;
  42576. document.ondragstart = null;
  42577. setTimeout(() => {
  42578. removeClass(columnEl, "noclick");
  42579. }, 0);
  42580. };
  42581. document.addEventListener("mousemove", handleMouseMove2);
  42582. document.addEventListener("mouseup", handleMouseUp);
  42583. }
  42584. };
  42585. const handleMouseMove = (event, column) => {
  42586. var _a;
  42587. if (column.children && column.children.length > 0)
  42588. return;
  42589. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  42590. if (!column || !column.resizable)
  42591. return;
  42592. if (!dragging.value && props.border) {
  42593. const rect = target.getBoundingClientRect();
  42594. const bodyStyle = document.body.style;
  42595. if (rect.width > 12 && rect.right - event.pageX < 8) {
  42596. bodyStyle.cursor = "col-resize";
  42597. if (hasClass(target, "is-sortable")) {
  42598. target.style.cursor = "col-resize";
  42599. }
  42600. draggingColumn.value = column;
  42601. } else if (!dragging.value) {
  42602. bodyStyle.cursor = "";
  42603. if (hasClass(target, "is-sortable")) {
  42604. target.style.cursor = "pointer";
  42605. }
  42606. draggingColumn.value = null;
  42607. }
  42608. }
  42609. };
  42610. const handleMouseOut = () => {
  42611. if (!isClient)
  42612. return;
  42613. document.body.style.cursor = "";
  42614. };
  42615. const toggleOrder = ({ order, sortOrders }) => {
  42616. if (order === "")
  42617. return sortOrders[0];
  42618. const index = sortOrders.indexOf(order || null);
  42619. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  42620. };
  42621. const handleSortClick = (event, column, givenOrder) => {
  42622. var _a;
  42623. event.stopPropagation();
  42624. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  42625. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  42626. if (target) {
  42627. if (hasClass(target, "noclick")) {
  42628. removeClass(target, "noclick");
  42629. return;
  42630. }
  42631. }
  42632. if (!column.sortable)
  42633. return;
  42634. const states = props.store.states;
  42635. let sortProp = states.sortProp.value;
  42636. let sortOrder;
  42637. const sortingColumn = states.sortingColumn.value;
  42638. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  42639. if (sortingColumn) {
  42640. sortingColumn.order = null;
  42641. }
  42642. states.sortingColumn.value = column;
  42643. sortProp = column.property;
  42644. }
  42645. if (!order) {
  42646. sortOrder = column.order = null;
  42647. } else {
  42648. sortOrder = column.order = order;
  42649. }
  42650. states.sortProp.value = sortProp;
  42651. states.sortOrder.value = sortOrder;
  42652. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  42653. };
  42654. return {
  42655. handleHeaderClick,
  42656. handleHeaderContextMenu,
  42657. handleMouseDown,
  42658. handleMouseMove,
  42659. handleMouseOut,
  42660. handleSortClick,
  42661. handleFilterClick
  42662. };
  42663. }
  42664. function useStyle$2(props) {
  42665. const parent = vue.inject(TABLE_INJECTION_KEY);
  42666. const ns = useNamespace("table");
  42667. const getHeaderRowStyle = (rowIndex) => {
  42668. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  42669. if (typeof headerRowStyle === "function") {
  42670. return headerRowStyle.call(null, { rowIndex });
  42671. }
  42672. return headerRowStyle;
  42673. };
  42674. const getHeaderRowClass = (rowIndex) => {
  42675. const classes = [];
  42676. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  42677. if (typeof headerRowClassName === "string") {
  42678. classes.push(headerRowClassName);
  42679. } else if (typeof headerRowClassName === "function") {
  42680. classes.push(headerRowClassName.call(null, { rowIndex }));
  42681. }
  42682. return classes.join(" ");
  42683. };
  42684. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  42685. var _a;
  42686. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  42687. if (typeof headerCellStyles === "function") {
  42688. headerCellStyles = headerCellStyles.call(null, {
  42689. rowIndex,
  42690. columnIndex,
  42691. row,
  42692. column
  42693. });
  42694. }
  42695. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  42696. ensurePosition(fixedStyle, "left");
  42697. ensurePosition(fixedStyle, "right");
  42698. return Object.assign({}, headerCellStyles, fixedStyle);
  42699. };
  42700. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  42701. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  42702. const classes = [
  42703. column.id,
  42704. column.order,
  42705. column.headerAlign,
  42706. column.className,
  42707. column.labelClassName,
  42708. ...fixedClasses
  42709. ];
  42710. if (!column.children) {
  42711. classes.push("is-leaf");
  42712. }
  42713. if (column.sortable) {
  42714. classes.push("is-sortable");
  42715. }
  42716. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  42717. if (typeof headerCellClassName === "string") {
  42718. classes.push(headerCellClassName);
  42719. } else if (typeof headerCellClassName === "function") {
  42720. classes.push(headerCellClassName.call(null, {
  42721. rowIndex,
  42722. columnIndex,
  42723. row,
  42724. column
  42725. }));
  42726. }
  42727. classes.push(ns.e("cell"));
  42728. return classes.filter((className) => Boolean(className)).join(" ");
  42729. };
  42730. return {
  42731. getHeaderRowStyle,
  42732. getHeaderRowClass,
  42733. getHeaderCellStyle,
  42734. getHeaderCellClass
  42735. };
  42736. }
  42737. const getAllColumns = (columns) => {
  42738. const result = [];
  42739. columns.forEach((column) => {
  42740. if (column.children) {
  42741. result.push(column);
  42742. result.push.apply(result, getAllColumns(column.children));
  42743. } else {
  42744. result.push(column);
  42745. }
  42746. });
  42747. return result;
  42748. };
  42749. const convertToRows = (originColumns) => {
  42750. let maxLevel = 1;
  42751. const traverse = (column, parent) => {
  42752. if (parent) {
  42753. column.level = parent.level + 1;
  42754. if (maxLevel < column.level) {
  42755. maxLevel = column.level;
  42756. }
  42757. }
  42758. if (column.children) {
  42759. let colSpan = 0;
  42760. column.children.forEach((subColumn) => {
  42761. traverse(subColumn, column);
  42762. colSpan += subColumn.colSpan;
  42763. });
  42764. column.colSpan = colSpan;
  42765. } else {
  42766. column.colSpan = 1;
  42767. }
  42768. };
  42769. originColumns.forEach((column) => {
  42770. column.level = 1;
  42771. traverse(column, void 0);
  42772. });
  42773. const rows = [];
  42774. for (let i = 0; i < maxLevel; i++) {
  42775. rows.push([]);
  42776. }
  42777. const allColumns = getAllColumns(originColumns);
  42778. allColumns.forEach((column) => {
  42779. if (!column.children) {
  42780. column.rowSpan = maxLevel - column.level + 1;
  42781. } else {
  42782. column.rowSpan = 1;
  42783. column.children.forEach((col) => col.isSubColumn = true);
  42784. }
  42785. rows[column.level - 1].push(column);
  42786. });
  42787. return rows;
  42788. };
  42789. function useUtils$1(props) {
  42790. const parent = vue.inject(TABLE_INJECTION_KEY);
  42791. const columnRows = vue.computed(() => {
  42792. return convertToRows(props.store.states.originColumns.value);
  42793. });
  42794. const isGroup = vue.computed(() => {
  42795. const result = columnRows.value.length > 1;
  42796. if (result && parent) {
  42797. parent.state.isGroup.value = true;
  42798. }
  42799. return result;
  42800. });
  42801. const toggleAllSelection = (event) => {
  42802. event.stopPropagation();
  42803. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  42804. };
  42805. return {
  42806. isGroup,
  42807. toggleAllSelection,
  42808. columnRows
  42809. };
  42810. }
  42811. var TableHeader = vue.defineComponent({
  42812. name: "ElTableHeader",
  42813. components: {
  42814. ElCheckbox
  42815. },
  42816. props: {
  42817. fixed: {
  42818. type: String,
  42819. default: ""
  42820. },
  42821. store: {
  42822. required: true,
  42823. type: Object
  42824. },
  42825. border: Boolean,
  42826. defaultSort: {
  42827. type: Object,
  42828. default: () => {
  42829. return {
  42830. prop: "",
  42831. order: ""
  42832. };
  42833. }
  42834. }
  42835. },
  42836. setup(props, { emit }) {
  42837. const instance = vue.getCurrentInstance();
  42838. const parent = vue.inject(TABLE_INJECTION_KEY);
  42839. const ns = useNamespace("table");
  42840. const filterPanels = vue.ref({});
  42841. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  42842. vue.onMounted(async () => {
  42843. await vue.nextTick();
  42844. await vue.nextTick();
  42845. const { prop, order } = props.defaultSort;
  42846. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  42847. });
  42848. const {
  42849. handleHeaderClick,
  42850. handleHeaderContextMenu,
  42851. handleMouseDown,
  42852. handleMouseMove,
  42853. handleMouseOut,
  42854. handleSortClick,
  42855. handleFilterClick
  42856. } = useEvent(props, emit);
  42857. const {
  42858. getHeaderRowStyle,
  42859. getHeaderRowClass,
  42860. getHeaderCellStyle,
  42861. getHeaderCellClass
  42862. } = useStyle$2(props);
  42863. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  42864. instance.state = {
  42865. onColumnsChange,
  42866. onScrollableChange
  42867. };
  42868. instance.filterPanels = filterPanels;
  42869. return {
  42870. ns,
  42871. filterPanels,
  42872. onColumnsChange,
  42873. onScrollableChange,
  42874. columnRows,
  42875. getHeaderRowClass,
  42876. getHeaderRowStyle,
  42877. getHeaderCellClass,
  42878. getHeaderCellStyle,
  42879. handleHeaderClick,
  42880. handleHeaderContextMenu,
  42881. handleMouseDown,
  42882. handleMouseMove,
  42883. handleMouseOut,
  42884. handleSortClick,
  42885. handleFilterClick,
  42886. isGroup,
  42887. toggleAllSelection
  42888. };
  42889. },
  42890. render() {
  42891. const {
  42892. ns,
  42893. isGroup,
  42894. columnRows,
  42895. getHeaderCellStyle,
  42896. getHeaderCellClass,
  42897. getHeaderRowClass,
  42898. getHeaderRowStyle,
  42899. handleHeaderClick,
  42900. handleHeaderContextMenu,
  42901. handleMouseDown,
  42902. handleMouseMove,
  42903. handleSortClick,
  42904. handleMouseOut,
  42905. store,
  42906. $parent
  42907. } = this;
  42908. let rowSpan = 1;
  42909. return vue.h("thead", {
  42910. class: { [ns.is("group")]: isGroup }
  42911. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  42912. class: getHeaderRowClass(rowIndex),
  42913. key: rowIndex,
  42914. style: getHeaderRowStyle(rowIndex)
  42915. }, subColumns.map((column, cellIndex) => {
  42916. if (column.rowSpan > rowSpan) {
  42917. rowSpan = column.rowSpan;
  42918. }
  42919. return vue.h("th", {
  42920. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  42921. colspan: column.colSpan,
  42922. key: `${column.id}-thead`,
  42923. rowspan: column.rowSpan,
  42924. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  42925. onClick: ($event) => handleHeaderClick($event, column),
  42926. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  42927. onMousedown: ($event) => handleMouseDown($event, column),
  42928. onMousemove: ($event) => handleMouseMove($event, column),
  42929. onMouseout: handleMouseOut
  42930. }, [
  42931. vue.h("div", {
  42932. class: [
  42933. "cell",
  42934. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  42935. ]
  42936. }, [
  42937. column.renderHeader ? column.renderHeader({
  42938. column,
  42939. $index: cellIndex,
  42940. store,
  42941. _self: $parent
  42942. }) : column.label,
  42943. column.sortable && vue.h("span", {
  42944. onClick: ($event) => handleSortClick($event, column),
  42945. class: "caret-wrapper"
  42946. }, [
  42947. vue.h("i", {
  42948. onClick: ($event) => handleSortClick($event, column, "ascending"),
  42949. class: "sort-caret ascending"
  42950. }),
  42951. vue.h("i", {
  42952. onClick: ($event) => handleSortClick($event, column, "descending"),
  42953. class: "sort-caret descending"
  42954. })
  42955. ]),
  42956. column.filterable && vue.h(FilterPanel, {
  42957. store,
  42958. placement: column.filterPlacement || "bottom-start",
  42959. column,
  42960. upDataColumn: (key, value) => {
  42961. column[key] = value;
  42962. }
  42963. })
  42964. ])
  42965. ]);
  42966. }))));
  42967. }
  42968. });
  42969. function useEvents(props) {
  42970. const parent = vue.inject(TABLE_INJECTION_KEY);
  42971. const tooltipContent = vue.ref("");
  42972. const tooltipTrigger = vue.ref(vue.h("div"));
  42973. const { nextZIndex } = useZIndex();
  42974. const handleEvent = (event, row, name) => {
  42975. var _a;
  42976. const table = parent;
  42977. const cell = getCell(event);
  42978. let column;
  42979. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  42980. if (cell) {
  42981. column = getColumnByCell({
  42982. columns: props.store.states.columns.value
  42983. }, cell, namespace);
  42984. if (column) {
  42985. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  42986. }
  42987. }
  42988. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  42989. };
  42990. const handleDoubleClick = (event, row) => {
  42991. handleEvent(event, row, "dblclick");
  42992. };
  42993. const handleClick = (event, row) => {
  42994. props.store.commit("setCurrentRow", row);
  42995. handleEvent(event, row, "click");
  42996. };
  42997. const handleContextMenu = (event, row) => {
  42998. handleEvent(event, row, "contextmenu");
  42999. };
  43000. const handleMouseEnter = debounce((index) => {
  43001. props.store.commit("setHoverRow", index);
  43002. }, 30);
  43003. const handleMouseLeave = debounce(() => {
  43004. props.store.commit("setHoverRow", null);
  43005. }, 30);
  43006. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  43007. var _a;
  43008. const table = parent;
  43009. const cell = getCell(event);
  43010. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  43011. if (cell) {
  43012. const column = getColumnByCell({
  43013. columns: props.store.states.columns.value
  43014. }, cell, namespace);
  43015. const hoverState = table.hoverState = { cell, column, row };
  43016. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  43017. }
  43018. if (!tooltipOptions) {
  43019. return;
  43020. }
  43021. const cellChild = event.target.querySelector(".cell");
  43022. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  43023. return;
  43024. }
  43025. const range = document.createRange();
  43026. range.setStart(cellChild, 0);
  43027. range.setEnd(cellChild, cellChild.childNodes.length);
  43028. const rangeWidth = Math.round(range.getBoundingClientRect().width);
  43029. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  43030. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  43031. createTablePopper(parent == null ? void 0 : parent.refs.tableWrapper, cell, cell.innerText || cell.textContent, nextZIndex, tooltipOptions);
  43032. }
  43033. };
  43034. const handleCellMouseLeave = (event) => {
  43035. const cell = getCell(event);
  43036. if (!cell)
  43037. return;
  43038. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  43039. 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);
  43040. };
  43041. return {
  43042. handleDoubleClick,
  43043. handleClick,
  43044. handleContextMenu,
  43045. handleMouseEnter,
  43046. handleMouseLeave,
  43047. handleCellMouseEnter,
  43048. handleCellMouseLeave,
  43049. tooltipContent,
  43050. tooltipTrigger
  43051. };
  43052. }
  43053. function useStyles$1(props) {
  43054. const parent = vue.inject(TABLE_INJECTION_KEY);
  43055. const ns = useNamespace("table");
  43056. const getRowStyle = (row, rowIndex) => {
  43057. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  43058. if (typeof rowStyle === "function") {
  43059. return rowStyle.call(null, {
  43060. row,
  43061. rowIndex
  43062. });
  43063. }
  43064. return rowStyle || null;
  43065. };
  43066. const getRowClass = (row, rowIndex) => {
  43067. const classes = [ns.e("row")];
  43068. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  43069. classes.push("current-row");
  43070. }
  43071. if (props.stripe && rowIndex % 2 === 1) {
  43072. classes.push(ns.em("row", "striped"));
  43073. }
  43074. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  43075. if (typeof rowClassName === "string") {
  43076. classes.push(rowClassName);
  43077. } else if (typeof rowClassName === "function") {
  43078. classes.push(rowClassName.call(null, {
  43079. row,
  43080. rowIndex
  43081. }));
  43082. }
  43083. return classes;
  43084. };
  43085. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  43086. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  43087. let cellStyles = cellStyle != null ? cellStyle : {};
  43088. if (typeof cellStyle === "function") {
  43089. cellStyles = cellStyle.call(null, {
  43090. rowIndex,
  43091. columnIndex,
  43092. row,
  43093. column
  43094. });
  43095. }
  43096. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  43097. ensurePosition(fixedStyle, "left");
  43098. ensurePosition(fixedStyle, "right");
  43099. return Object.assign({}, cellStyles, fixedStyle);
  43100. };
  43101. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  43102. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  43103. const classes = [column.id, column.align, column.className, ...fixedClasses];
  43104. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  43105. if (typeof cellClassName === "string") {
  43106. classes.push(cellClassName);
  43107. } else if (typeof cellClassName === "function") {
  43108. classes.push(cellClassName.call(null, {
  43109. rowIndex,
  43110. columnIndex,
  43111. row,
  43112. column
  43113. }));
  43114. }
  43115. classes.push(ns.e("cell"));
  43116. return classes.filter((className) => Boolean(className)).join(" ");
  43117. };
  43118. const getSpan = (row, column, rowIndex, columnIndex) => {
  43119. let rowspan = 1;
  43120. let colspan = 1;
  43121. const fn = parent == null ? void 0 : parent.props.spanMethod;
  43122. if (typeof fn === "function") {
  43123. const result = fn({
  43124. row,
  43125. column,
  43126. rowIndex,
  43127. columnIndex
  43128. });
  43129. if (Array.isArray(result)) {
  43130. rowspan = result[0];
  43131. colspan = result[1];
  43132. } else if (typeof result === "object") {
  43133. rowspan = result.rowspan;
  43134. colspan = result.colspan;
  43135. }
  43136. }
  43137. return { rowspan, colspan };
  43138. };
  43139. const getColspanRealWidth = (columns, colspan, index) => {
  43140. if (colspan < 1) {
  43141. return columns[index].realWidth;
  43142. }
  43143. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  43144. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  43145. };
  43146. return {
  43147. getRowStyle,
  43148. getRowClass,
  43149. getCellStyle,
  43150. getCellClass,
  43151. getSpan,
  43152. getColspanRealWidth
  43153. };
  43154. }
  43155. function useRender$1(props) {
  43156. const parent = vue.inject(TABLE_INJECTION_KEY);
  43157. const ns = useNamespace("table");
  43158. const {
  43159. handleDoubleClick,
  43160. handleClick,
  43161. handleContextMenu,
  43162. handleMouseEnter,
  43163. handleMouseLeave,
  43164. handleCellMouseEnter,
  43165. handleCellMouseLeave,
  43166. tooltipContent,
  43167. tooltipTrigger
  43168. } = useEvents(props);
  43169. const {
  43170. getRowStyle,
  43171. getRowClass,
  43172. getCellStyle,
  43173. getCellClass,
  43174. getSpan,
  43175. getColspanRealWidth
  43176. } = useStyles$1(props);
  43177. const firstDefaultColumnIndex = vue.computed(() => {
  43178. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  43179. });
  43180. const getKeyOfRow = (row, index) => {
  43181. const rowKey = parent.props.rowKey;
  43182. if (rowKey) {
  43183. return getRowIdentity(row, rowKey);
  43184. }
  43185. return index;
  43186. };
  43187. const rowRender = (row, $index, treeRowData, expanded = false) => {
  43188. const { tooltipEffect, tooltipOptions, store } = props;
  43189. const { indent, columns } = store.states;
  43190. const rowClasses = getRowClass(row, $index);
  43191. let display = true;
  43192. if (treeRowData) {
  43193. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  43194. display = treeRowData.display;
  43195. }
  43196. const displayStyle = display ? null : {
  43197. display: "none"
  43198. };
  43199. return vue.h("tr", {
  43200. style: [displayStyle, getRowStyle(row, $index)],
  43201. class: rowClasses,
  43202. key: getKeyOfRow(row, $index),
  43203. onDblclick: ($event) => handleDoubleClick($event, row),
  43204. onClick: ($event) => handleClick($event, row),
  43205. onContextmenu: ($event) => handleContextMenu($event, row),
  43206. onMouseenter: () => handleMouseEnter($index),
  43207. onMouseleave: handleMouseLeave
  43208. }, columns.value.map((column, cellIndex) => {
  43209. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  43210. if (!rowspan || !colspan) {
  43211. return null;
  43212. }
  43213. const columnData = { ...column };
  43214. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  43215. const data = {
  43216. store: props.store,
  43217. _self: props.context || parent,
  43218. column: columnData,
  43219. row,
  43220. $index,
  43221. cellIndex,
  43222. expanded
  43223. };
  43224. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  43225. data.treeNode = {
  43226. indent: treeRowData.level * indent.value,
  43227. level: treeRowData.level
  43228. };
  43229. if (typeof treeRowData.expanded === "boolean") {
  43230. data.treeNode.expanded = treeRowData.expanded;
  43231. if ("loading" in treeRowData) {
  43232. data.treeNode.loading = treeRowData.loading;
  43233. }
  43234. if ("noLazyChildren" in treeRowData) {
  43235. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  43236. }
  43237. }
  43238. }
  43239. const baseKey = `${$index},${cellIndex}`;
  43240. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  43241. const tdChildren = cellChildren(cellIndex, column, data);
  43242. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  43243. effect: tooltipEffect
  43244. }, tooltipOptions, column.showOverflowTooltip);
  43245. return vue.h("td", {
  43246. style: getCellStyle($index, cellIndex, row, column),
  43247. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  43248. key: `${patchKey}${baseKey}`,
  43249. rowspan,
  43250. colspan,
  43251. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  43252. onMouseleave: handleCellMouseLeave
  43253. }, [tdChildren]);
  43254. }));
  43255. };
  43256. const cellChildren = (cellIndex, column, data) => {
  43257. return column.renderCell(data);
  43258. };
  43259. const wrappedRowRender = (row, $index) => {
  43260. const store = props.store;
  43261. const { isRowExpanded, assertRowKey } = store;
  43262. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  43263. const columns = store.states.columns.value;
  43264. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  43265. if (hasExpandColumn) {
  43266. const expanded = isRowExpanded(row);
  43267. const tr = rowRender(row, $index, void 0, expanded);
  43268. const renderExpanded = parent.renderExpanded;
  43269. if (expanded) {
  43270. if (!renderExpanded) {
  43271. console.error("[Element Error]renderExpanded is required.");
  43272. return tr;
  43273. }
  43274. return [
  43275. [
  43276. tr,
  43277. vue.h("tr", {
  43278. key: `expanded-row__${tr.key}`
  43279. }, [
  43280. vue.h("td", {
  43281. colspan: columns.length,
  43282. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  43283. }, [renderExpanded({ row, $index, store, expanded })])
  43284. ])
  43285. ]
  43286. ];
  43287. } else {
  43288. return [[tr]];
  43289. }
  43290. } else if (Object.keys(treeData.value).length) {
  43291. assertRowKey();
  43292. const key = getRowIdentity(row, rowKey.value);
  43293. let cur = treeData.value[key];
  43294. let treeRowData = null;
  43295. if (cur) {
  43296. treeRowData = {
  43297. expanded: cur.expanded,
  43298. level: cur.level,
  43299. display: true
  43300. };
  43301. if (typeof cur.lazy === "boolean") {
  43302. if (typeof cur.loaded === "boolean" && cur.loaded) {
  43303. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  43304. }
  43305. treeRowData.loading = cur.loading;
  43306. }
  43307. }
  43308. const tmp = [rowRender(row, $index, treeRowData)];
  43309. if (cur) {
  43310. let i = 0;
  43311. const traverse = (children, parent2) => {
  43312. if (!(children && children.length && parent2))
  43313. return;
  43314. children.forEach((node) => {
  43315. const innerTreeRowData = {
  43316. display: parent2.display && parent2.expanded,
  43317. level: parent2.level + 1,
  43318. expanded: false,
  43319. noLazyChildren: false,
  43320. loading: false
  43321. };
  43322. const childKey = getRowIdentity(node, rowKey.value);
  43323. if (childKey === void 0 || childKey === null) {
  43324. throw new Error("For nested data item, row-key is required.");
  43325. }
  43326. cur = { ...treeData.value[childKey] };
  43327. if (cur) {
  43328. innerTreeRowData.expanded = cur.expanded;
  43329. cur.level = cur.level || innerTreeRowData.level;
  43330. cur.display = !!(cur.expanded && innerTreeRowData.display);
  43331. if (typeof cur.lazy === "boolean") {
  43332. if (typeof cur.loaded === "boolean" && cur.loaded) {
  43333. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  43334. }
  43335. innerTreeRowData.loading = cur.loading;
  43336. }
  43337. }
  43338. i++;
  43339. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  43340. if (cur) {
  43341. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  43342. traverse(nodes2, cur);
  43343. }
  43344. });
  43345. };
  43346. cur.display = true;
  43347. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  43348. traverse(nodes, cur);
  43349. }
  43350. return tmp;
  43351. } else {
  43352. return rowRender(row, $index, void 0);
  43353. }
  43354. };
  43355. return {
  43356. wrappedRowRender,
  43357. tooltipContent,
  43358. tooltipTrigger
  43359. };
  43360. }
  43361. const defaultProps$2 = {
  43362. store: {
  43363. required: true,
  43364. type: Object
  43365. },
  43366. stripe: Boolean,
  43367. tooltipEffect: String,
  43368. tooltipOptions: {
  43369. type: Object
  43370. },
  43371. context: {
  43372. default: () => ({}),
  43373. type: Object
  43374. },
  43375. rowClassName: [String, Function],
  43376. rowStyle: [Object, Function],
  43377. fixed: {
  43378. type: String,
  43379. default: ""
  43380. },
  43381. highlight: Boolean
  43382. };
  43383. var defaultProps$3 = defaultProps$2;
  43384. var TableBody = vue.defineComponent({
  43385. name: "ElTableBody",
  43386. props: defaultProps$3,
  43387. setup(props) {
  43388. const instance = vue.getCurrentInstance();
  43389. const parent = vue.inject(TABLE_INJECTION_KEY);
  43390. const ns = useNamespace("table");
  43391. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  43392. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  43393. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  43394. if (!props.store.states.isComplex.value || !isClient)
  43395. return;
  43396. let raf = window.requestAnimationFrame;
  43397. if (!raf) {
  43398. raf = (fn) => window.setTimeout(fn, 16);
  43399. }
  43400. raf(() => {
  43401. const el = instance == null ? void 0 : instance.vnode.el;
  43402. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  43403. const oldRow = rows[oldVal];
  43404. const newRow = rows[newVal];
  43405. if (oldRow) {
  43406. removeClass(oldRow, "hover-row");
  43407. }
  43408. if (newRow) {
  43409. addClass(newRow, "hover-row");
  43410. }
  43411. });
  43412. });
  43413. vue.onUnmounted(() => {
  43414. var _a;
  43415. (_a = removePopper) == null ? void 0 : _a();
  43416. });
  43417. return {
  43418. ns,
  43419. onColumnsChange,
  43420. onScrollableChange,
  43421. wrappedRowRender,
  43422. tooltipContent,
  43423. tooltipTrigger
  43424. };
  43425. },
  43426. render() {
  43427. const { wrappedRowRender, store } = this;
  43428. const data = store.states.data.value || [];
  43429. return vue.h("tbody", {}, [
  43430. data.reduce((acc, row) => {
  43431. return acc.concat(wrappedRowRender(row, acc.length));
  43432. }, [])
  43433. ]);
  43434. }
  43435. });
  43436. function hColgroup(props) {
  43437. const isAuto = props.tableLayout === "auto";
  43438. let columns = props.columns || [];
  43439. if (isAuto) {
  43440. if (columns.every((column) => column.width === void 0)) {
  43441. columns = [];
  43442. }
  43443. }
  43444. const getPropsData = (column) => {
  43445. const propsData = {
  43446. key: `${props.tableLayout}_${column.id}`,
  43447. style: {},
  43448. name: void 0
  43449. };
  43450. if (isAuto) {
  43451. propsData.style = {
  43452. width: `${column.width}px`
  43453. };
  43454. } else {
  43455. propsData.name = column.id;
  43456. }
  43457. return propsData;
  43458. };
  43459. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  43460. }
  43461. hColgroup.props = ["columns", "tableLayout"];
  43462. function useMapState() {
  43463. const table = vue.inject(TABLE_INJECTION_KEY);
  43464. const store = table == null ? void 0 : table.store;
  43465. const leftFixedLeafCount = vue.computed(() => {
  43466. return store.states.fixedLeafColumnsLength.value;
  43467. });
  43468. const rightFixedLeafCount = vue.computed(() => {
  43469. return store.states.rightFixedColumns.value.length;
  43470. });
  43471. const columnsCount = vue.computed(() => {
  43472. return store.states.columns.value.length;
  43473. });
  43474. const leftFixedCount = vue.computed(() => {
  43475. return store.states.fixedColumns.value.length;
  43476. });
  43477. const rightFixedCount = vue.computed(() => {
  43478. return store.states.rightFixedColumns.value.length;
  43479. });
  43480. return {
  43481. leftFixedLeafCount,
  43482. rightFixedLeafCount,
  43483. columnsCount,
  43484. leftFixedCount,
  43485. rightFixedCount,
  43486. columns: store.states.columns
  43487. };
  43488. }
  43489. function useStyle$1(props) {
  43490. const { columns } = useMapState();
  43491. const ns = useNamespace("table");
  43492. const getCellClasses = (columns2, cellIndex) => {
  43493. const column = columns2[cellIndex];
  43494. const classes = [
  43495. ns.e("cell"),
  43496. column.id,
  43497. column.align,
  43498. column.labelClassName,
  43499. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  43500. ];
  43501. if (column.className) {
  43502. classes.push(column.className);
  43503. }
  43504. if (!column.children) {
  43505. classes.push(ns.is("leaf"));
  43506. }
  43507. return classes;
  43508. };
  43509. const getCellStyles = (column, cellIndex) => {
  43510. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  43511. ensurePosition(fixedStyle, "left");
  43512. ensurePosition(fixedStyle, "right");
  43513. return fixedStyle;
  43514. };
  43515. return {
  43516. getCellClasses,
  43517. getCellStyles,
  43518. columns
  43519. };
  43520. }
  43521. var TableFooter = vue.defineComponent({
  43522. name: "ElTableFooter",
  43523. props: {
  43524. fixed: {
  43525. type: String,
  43526. default: ""
  43527. },
  43528. store: {
  43529. required: true,
  43530. type: Object
  43531. },
  43532. summaryMethod: Function,
  43533. sumText: String,
  43534. border: Boolean,
  43535. defaultSort: {
  43536. type: Object,
  43537. default: () => {
  43538. return {
  43539. prop: "",
  43540. order: ""
  43541. };
  43542. }
  43543. }
  43544. },
  43545. setup(props) {
  43546. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  43547. const ns = useNamespace("table");
  43548. return {
  43549. ns,
  43550. getCellClasses,
  43551. getCellStyles,
  43552. columns
  43553. };
  43554. },
  43555. render() {
  43556. const {
  43557. columns,
  43558. getCellStyles,
  43559. getCellClasses,
  43560. summaryMethod,
  43561. sumText,
  43562. ns
  43563. } = this;
  43564. const data = this.store.states.data.value;
  43565. let sums = [];
  43566. if (summaryMethod) {
  43567. sums = summaryMethod({
  43568. columns,
  43569. data
  43570. });
  43571. } else {
  43572. columns.forEach((column, index) => {
  43573. if (index === 0) {
  43574. sums[index] = sumText;
  43575. return;
  43576. }
  43577. const values = data.map((item) => Number(item[column.property]));
  43578. const precisions = [];
  43579. let notNumber = true;
  43580. values.forEach((value) => {
  43581. if (!Number.isNaN(+value)) {
  43582. notNumber = false;
  43583. const decimal = `${value}`.split(".")[1];
  43584. precisions.push(decimal ? decimal.length : 0);
  43585. }
  43586. });
  43587. const precision = Math.max.apply(null, precisions);
  43588. if (!notNumber) {
  43589. sums[index] = values.reduce((prev, curr) => {
  43590. const value = Number(curr);
  43591. if (!Number.isNaN(+value)) {
  43592. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  43593. } else {
  43594. return prev;
  43595. }
  43596. }, 0);
  43597. } else {
  43598. sums[index] = "";
  43599. }
  43600. });
  43601. }
  43602. return vue.h("table", {
  43603. class: ns.e("footer"),
  43604. cellspacing: "0",
  43605. cellpadding: "0",
  43606. border: "0"
  43607. }, [
  43608. hColgroup({
  43609. columns
  43610. }),
  43611. vue.h("tbody", [
  43612. vue.h("tr", {}, [
  43613. ...columns.map((column, cellIndex) => vue.h("td", {
  43614. key: cellIndex,
  43615. colspan: column.colSpan,
  43616. rowspan: column.rowSpan,
  43617. class: getCellClasses(columns, cellIndex),
  43618. style: getCellStyles(column, cellIndex)
  43619. }, [
  43620. vue.h("div", {
  43621. class: ["cell", column.labelClassName]
  43622. }, [sums[cellIndex]])
  43623. ]))
  43624. ])
  43625. ])
  43626. ]);
  43627. }
  43628. });
  43629. function useUtils(store) {
  43630. const setCurrentRow = (row) => {
  43631. store.commit("setCurrentRow", row);
  43632. };
  43633. const getSelectionRows = () => {
  43634. return store.getSelectionRows();
  43635. };
  43636. const toggleRowSelection = (row, selected) => {
  43637. store.toggleRowSelection(row, selected, false);
  43638. store.updateAllSelected();
  43639. };
  43640. const clearSelection = () => {
  43641. store.clearSelection();
  43642. };
  43643. const clearFilter = (columnKeys) => {
  43644. store.clearFilter(columnKeys);
  43645. };
  43646. const toggleAllSelection = () => {
  43647. store.commit("toggleAllSelection");
  43648. };
  43649. const toggleRowExpansion = (row, expanded) => {
  43650. store.toggleRowExpansionAdapter(row, expanded);
  43651. };
  43652. const clearSort = () => {
  43653. store.clearSort();
  43654. };
  43655. const sort = (prop, order) => {
  43656. store.commit("sort", { prop, order });
  43657. };
  43658. return {
  43659. setCurrentRow,
  43660. getSelectionRows,
  43661. toggleRowSelection,
  43662. clearSelection,
  43663. clearFilter,
  43664. toggleAllSelection,
  43665. toggleRowExpansion,
  43666. clearSort,
  43667. sort
  43668. };
  43669. }
  43670. function useStyle(props, layout, store, table) {
  43671. const isHidden = vue.ref(false);
  43672. const renderExpanded = vue.ref(null);
  43673. const resizeProxyVisible = vue.ref(false);
  43674. const setDragVisible = (visible) => {
  43675. resizeProxyVisible.value = visible;
  43676. };
  43677. const resizeState = vue.ref({
  43678. width: null,
  43679. height: null,
  43680. headerHeight: null
  43681. });
  43682. const isGroup = vue.ref(false);
  43683. const scrollbarViewStyle = {
  43684. display: "inline-block",
  43685. verticalAlign: "middle"
  43686. };
  43687. const tableWidth = vue.ref();
  43688. const tableScrollHeight = vue.ref(0);
  43689. const bodyScrollHeight = vue.ref(0);
  43690. const headerScrollHeight = vue.ref(0);
  43691. const footerScrollHeight = vue.ref(0);
  43692. vue.watchEffect(() => {
  43693. layout.setHeight(props.height);
  43694. });
  43695. vue.watchEffect(() => {
  43696. layout.setMaxHeight(props.maxHeight);
  43697. });
  43698. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  43699. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  43700. return;
  43701. store.setCurrentRowKey(`${currentRowKey}`);
  43702. }, {
  43703. immediate: true
  43704. });
  43705. vue.watch(() => props.data, (data) => {
  43706. table.store.commit("setData", data);
  43707. }, {
  43708. immediate: true,
  43709. deep: true
  43710. });
  43711. vue.watchEffect(() => {
  43712. if (props.expandRowKeys) {
  43713. store.setExpandRowKeysAdapter(props.expandRowKeys);
  43714. }
  43715. });
  43716. const handleMouseLeave = () => {
  43717. table.store.commit("setHoverRow", null);
  43718. if (table.hoverState)
  43719. table.hoverState = null;
  43720. };
  43721. const handleHeaderFooterMousewheel = (event, data) => {
  43722. const { pixelX, pixelY } = data;
  43723. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  43724. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  43725. }
  43726. };
  43727. const shouldUpdateHeight = vue.computed(() => {
  43728. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  43729. });
  43730. const tableBodyStyles = vue.computed(() => {
  43731. return {
  43732. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  43733. };
  43734. });
  43735. const doLayout = () => {
  43736. if (shouldUpdateHeight.value) {
  43737. layout.updateElsHeight();
  43738. }
  43739. layout.updateColumnsWidth();
  43740. requestAnimationFrame(syncPosition);
  43741. };
  43742. vue.onMounted(async () => {
  43743. await vue.nextTick();
  43744. store.updateColumns();
  43745. bindEvents();
  43746. requestAnimationFrame(doLayout);
  43747. const el = table.vnode.el;
  43748. const tableHeader = table.refs.headerWrapper;
  43749. if (props.flexible && el && el.parentElement) {
  43750. el.parentElement.style.minWidth = "0";
  43751. }
  43752. resizeState.value = {
  43753. width: tableWidth.value = el.offsetWidth,
  43754. height: el.offsetHeight,
  43755. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  43756. };
  43757. store.states.columns.value.forEach((column) => {
  43758. if (column.filteredValue && column.filteredValue.length) {
  43759. table.store.commit("filterChange", {
  43760. column,
  43761. values: column.filteredValue,
  43762. silent: true
  43763. });
  43764. }
  43765. });
  43766. table.$ready = true;
  43767. });
  43768. const setScrollClassByEl = (el, className) => {
  43769. if (!el)
  43770. return;
  43771. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  43772. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  43773. el.className = classList.join(" ");
  43774. };
  43775. const setScrollClass = (className) => {
  43776. const { tableWrapper } = table.refs;
  43777. setScrollClassByEl(tableWrapper, className);
  43778. };
  43779. const hasScrollClass = (className) => {
  43780. const { tableWrapper } = table.refs;
  43781. return !!(tableWrapper && tableWrapper.classList.contains(className));
  43782. };
  43783. const syncPosition = function() {
  43784. if (!table.refs.scrollBarRef)
  43785. return;
  43786. if (!layout.scrollX.value) {
  43787. const scrollingNoneClass = "is-scrolling-none";
  43788. if (!hasScrollClass(scrollingNoneClass)) {
  43789. setScrollClass(scrollingNoneClass);
  43790. }
  43791. return;
  43792. }
  43793. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  43794. if (!scrollContainer)
  43795. return;
  43796. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  43797. const { headerWrapper, footerWrapper } = table.refs;
  43798. if (headerWrapper)
  43799. headerWrapper.scrollLeft = scrollLeft;
  43800. if (footerWrapper)
  43801. footerWrapper.scrollLeft = scrollLeft;
  43802. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  43803. if (scrollLeft >= maxScrollLeftPosition) {
  43804. setScrollClass("is-scrolling-right");
  43805. } else if (scrollLeft === 0) {
  43806. setScrollClass("is-scrolling-left");
  43807. } else {
  43808. setScrollClass("is-scrolling-middle");
  43809. }
  43810. };
  43811. const bindEvents = () => {
  43812. if (!table.refs.scrollBarRef)
  43813. return;
  43814. if (table.refs.scrollBarRef.wrapRef) {
  43815. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  43816. passive: true
  43817. });
  43818. }
  43819. if (props.fit) {
  43820. useResizeObserver(table.vnode.el, resizeListener);
  43821. } else {
  43822. useEventListener(window, "resize", resizeListener);
  43823. }
  43824. useResizeObserver(table.refs.bodyWrapper, () => {
  43825. var _a, _b;
  43826. resizeListener();
  43827. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  43828. });
  43829. };
  43830. const resizeListener = () => {
  43831. var _a, _b, _c;
  43832. const el = table.vnode.el;
  43833. if (!table.$ready || !el)
  43834. return;
  43835. let shouldUpdateLayout = false;
  43836. const {
  43837. width: oldWidth,
  43838. height: oldHeight,
  43839. headerHeight: oldHeaderHeight
  43840. } = resizeState.value;
  43841. const width = tableWidth.value = el.offsetWidth;
  43842. if (oldWidth !== width) {
  43843. shouldUpdateLayout = true;
  43844. }
  43845. const height = el.offsetHeight;
  43846. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  43847. shouldUpdateLayout = true;
  43848. }
  43849. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  43850. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  43851. shouldUpdateLayout = true;
  43852. }
  43853. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  43854. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  43855. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  43856. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value;
  43857. if (shouldUpdateLayout) {
  43858. resizeState.value = {
  43859. width,
  43860. height,
  43861. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  43862. };
  43863. doLayout();
  43864. }
  43865. };
  43866. const tableSize = useFormSize();
  43867. const bodyWidth = vue.computed(() => {
  43868. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  43869. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  43870. });
  43871. const tableLayout = vue.computed(() => {
  43872. if (props.maxHeight)
  43873. return "fixed";
  43874. return props.tableLayout;
  43875. });
  43876. const emptyBlockStyle = vue.computed(() => {
  43877. if (props.data && props.data.length)
  43878. return null;
  43879. let height = "100%";
  43880. if (props.height && bodyScrollHeight.value) {
  43881. height = `${bodyScrollHeight.value}px`;
  43882. }
  43883. const width = tableWidth.value;
  43884. return {
  43885. width: width ? `${width}px` : "",
  43886. height
  43887. };
  43888. });
  43889. const tableInnerStyle = vue.computed(() => {
  43890. if (props.height) {
  43891. return {
  43892. height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height
  43893. };
  43894. }
  43895. if (props.maxHeight) {
  43896. return {
  43897. maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight
  43898. };
  43899. }
  43900. return {};
  43901. });
  43902. const scrollbarStyle = vue.computed(() => {
  43903. if (props.height) {
  43904. return {
  43905. height: "100%"
  43906. };
  43907. }
  43908. if (props.maxHeight) {
  43909. if (!Number.isNaN(Number(props.maxHeight))) {
  43910. const maxHeight = props.maxHeight;
  43911. const reachMaxHeight = tableScrollHeight.value >= Number(maxHeight);
  43912. if (reachMaxHeight) {
  43913. return {
  43914. maxHeight: `${tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value}px`
  43915. };
  43916. }
  43917. } else {
  43918. return {
  43919. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  43920. };
  43921. }
  43922. }
  43923. return {};
  43924. });
  43925. const handleFixedMousewheel = (event, data) => {
  43926. const bodyWrapper = table.refs.bodyWrapper;
  43927. if (Math.abs(data.spinY) > 0) {
  43928. const currentScrollTop = bodyWrapper.scrollTop;
  43929. if (data.pixelY < 0 && currentScrollTop !== 0) {
  43930. event.preventDefault();
  43931. }
  43932. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  43933. event.preventDefault();
  43934. }
  43935. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  43936. } else {
  43937. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  43938. }
  43939. };
  43940. return {
  43941. isHidden,
  43942. renderExpanded,
  43943. setDragVisible,
  43944. isGroup,
  43945. handleMouseLeave,
  43946. handleHeaderFooterMousewheel,
  43947. tableSize,
  43948. emptyBlockStyle,
  43949. handleFixedMousewheel,
  43950. resizeProxyVisible,
  43951. bodyWidth,
  43952. resizeState,
  43953. doLayout,
  43954. tableBodyStyles,
  43955. tableLayout,
  43956. scrollbarViewStyle,
  43957. tableInnerStyle,
  43958. scrollbarStyle
  43959. };
  43960. }
  43961. function useKeyRender(table) {
  43962. const observer = vue.ref();
  43963. const initWatchDom = () => {
  43964. const el = table.vnode.el;
  43965. const columnsWrapper = el.querySelector(".hidden-columns");
  43966. const config = { childList: true, subtree: true };
  43967. const updateOrderFns = table.store.states.updateOrderFns;
  43968. observer.value = new MutationObserver(() => {
  43969. updateOrderFns.forEach((fn) => fn());
  43970. });
  43971. observer.value.observe(columnsWrapper, config);
  43972. };
  43973. vue.onMounted(() => {
  43974. initWatchDom();
  43975. });
  43976. vue.onUnmounted(() => {
  43977. var _a;
  43978. (_a = observer.value) == null ? void 0 : _a.disconnect();
  43979. });
  43980. }
  43981. var defaultProps$1 = {
  43982. data: {
  43983. type: Array,
  43984. default: () => []
  43985. },
  43986. size: useSizeProp,
  43987. width: [String, Number],
  43988. height: [String, Number],
  43989. maxHeight: [String, Number],
  43990. fit: {
  43991. type: Boolean,
  43992. default: true
  43993. },
  43994. stripe: Boolean,
  43995. border: Boolean,
  43996. rowKey: [String, Function],
  43997. showHeader: {
  43998. type: Boolean,
  43999. default: true
  44000. },
  44001. showSummary: Boolean,
  44002. sumText: String,
  44003. summaryMethod: Function,
  44004. rowClassName: [String, Function],
  44005. rowStyle: [Object, Function],
  44006. cellClassName: [String, Function],
  44007. cellStyle: [Object, Function],
  44008. headerRowClassName: [String, Function],
  44009. headerRowStyle: [Object, Function],
  44010. headerCellClassName: [String, Function],
  44011. headerCellStyle: [Object, Function],
  44012. highlightCurrentRow: Boolean,
  44013. currentRowKey: [String, Number],
  44014. emptyText: String,
  44015. expandRowKeys: Array,
  44016. defaultExpandAll: Boolean,
  44017. defaultSort: Object,
  44018. tooltipEffect: String,
  44019. tooltipOptions: Object,
  44020. spanMethod: Function,
  44021. selectOnIndeterminate: {
  44022. type: Boolean,
  44023. default: true
  44024. },
  44025. indent: {
  44026. type: Number,
  44027. default: 16
  44028. },
  44029. treeProps: {
  44030. type: Object,
  44031. default: () => {
  44032. return {
  44033. hasChildren: "hasChildren",
  44034. children: "children"
  44035. };
  44036. }
  44037. },
  44038. lazy: Boolean,
  44039. load: Function,
  44040. style: {
  44041. type: Object,
  44042. default: () => ({})
  44043. },
  44044. className: {
  44045. type: String,
  44046. default: ""
  44047. },
  44048. tableLayout: {
  44049. type: String,
  44050. default: "fixed"
  44051. },
  44052. scrollbarAlwaysOn: {
  44053. type: Boolean,
  44054. default: false
  44055. },
  44056. flexible: Boolean
  44057. };
  44058. const useScrollbar$1 = () => {
  44059. const scrollBarRef = vue.ref();
  44060. const scrollTo = (options, yCoord) => {
  44061. const scrollbar = scrollBarRef.value;
  44062. if (scrollbar) {
  44063. scrollbar.scrollTo(options, yCoord);
  44064. }
  44065. };
  44066. const setScrollPosition = (position, offset) => {
  44067. const scrollbar = scrollBarRef.value;
  44068. if (scrollbar && isNumber$1(offset) && ["Top", "Left"].includes(position)) {
  44069. scrollbar[`setScroll${position}`](offset);
  44070. }
  44071. };
  44072. const setScrollTop = (top) => setScrollPosition("Top", top);
  44073. const setScrollLeft = (left) => setScrollPosition("Left", left);
  44074. return {
  44075. scrollBarRef,
  44076. scrollTo,
  44077. setScrollTop,
  44078. setScrollLeft
  44079. };
  44080. };
  44081. let tableIdSeed = 1;
  44082. const _sfc_main$q = vue.defineComponent({
  44083. name: "ElTable",
  44084. directives: {
  44085. Mousewheel
  44086. },
  44087. components: {
  44088. TableHeader,
  44089. TableBody,
  44090. TableFooter,
  44091. ElScrollbar,
  44092. hColgroup
  44093. },
  44094. props: defaultProps$1,
  44095. emits: [
  44096. "select",
  44097. "select-all",
  44098. "selection-change",
  44099. "cell-mouse-enter",
  44100. "cell-mouse-leave",
  44101. "cell-contextmenu",
  44102. "cell-click",
  44103. "cell-dblclick",
  44104. "row-click",
  44105. "row-contextmenu",
  44106. "row-dblclick",
  44107. "header-click",
  44108. "header-contextmenu",
  44109. "sort-change",
  44110. "filter-change",
  44111. "current-change",
  44112. "header-dragend",
  44113. "expand-change"
  44114. ],
  44115. setup(props) {
  44116. const { t } = useLocale();
  44117. const ns = useNamespace("table");
  44118. const table = vue.getCurrentInstance();
  44119. vue.provide(TABLE_INJECTION_KEY, table);
  44120. const store = createStore(table, props);
  44121. table.store = store;
  44122. const layout = new TableLayout$1({
  44123. store: table.store,
  44124. table,
  44125. fit: props.fit,
  44126. showHeader: props.showHeader
  44127. });
  44128. table.layout = layout;
  44129. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  44130. const {
  44131. setCurrentRow,
  44132. getSelectionRows,
  44133. toggleRowSelection,
  44134. clearSelection,
  44135. clearFilter,
  44136. toggleAllSelection,
  44137. toggleRowExpansion,
  44138. clearSort,
  44139. sort
  44140. } = useUtils(store);
  44141. const {
  44142. isHidden,
  44143. renderExpanded,
  44144. setDragVisible,
  44145. isGroup,
  44146. handleMouseLeave,
  44147. handleHeaderFooterMousewheel,
  44148. tableSize,
  44149. emptyBlockStyle,
  44150. handleFixedMousewheel,
  44151. resizeProxyVisible,
  44152. bodyWidth,
  44153. resizeState,
  44154. doLayout,
  44155. tableBodyStyles,
  44156. tableLayout,
  44157. scrollbarViewStyle,
  44158. tableInnerStyle,
  44159. scrollbarStyle
  44160. } = useStyle(props, layout, store, table);
  44161. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  44162. const debouncedUpdateLayout = debounce(doLayout, 50);
  44163. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  44164. table.tableId = tableId;
  44165. table.state = {
  44166. isGroup,
  44167. resizeState,
  44168. doLayout,
  44169. debouncedUpdateLayout
  44170. };
  44171. const computedSumText = vue.computed(() => props.sumText || t("el.table.sumText"));
  44172. const computedEmptyText = vue.computed(() => {
  44173. return props.emptyText || t("el.table.emptyText");
  44174. });
  44175. useKeyRender(table);
  44176. return {
  44177. ns,
  44178. layout,
  44179. store,
  44180. handleHeaderFooterMousewheel,
  44181. handleMouseLeave,
  44182. tableId,
  44183. tableSize,
  44184. isHidden,
  44185. isEmpty,
  44186. renderExpanded,
  44187. resizeProxyVisible,
  44188. resizeState,
  44189. isGroup,
  44190. bodyWidth,
  44191. tableBodyStyles,
  44192. emptyBlockStyle,
  44193. debouncedUpdateLayout,
  44194. handleFixedMousewheel,
  44195. setCurrentRow,
  44196. getSelectionRows,
  44197. toggleRowSelection,
  44198. clearSelection,
  44199. clearFilter,
  44200. toggleAllSelection,
  44201. toggleRowExpansion,
  44202. clearSort,
  44203. doLayout,
  44204. sort,
  44205. t,
  44206. setDragVisible,
  44207. context: table,
  44208. computedSumText,
  44209. computedEmptyText,
  44210. tableLayout,
  44211. scrollbarViewStyle,
  44212. tableInnerStyle,
  44213. scrollbarStyle,
  44214. scrollBarRef,
  44215. scrollTo,
  44216. setScrollLeft,
  44217. setScrollTop
  44218. };
  44219. }
  44220. });
  44221. const _hoisted_1$b = ["data-prefix"];
  44222. const _hoisted_2$7 = {
  44223. ref: "hiddenColumns",
  44224. class: "hidden-columns"
  44225. };
  44226. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  44227. const _component_hColgroup = vue.resolveComponent("hColgroup");
  44228. const _component_table_header = vue.resolveComponent("table-header");
  44229. const _component_table_body = vue.resolveComponent("table-body");
  44230. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  44231. const _component_table_footer = vue.resolveComponent("table-footer");
  44232. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  44233. return vue.openBlock(), vue.createElementBlock("div", {
  44234. ref: "tableWrapper",
  44235. class: vue.normalizeClass([
  44236. {
  44237. [_ctx.ns.m("fit")]: _ctx.fit,
  44238. [_ctx.ns.m("striped")]: _ctx.stripe,
  44239. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  44240. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  44241. [_ctx.ns.m("group")]: _ctx.isGroup,
  44242. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  44243. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  44244. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  44245. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  44246. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  44247. "has-footer": _ctx.showSummary
  44248. },
  44249. _ctx.ns.m(_ctx.tableSize),
  44250. _ctx.className,
  44251. _ctx.ns.b(),
  44252. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  44253. ]),
  44254. style: vue.normalizeStyle(_ctx.style),
  44255. "data-prefix": _ctx.ns.namespace.value,
  44256. onMouseleave: _cache[0] || (_cache[0] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args))
  44257. }, [
  44258. vue.createElementVNode("div", {
  44259. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper")),
  44260. style: vue.normalizeStyle(_ctx.tableInnerStyle)
  44261. }, [
  44262. vue.createElementVNode("div", _hoisted_2$7, [
  44263. vue.renderSlot(_ctx.$slots, "default")
  44264. ], 512),
  44265. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  44266. key: 0,
  44267. ref: "headerWrapper",
  44268. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  44269. }, [
  44270. vue.createElementVNode("table", {
  44271. ref: "tableHeader",
  44272. class: vue.normalizeClass(_ctx.ns.e("header")),
  44273. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  44274. border: "0",
  44275. cellpadding: "0",
  44276. cellspacing: "0"
  44277. }, [
  44278. vue.createVNode(_component_hColgroup, {
  44279. columns: _ctx.store.states.columns.value,
  44280. "table-layout": _ctx.tableLayout
  44281. }, null, 8, ["columns", "table-layout"]),
  44282. vue.createVNode(_component_table_header, {
  44283. ref: "tableHeaderRef",
  44284. border: _ctx.border,
  44285. "default-sort": _ctx.defaultSort,
  44286. store: _ctx.store,
  44287. onSetDragVisible: _ctx.setDragVisible
  44288. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  44289. ], 6)
  44290. ], 2)), [
  44291. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  44292. ]) : vue.createCommentVNode("v-if", true),
  44293. vue.createElementVNode("div", {
  44294. ref: "bodyWrapper",
  44295. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  44296. }, [
  44297. vue.createVNode(_component_el_scrollbar, {
  44298. ref: "scrollBarRef",
  44299. "view-style": _ctx.scrollbarViewStyle,
  44300. "wrap-style": _ctx.scrollbarStyle,
  44301. always: _ctx.scrollbarAlwaysOn
  44302. }, {
  44303. default: vue.withCtx(() => [
  44304. vue.createElementVNode("table", {
  44305. ref: "tableBody",
  44306. class: vue.normalizeClass(_ctx.ns.e("body")),
  44307. cellspacing: "0",
  44308. cellpadding: "0",
  44309. border: "0",
  44310. style: vue.normalizeStyle({
  44311. width: _ctx.bodyWidth,
  44312. tableLayout: _ctx.tableLayout
  44313. })
  44314. }, [
  44315. vue.createVNode(_component_hColgroup, {
  44316. columns: _ctx.store.states.columns.value,
  44317. "table-layout": _ctx.tableLayout
  44318. }, null, 8, ["columns", "table-layout"]),
  44319. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  44320. key: 0,
  44321. ref: "tableHeaderRef",
  44322. border: _ctx.border,
  44323. "default-sort": _ctx.defaultSort,
  44324. store: _ctx.store,
  44325. onSetDragVisible: _ctx.setDragVisible
  44326. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  44327. vue.createVNode(_component_table_body, {
  44328. context: _ctx.context,
  44329. highlight: _ctx.highlightCurrentRow,
  44330. "row-class-name": _ctx.rowClassName,
  44331. "tooltip-effect": _ctx.tooltipEffect,
  44332. "tooltip-options": _ctx.tooltipOptions,
  44333. "row-style": _ctx.rowStyle,
  44334. store: _ctx.store,
  44335. stripe: _ctx.stripe
  44336. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"])
  44337. ], 6),
  44338. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  44339. key: 0,
  44340. ref: "emptyBlock",
  44341. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  44342. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  44343. }, [
  44344. vue.createElementVNode("span", {
  44345. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  44346. }, [
  44347. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  44348. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  44349. ])
  44350. ], 2)
  44351. ], 6)) : vue.createCommentVNode("v-if", true),
  44352. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  44353. key: 1,
  44354. ref: "appendWrapper",
  44355. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  44356. }, [
  44357. vue.renderSlot(_ctx.$slots, "append")
  44358. ], 2)) : vue.createCommentVNode("v-if", true)
  44359. ]),
  44360. _: 3
  44361. }, 8, ["view-style", "wrap-style", "always"])
  44362. ], 2),
  44363. _ctx.showSummary ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  44364. key: 1,
  44365. ref: "footerWrapper",
  44366. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  44367. }, [
  44368. vue.createVNode(_component_table_footer, {
  44369. border: _ctx.border,
  44370. "default-sort": _ctx.defaultSort,
  44371. store: _ctx.store,
  44372. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  44373. "sum-text": _ctx.computedSumText,
  44374. "summary-method": _ctx.summaryMethod
  44375. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  44376. ], 2)), [
  44377. [vue.vShow, !_ctx.isEmpty],
  44378. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  44379. ]) : vue.createCommentVNode("v-if", true),
  44380. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  44381. key: 2,
  44382. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  44383. }, null, 2)) : vue.createCommentVNode("v-if", true)
  44384. ], 6),
  44385. vue.withDirectives(vue.createElementVNode("div", {
  44386. ref: "resizeProxy",
  44387. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  44388. }, null, 2), [
  44389. [vue.vShow, _ctx.resizeProxyVisible]
  44390. ])
  44391. ], 46, _hoisted_1$b);
  44392. }
  44393. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  44394. const defaultClassNames = {
  44395. selection: "table-column--selection",
  44396. expand: "table__expand-column"
  44397. };
  44398. const cellStarts = {
  44399. default: {
  44400. order: ""
  44401. },
  44402. selection: {
  44403. width: 48,
  44404. minWidth: 48,
  44405. realWidth: 48,
  44406. order: ""
  44407. },
  44408. expand: {
  44409. width: 48,
  44410. minWidth: 48,
  44411. realWidth: 48,
  44412. order: ""
  44413. },
  44414. index: {
  44415. width: 48,
  44416. minWidth: 48,
  44417. realWidth: 48,
  44418. order: ""
  44419. }
  44420. };
  44421. const getDefaultClassName = (type) => {
  44422. return defaultClassNames[type] || "";
  44423. };
  44424. const cellForced = {
  44425. selection: {
  44426. renderHeader({ store }) {
  44427. function isDisabled() {
  44428. return store.states.data.value && store.states.data.value.length === 0;
  44429. }
  44430. return vue.h(ElCheckbox, {
  44431. disabled: isDisabled(),
  44432. size: store.states.tableSize.value,
  44433. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  44434. "onUpdate:modelValue": store.toggleAllSelection,
  44435. modelValue: store.states.isAllSelected.value
  44436. });
  44437. },
  44438. renderCell({
  44439. row,
  44440. column,
  44441. store,
  44442. $index
  44443. }) {
  44444. return vue.h(ElCheckbox, {
  44445. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  44446. size: store.states.tableSize.value,
  44447. onChange: () => {
  44448. store.commit("rowSelectedChanged", row);
  44449. },
  44450. onClick: (event) => event.stopPropagation(),
  44451. modelValue: store.isSelected(row)
  44452. });
  44453. },
  44454. sortable: false,
  44455. resizable: false
  44456. },
  44457. index: {
  44458. renderHeader({ column }) {
  44459. return column.label || "#";
  44460. },
  44461. renderCell({
  44462. column,
  44463. $index
  44464. }) {
  44465. let i = $index + 1;
  44466. const index = column.index;
  44467. if (typeof index === "number") {
  44468. i = $index + index;
  44469. } else if (typeof index === "function") {
  44470. i = index($index);
  44471. }
  44472. return vue.h("div", {}, [i]);
  44473. },
  44474. sortable: false
  44475. },
  44476. expand: {
  44477. renderHeader({ column }) {
  44478. return column.label || "";
  44479. },
  44480. renderCell({
  44481. row,
  44482. store,
  44483. expanded
  44484. }) {
  44485. const { ns } = store;
  44486. const classes = [ns.e("expand-icon")];
  44487. if (expanded) {
  44488. classes.push(ns.em("expand-icon", "expanded"));
  44489. }
  44490. const callback = function(e) {
  44491. e.stopPropagation();
  44492. store.toggleRowExpansion(row);
  44493. };
  44494. return vue.h("div", {
  44495. class: classes,
  44496. onClick: callback
  44497. }, {
  44498. default: () => {
  44499. return [
  44500. vue.h(ElIcon, null, {
  44501. default: () => {
  44502. return [vue.h(arrow_right_default)];
  44503. }
  44504. })
  44505. ];
  44506. }
  44507. });
  44508. },
  44509. sortable: false,
  44510. resizable: false
  44511. }
  44512. };
  44513. function defaultRenderCell({
  44514. row,
  44515. column,
  44516. $index
  44517. }) {
  44518. var _a;
  44519. const property = column.property;
  44520. const value = property && getProp(row, property).value;
  44521. if (column && column.formatter) {
  44522. return column.formatter(row, column, value, $index);
  44523. }
  44524. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  44525. }
  44526. function treeCellPrefix({
  44527. row,
  44528. treeNode,
  44529. store
  44530. }, createPlaceholder = false) {
  44531. const { ns } = store;
  44532. if (!treeNode) {
  44533. if (createPlaceholder) {
  44534. return [
  44535. vue.h("span", {
  44536. class: ns.e("placeholder")
  44537. })
  44538. ];
  44539. }
  44540. return null;
  44541. }
  44542. const ele = [];
  44543. const callback = function(e) {
  44544. e.stopPropagation();
  44545. if (treeNode.loading) {
  44546. return;
  44547. }
  44548. store.loadOrToggle(row);
  44549. };
  44550. if (treeNode.indent) {
  44551. ele.push(vue.h("span", {
  44552. class: ns.e("indent"),
  44553. style: { "padding-left": `${treeNode.indent}px` }
  44554. }));
  44555. }
  44556. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  44557. const expandClasses = [
  44558. ns.e("expand-icon"),
  44559. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  44560. ];
  44561. let icon = arrow_right_default;
  44562. if (treeNode.loading) {
  44563. icon = loading_default;
  44564. }
  44565. ele.push(vue.h("div", {
  44566. class: expandClasses,
  44567. onClick: callback
  44568. }, {
  44569. default: () => {
  44570. return [
  44571. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  44572. default: () => [vue.h(icon)]
  44573. })
  44574. ];
  44575. }
  44576. }));
  44577. } else {
  44578. ele.push(vue.h("span", {
  44579. class: ns.e("placeholder")
  44580. }));
  44581. }
  44582. return ele;
  44583. }
  44584. function getAllAliases(props, aliases) {
  44585. return props.reduce((prev, cur) => {
  44586. prev[cur] = cur;
  44587. return prev;
  44588. }, aliases);
  44589. }
  44590. function useWatcher(owner, props_) {
  44591. const instance = vue.getCurrentInstance();
  44592. const registerComplexWatchers = () => {
  44593. const props = ["fixed"];
  44594. const aliases = {
  44595. realWidth: "width",
  44596. realMinWidth: "minWidth"
  44597. };
  44598. const allAliases = getAllAliases(props, aliases);
  44599. Object.keys(allAliases).forEach((key) => {
  44600. const columnKey = aliases[key];
  44601. if (hasOwn(props_, columnKey)) {
  44602. vue.watch(() => props_[columnKey], (newVal) => {
  44603. let value = newVal;
  44604. if (columnKey === "width" && key === "realWidth") {
  44605. value = parseWidth(newVal);
  44606. }
  44607. if (columnKey === "minWidth" && key === "realMinWidth") {
  44608. value = parseMinWidth(newVal);
  44609. }
  44610. instance.columnConfig.value[columnKey] = value;
  44611. instance.columnConfig.value[key] = value;
  44612. const updateColumns = columnKey === "fixed";
  44613. owner.value.store.scheduleLayout(updateColumns);
  44614. });
  44615. }
  44616. });
  44617. };
  44618. const registerNormalWatchers = () => {
  44619. const props = [
  44620. "label",
  44621. "filters",
  44622. "filterMultiple",
  44623. "sortable",
  44624. "index",
  44625. "formatter",
  44626. "className",
  44627. "labelClassName",
  44628. "showOverflowTooltip"
  44629. ];
  44630. const aliases = {
  44631. property: "prop",
  44632. align: "realAlign",
  44633. headerAlign: "realHeaderAlign"
  44634. };
  44635. const allAliases = getAllAliases(props, aliases);
  44636. Object.keys(allAliases).forEach((key) => {
  44637. const columnKey = aliases[key];
  44638. if (hasOwn(props_, columnKey)) {
  44639. vue.watch(() => props_[columnKey], (newVal) => {
  44640. instance.columnConfig.value[key] = newVal;
  44641. });
  44642. }
  44643. });
  44644. };
  44645. return {
  44646. registerComplexWatchers,
  44647. registerNormalWatchers
  44648. };
  44649. }
  44650. function useRender(props, slots, owner) {
  44651. const instance = vue.getCurrentInstance();
  44652. const columnId = vue.ref("");
  44653. const isSubColumn = vue.ref(false);
  44654. const realAlign = vue.ref();
  44655. const realHeaderAlign = vue.ref();
  44656. const ns = useNamespace("table");
  44657. vue.watchEffect(() => {
  44658. realAlign.value = props.align ? `is-${props.align}` : null;
  44659. realAlign.value;
  44660. });
  44661. vue.watchEffect(() => {
  44662. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  44663. realHeaderAlign.value;
  44664. });
  44665. const columnOrTableParent = vue.computed(() => {
  44666. let parent = instance.vnode.vParent || instance.parent;
  44667. while (parent && !parent.tableId && !parent.columnId) {
  44668. parent = parent.vnode.vParent || parent.parent;
  44669. }
  44670. return parent;
  44671. });
  44672. const hasTreeColumn = vue.computed(() => {
  44673. const { store } = instance.parent;
  44674. if (!store)
  44675. return false;
  44676. const { treeData } = store.states;
  44677. const treeDataValue = treeData.value;
  44678. return treeDataValue && Object.keys(treeDataValue).length > 0;
  44679. });
  44680. const realWidth = vue.ref(parseWidth(props.width));
  44681. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  44682. const setColumnWidth = (column) => {
  44683. if (realWidth.value)
  44684. column.width = realWidth.value;
  44685. if (realMinWidth.value) {
  44686. column.minWidth = realMinWidth.value;
  44687. }
  44688. if (!realWidth.value && realMinWidth.value) {
  44689. column.width = void 0;
  44690. }
  44691. if (!column.minWidth) {
  44692. column.minWidth = 80;
  44693. }
  44694. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  44695. return column;
  44696. };
  44697. const setColumnForcedProps = (column) => {
  44698. const type = column.type;
  44699. const source = cellForced[type] || {};
  44700. Object.keys(source).forEach((prop) => {
  44701. const value = source[prop];
  44702. if (prop !== "className" && value !== void 0) {
  44703. column[prop] = value;
  44704. }
  44705. });
  44706. const className = getDefaultClassName(type);
  44707. if (className) {
  44708. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  44709. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  44710. }
  44711. return column;
  44712. };
  44713. const checkSubColumn = (children) => {
  44714. if (Array.isArray(children)) {
  44715. children.forEach((child) => check(child));
  44716. } else {
  44717. check(children);
  44718. }
  44719. function check(item) {
  44720. var _a;
  44721. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  44722. item.vParent = instance;
  44723. }
  44724. }
  44725. };
  44726. const setColumnRenders = (column) => {
  44727. if (props.renderHeader) ; else if (column.type !== "selection") {
  44728. column.renderHeader = (scope) => {
  44729. instance.columnConfig.value["label"];
  44730. const renderHeader = slots.header;
  44731. return renderHeader ? renderHeader(scope) : column.label;
  44732. };
  44733. }
  44734. let originRenderCell = column.renderCell;
  44735. if (column.type === "expand") {
  44736. column.renderCell = (data) => vue.h("div", {
  44737. class: "cell"
  44738. }, [originRenderCell(data)]);
  44739. owner.value.renderExpanded = (data) => {
  44740. return slots.default ? slots.default(data) : slots.default;
  44741. };
  44742. } else {
  44743. originRenderCell = originRenderCell || defaultRenderCell;
  44744. column.renderCell = (data) => {
  44745. let children = null;
  44746. if (slots.default) {
  44747. const vnodes = slots.default(data);
  44748. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  44749. } else {
  44750. children = originRenderCell(data);
  44751. }
  44752. const { columns } = owner.value.store.states;
  44753. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  44754. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  44755. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  44756. const props2 = {
  44757. class: "cell",
  44758. style: {}
  44759. };
  44760. if (column.showOverflowTooltip) {
  44761. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  44762. props2.style = {
  44763. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  44764. };
  44765. }
  44766. checkSubColumn(children);
  44767. return vue.h("div", props2, [prefix, children]);
  44768. };
  44769. }
  44770. return column;
  44771. };
  44772. const getPropsData = (...propsKey) => {
  44773. return propsKey.reduce((prev, cur) => {
  44774. if (Array.isArray(cur)) {
  44775. cur.forEach((key) => {
  44776. prev[key] = props[key];
  44777. });
  44778. }
  44779. return prev;
  44780. }, {});
  44781. };
  44782. const getColumnElIndex = (children, child) => {
  44783. return Array.prototype.indexOf.call(children, child);
  44784. };
  44785. const updateColumnOrder = () => {
  44786. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  44787. };
  44788. return {
  44789. columnId,
  44790. realAlign,
  44791. isSubColumn,
  44792. realHeaderAlign,
  44793. columnOrTableParent,
  44794. setColumnWidth,
  44795. setColumnForcedProps,
  44796. setColumnRenders,
  44797. getPropsData,
  44798. getColumnElIndex,
  44799. updateColumnOrder
  44800. };
  44801. }
  44802. var defaultProps = {
  44803. type: {
  44804. type: String,
  44805. default: "default"
  44806. },
  44807. label: String,
  44808. className: String,
  44809. labelClassName: String,
  44810. property: String,
  44811. prop: String,
  44812. width: {
  44813. type: [String, Number],
  44814. default: ""
  44815. },
  44816. minWidth: {
  44817. type: [String, Number],
  44818. default: ""
  44819. },
  44820. renderHeader: Function,
  44821. sortable: {
  44822. type: [Boolean, String],
  44823. default: false
  44824. },
  44825. sortMethod: Function,
  44826. sortBy: [String, Function, Array],
  44827. resizable: {
  44828. type: Boolean,
  44829. default: true
  44830. },
  44831. columnKey: String,
  44832. align: String,
  44833. headerAlign: String,
  44834. showOverflowTooltip: [Boolean, Object],
  44835. fixed: [Boolean, String],
  44836. formatter: Function,
  44837. selectable: Function,
  44838. reserveSelection: Boolean,
  44839. filterMethod: Function,
  44840. filteredValue: Array,
  44841. filters: Array,
  44842. filterPlacement: String,
  44843. filterMultiple: {
  44844. type: Boolean,
  44845. default: true
  44846. },
  44847. index: [Number, Function],
  44848. sortOrders: {
  44849. type: Array,
  44850. default: () => {
  44851. return ["ascending", "descending", null];
  44852. },
  44853. validator: (val) => {
  44854. return val.every((order) => ["ascending", "descending", null].includes(order));
  44855. }
  44856. }
  44857. };
  44858. let columnIdSeed = 1;
  44859. var ElTableColumn$1 = vue.defineComponent({
  44860. name: "ElTableColumn",
  44861. components: {
  44862. ElCheckbox
  44863. },
  44864. props: defaultProps,
  44865. setup(props, { slots }) {
  44866. const instance = vue.getCurrentInstance();
  44867. const columnConfig = vue.ref({});
  44868. const owner = vue.computed(() => {
  44869. let parent2 = instance.parent;
  44870. while (parent2 && !parent2.tableId) {
  44871. parent2 = parent2.parent;
  44872. }
  44873. return parent2;
  44874. });
  44875. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  44876. const {
  44877. columnId,
  44878. isSubColumn,
  44879. realHeaderAlign,
  44880. columnOrTableParent,
  44881. setColumnWidth,
  44882. setColumnForcedProps,
  44883. setColumnRenders,
  44884. getPropsData,
  44885. getColumnElIndex,
  44886. realAlign,
  44887. updateColumnOrder
  44888. } = useRender(props, slots, owner);
  44889. const parent = columnOrTableParent.value;
  44890. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  44891. vue.onBeforeMount(() => {
  44892. isSubColumn.value = owner.value !== parent;
  44893. const type = props.type || "default";
  44894. const sortable = props.sortable === "" ? true : props.sortable;
  44895. const defaults = {
  44896. ...cellStarts[type],
  44897. id: columnId.value,
  44898. type,
  44899. property: props.prop || props.property,
  44900. align: realAlign,
  44901. headerAlign: realHeaderAlign,
  44902. showOverflowTooltip: props.showOverflowTooltip,
  44903. filterable: props.filters || props.filterMethod,
  44904. filteredValue: [],
  44905. filterPlacement: "",
  44906. isColumnGroup: false,
  44907. isSubColumn: false,
  44908. filterOpened: false,
  44909. sortable,
  44910. index: props.index,
  44911. rawColumnKey: instance.vnode.key
  44912. };
  44913. const basicProps = [
  44914. "columnKey",
  44915. "label",
  44916. "className",
  44917. "labelClassName",
  44918. "type",
  44919. "renderHeader",
  44920. "formatter",
  44921. "fixed",
  44922. "resizable"
  44923. ];
  44924. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  44925. const selectProps = ["selectable", "reserveSelection"];
  44926. const filterProps = [
  44927. "filterMethod",
  44928. "filters",
  44929. "filterMultiple",
  44930. "filterOpened",
  44931. "filteredValue",
  44932. "filterPlacement"
  44933. ];
  44934. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  44935. column = mergeOptions(defaults, column);
  44936. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  44937. column = chains(column);
  44938. columnConfig.value = column;
  44939. registerNormalWatchers();
  44940. registerComplexWatchers();
  44941. });
  44942. vue.onMounted(() => {
  44943. var _a;
  44944. const parent2 = columnOrTableParent.value;
  44945. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  44946. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  44947. columnConfig.value.getColumnIndex = getColumnIndex;
  44948. const columnIndex = getColumnIndex();
  44949. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  44950. });
  44951. vue.onBeforeUnmount(() => {
  44952. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  44953. });
  44954. instance.columnId = columnId.value;
  44955. instance.columnConfig = columnConfig;
  44956. return;
  44957. },
  44958. render() {
  44959. var _a, _b, _c;
  44960. try {
  44961. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  44962. row: {},
  44963. column: {},
  44964. $index: -1
  44965. });
  44966. const children = [];
  44967. if (Array.isArray(renderDefault)) {
  44968. for (const childNode of renderDefault) {
  44969. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  44970. children.push(childNode);
  44971. } else if (childNode.type === vue.Fragment && Array.isArray(childNode.children)) {
  44972. childNode.children.forEach((vnode2) => {
  44973. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  44974. children.push(vnode2);
  44975. }
  44976. });
  44977. }
  44978. }
  44979. }
  44980. const vnode = vue.h("div", children);
  44981. return vnode;
  44982. } catch (e) {
  44983. return vue.h("div", []);
  44984. }
  44985. }
  44986. });
  44987. const ElTable = withInstall(Table, {
  44988. TableColumn: ElTableColumn$1
  44989. });
  44990. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  44991. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  44992. SortOrder2["ASC"] = "asc";
  44993. SortOrder2["DESC"] = "desc";
  44994. return SortOrder2;
  44995. })(SortOrder || {});
  44996. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  44997. Alignment2["CENTER"] = "center";
  44998. Alignment2["RIGHT"] = "right";
  44999. return Alignment2;
  45000. })(Alignment || {});
  45001. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  45002. FixedDir2["LEFT"] = "left";
  45003. FixedDir2["RIGHT"] = "right";
  45004. return FixedDir2;
  45005. })(FixedDir || {});
  45006. const oppositeOrderMap = {
  45007. ["asc" /* ASC */]: "desc" /* DESC */,
  45008. ["desc" /* DESC */]: "asc" /* ASC */
  45009. };
  45010. const placeholderSign = Symbol("placeholder");
  45011. const calcColumnStyle = (column, fixedColumn, fixed) => {
  45012. var _a;
  45013. const flex = {
  45014. flexGrow: 0,
  45015. flexShrink: 0,
  45016. ...fixed ? {} : {
  45017. flexGrow: column.flexGrow || 0,
  45018. flexShrink: column.flexShrink || 1
  45019. }
  45020. };
  45021. if (!fixed) {
  45022. flex.flexShrink = 1;
  45023. }
  45024. const style = {
  45025. ...(_a = column.style) != null ? _a : {},
  45026. ...flex,
  45027. flexBasis: "auto",
  45028. width: column.width
  45029. };
  45030. if (!fixedColumn) {
  45031. if (column.maxWidth)
  45032. style.maxWidth = column.maxWidth;
  45033. if (column.minWidth)
  45034. style.minWidth = column.minWidth;
  45035. }
  45036. return style;
  45037. };
  45038. function useColumns(props, columns, fixed) {
  45039. const visibleColumns = vue.computed(() => {
  45040. return vue.unref(columns).filter((column) => !column.hidden);
  45041. });
  45042. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  45043. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  45044. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  45045. const mainColumns = vue.computed(() => {
  45046. const ret = [];
  45047. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  45048. ret.push({
  45049. ...column,
  45050. placeholderSign
  45051. });
  45052. });
  45053. vue.unref(normalColumns).forEach((column) => {
  45054. ret.push(column);
  45055. });
  45056. vue.unref(fixedColumnsOnRight).forEach((column) => {
  45057. ret.push({
  45058. ...column,
  45059. placeholderSign
  45060. });
  45061. });
  45062. return ret;
  45063. });
  45064. const hasFixedColumns = vue.computed(() => {
  45065. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  45066. });
  45067. const columnsStyles = vue.computed(() => {
  45068. const _columns = vue.unref(columns);
  45069. return _columns.reduce((style, column) => {
  45070. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  45071. return style;
  45072. }, {});
  45073. });
  45074. const columnsTotalWidth = vue.computed(() => {
  45075. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  45076. });
  45077. const getColumn = (key) => {
  45078. return vue.unref(columns).find((column) => column.key === key);
  45079. };
  45080. const getColumnStyle = (key) => {
  45081. return vue.unref(columnsStyles)[key];
  45082. };
  45083. const updateColumnWidth = (column, width) => {
  45084. column.width = width;
  45085. };
  45086. function onColumnSorted(e) {
  45087. var _a;
  45088. const { key } = e.currentTarget.dataset;
  45089. if (!key)
  45090. return;
  45091. const { sortState, sortBy } = props;
  45092. let order = SortOrder.ASC;
  45093. if (isObject$1(sortState)) {
  45094. order = oppositeOrderMap[sortState[key]];
  45095. } else {
  45096. order = oppositeOrderMap[sortBy.order];
  45097. }
  45098. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  45099. }
  45100. return {
  45101. columns,
  45102. columnsStyles,
  45103. columnsTotalWidth,
  45104. fixedColumnsOnLeft,
  45105. fixedColumnsOnRight,
  45106. hasFixedColumns,
  45107. mainColumns,
  45108. normalColumns,
  45109. visibleColumns,
  45110. getColumn,
  45111. getColumnStyle,
  45112. updateColumnWidth,
  45113. onColumnSorted
  45114. };
  45115. }
  45116. const useScrollbar = (props, {
  45117. mainTableRef,
  45118. leftTableRef,
  45119. rightTableRef,
  45120. onMaybeEndReached
  45121. }) => {
  45122. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  45123. function doScroll(params) {
  45124. var _a, _b, _c;
  45125. const { scrollTop } = params;
  45126. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  45127. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  45128. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  45129. }
  45130. function scrollTo(params) {
  45131. scrollPos.value = params;
  45132. doScroll(params);
  45133. }
  45134. function scrollToTop(scrollTop) {
  45135. scrollPos.value.scrollTop = scrollTop;
  45136. doScroll(vue.unref(scrollPos));
  45137. }
  45138. function scrollToLeft(scrollLeft) {
  45139. var _a, _b;
  45140. scrollPos.value.scrollLeft = scrollLeft;
  45141. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  45142. }
  45143. function onScroll(params) {
  45144. var _a;
  45145. scrollTo(params);
  45146. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  45147. }
  45148. function onVerticalScroll({ scrollTop }) {
  45149. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  45150. if (scrollTop !== currentScrollTop)
  45151. scrollToTop(scrollTop);
  45152. }
  45153. function scrollToRow(row, strategy = "auto") {
  45154. var _a;
  45155. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  45156. }
  45157. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  45158. if (cur > prev)
  45159. onMaybeEndReached();
  45160. });
  45161. return {
  45162. scrollPos,
  45163. scrollTo,
  45164. scrollToLeft,
  45165. scrollToTop,
  45166. scrollToRow,
  45167. onScroll,
  45168. onVerticalScroll
  45169. };
  45170. };
  45171. const useRow = (props, { mainTableRef, leftTableRef, rightTableRef }) => {
  45172. const vm = vue.getCurrentInstance();
  45173. const { emit } = vm;
  45174. const isResetting = vue.shallowRef(false);
  45175. const hoveringRowKey = vue.shallowRef(null);
  45176. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  45177. const lastRenderedRowIndex = vue.ref(-1);
  45178. const resetIndex = vue.shallowRef(null);
  45179. const rowHeights = vue.ref({});
  45180. const pendingRowHeights = vue.ref({});
  45181. const leftTableHeights = vue.shallowRef({});
  45182. const mainTableHeights = vue.shallowRef({});
  45183. const rightTableHeights = vue.shallowRef({});
  45184. const isDynamic = vue.computed(() => isNumber$1(props.estimatedRowHeight));
  45185. function onRowsRendered(params) {
  45186. var _a;
  45187. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  45188. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  45189. lastRenderedRowIndex.value = params.rowCacheEnd;
  45190. }
  45191. }
  45192. function onRowHovered({ hovered, rowKey }) {
  45193. hoveringRowKey.value = hovered ? rowKey : null;
  45194. }
  45195. function onRowExpanded({
  45196. expanded,
  45197. rowData,
  45198. rowIndex,
  45199. rowKey
  45200. }) {
  45201. var _a, _b;
  45202. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  45203. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  45204. if (expanded) {
  45205. if (currentKeyIndex === -1)
  45206. _expandedRowKeys.push(rowKey);
  45207. } else {
  45208. if (currentKeyIndex > -1)
  45209. _expandedRowKeys.splice(currentKeyIndex, 1);
  45210. }
  45211. expandedRowKeys.value = _expandedRowKeys;
  45212. emit("update:expandedRowKeys", _expandedRowKeys);
  45213. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  45214. expanded,
  45215. rowData,
  45216. rowIndex,
  45217. rowKey
  45218. });
  45219. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  45220. }
  45221. const flushingRowHeights = debounce(() => {
  45222. var _a, _b, _c, _d;
  45223. isResetting.value = true;
  45224. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  45225. resetAfterIndex(vue.unref(resetIndex), false);
  45226. pendingRowHeights.value = {};
  45227. resetIndex.value = null;
  45228. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  45229. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  45230. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  45231. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  45232. isResetting.value = false;
  45233. }, 0);
  45234. function resetAfterIndex(index, forceUpdate = false) {
  45235. if (!vue.unref(isDynamic))
  45236. return;
  45237. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  45238. const table = vue.unref(tableRef);
  45239. if (table)
  45240. table.resetAfterRowIndex(index, forceUpdate);
  45241. });
  45242. }
  45243. function resetHeights(rowKey, height, rowIdx) {
  45244. const resetIdx = vue.unref(resetIndex);
  45245. if (resetIdx === null) {
  45246. resetIndex.value = rowIdx;
  45247. } else {
  45248. if (resetIdx > rowIdx) {
  45249. resetIndex.value = rowIdx;
  45250. }
  45251. }
  45252. pendingRowHeights.value[rowKey] = height;
  45253. }
  45254. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  45255. if (!fixedDir) {
  45256. mainTableHeights.value[rowKey] = height;
  45257. } else {
  45258. if (fixedDir === FixedDir.RIGHT) {
  45259. rightTableHeights.value[rowKey] = height;
  45260. } else {
  45261. leftTableHeights.value[rowKey] = height;
  45262. }
  45263. }
  45264. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  45265. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  45266. resetHeights(rowKey, maximumHeight, rowIndex);
  45267. flushingRowHeights();
  45268. }
  45269. }
  45270. return {
  45271. hoveringRowKey,
  45272. expandedRowKeys,
  45273. lastRenderedRowIndex,
  45274. isDynamic,
  45275. isResetting,
  45276. rowHeights,
  45277. resetAfterIndex,
  45278. onRowExpanded,
  45279. onRowHovered,
  45280. onRowsRendered,
  45281. onRowHeightChange
  45282. };
  45283. };
  45284. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  45285. const depthMap = vue.ref({});
  45286. const flattenedData = vue.computed(() => {
  45287. const depths = {};
  45288. const { data: data2, rowKey } = props;
  45289. const _expandedRowKeys = vue.unref(expandedRowKeys);
  45290. if (!_expandedRowKeys || !_expandedRowKeys.length)
  45291. return data2;
  45292. const array = [];
  45293. const keysSet = /* @__PURE__ */ new Set();
  45294. _expandedRowKeys.forEach((x) => keysSet.add(x));
  45295. let copy = data2.slice();
  45296. copy.forEach((x) => depths[x[rowKey]] = 0);
  45297. while (copy.length > 0) {
  45298. const item = copy.shift();
  45299. array.push(item);
  45300. if (keysSet.has(item[rowKey]) && Array.isArray(item.children) && item.children.length > 0) {
  45301. copy = [...item.children, ...copy];
  45302. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  45303. }
  45304. }
  45305. depthMap.value = depths;
  45306. return array;
  45307. });
  45308. const data = vue.computed(() => {
  45309. const { data: data2, expandColumnKey } = props;
  45310. return expandColumnKey ? vue.unref(flattenedData) : data2;
  45311. });
  45312. vue.watch(data, (val, prev) => {
  45313. if (val !== prev) {
  45314. lastRenderedRowIndex.value = -1;
  45315. resetAfterIndex(0, true);
  45316. }
  45317. });
  45318. return {
  45319. data,
  45320. depthMap
  45321. };
  45322. };
  45323. const sumReducer = (sum2, num) => sum2 + num;
  45324. const sum = (listLike) => {
  45325. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  45326. };
  45327. const tryCall = (fLike, params, defaultRet = {}) => {
  45328. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  45329. };
  45330. const enforceUnit = (style) => {
  45331. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  45332. style[key] = addUnit(style[key]);
  45333. });
  45334. return style;
  45335. };
  45336. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  45337. const useStyles = (props, {
  45338. columnsTotalWidth,
  45339. data,
  45340. fixedColumnsOnLeft,
  45341. fixedColumnsOnRight
  45342. }) => {
  45343. const bodyWidth = vue.computed(() => {
  45344. const { fixed, width, vScrollbarSize } = props;
  45345. const ret = width - vScrollbarSize;
  45346. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  45347. });
  45348. const headerWidth = vue.computed(() => vue.unref(bodyWidth) + (props.fixed ? props.vScrollbarSize : 0));
  45349. const mainTableHeight = vue.computed(() => {
  45350. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  45351. if (maxHeight > 0) {
  45352. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  45353. const _rowsHeight = vue.unref(rowsHeight);
  45354. const _headerHeight = vue.unref(headerHeight);
  45355. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  45356. return Math.min(total, maxHeight - footerHeight2);
  45357. }
  45358. return height - footerHeight2;
  45359. });
  45360. const rowsHeight = vue.computed(() => {
  45361. const { rowHeight, estimatedRowHeight } = props;
  45362. const _data = vue.unref(data);
  45363. if (isNumber$1(estimatedRowHeight)) {
  45364. return _data.length * estimatedRowHeight;
  45365. }
  45366. return _data.length * rowHeight;
  45367. });
  45368. const fixedTableHeight = vue.computed(() => {
  45369. const { maxHeight } = props;
  45370. const tableHeight = vue.unref(mainTableHeight);
  45371. if (isNumber$1(maxHeight) && maxHeight > 0)
  45372. return tableHeight;
  45373. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  45374. return Math.min(tableHeight, totalHeight);
  45375. });
  45376. const mapColumn = (column) => column.width;
  45377. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  45378. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  45379. const headerHeight = vue.computed(() => sum(props.headerHeight));
  45380. const fixedRowsHeight = vue.computed(() => {
  45381. var _a;
  45382. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  45383. });
  45384. const windowHeight = vue.computed(() => {
  45385. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  45386. });
  45387. const rootStyle = vue.computed(() => {
  45388. const { style = {}, height, width } = props;
  45389. return enforceUnit({
  45390. ...style,
  45391. height,
  45392. width
  45393. });
  45394. });
  45395. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  45396. const emptyStyle = vue.computed(() => ({
  45397. top: addUnit(vue.unref(headerHeight)),
  45398. bottom: addUnit(props.footerHeight),
  45399. width: addUnit(props.width)
  45400. }));
  45401. return {
  45402. bodyWidth,
  45403. fixedTableHeight,
  45404. mainTableHeight,
  45405. leftTableWidth,
  45406. rightTableWidth,
  45407. headerWidth,
  45408. rowsHeight,
  45409. windowHeight,
  45410. footerHeight,
  45411. emptyStyle,
  45412. rootStyle,
  45413. headerHeight
  45414. };
  45415. };
  45416. const useAutoResize = (props) => {
  45417. const sizer = vue.ref();
  45418. const width$ = vue.ref(0);
  45419. const height$ = vue.ref(0);
  45420. let resizerStopper;
  45421. vue.onMounted(() => {
  45422. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  45423. const { width, height } = entry.contentRect;
  45424. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  45425. const left = Number.parseInt(paddingLeft) || 0;
  45426. const right = Number.parseInt(paddingRight) || 0;
  45427. const top = Number.parseInt(paddingTop) || 0;
  45428. const bottom = Number.parseInt(paddingBottom) || 0;
  45429. width$.value = width - left - right;
  45430. height$.value = height - top - bottom;
  45431. }).stop;
  45432. });
  45433. vue.onBeforeUnmount(() => {
  45434. resizerStopper == null ? void 0 : resizerStopper();
  45435. });
  45436. vue.watch([width$, height$], ([width, height]) => {
  45437. var _a;
  45438. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  45439. width,
  45440. height
  45441. });
  45442. });
  45443. return {
  45444. sizer,
  45445. width: width$,
  45446. height: height$
  45447. };
  45448. };
  45449. function useTable(props) {
  45450. const mainTableRef = vue.ref();
  45451. const leftTableRef = vue.ref();
  45452. const rightTableRef = vue.ref();
  45453. const {
  45454. columns,
  45455. columnsStyles,
  45456. columnsTotalWidth,
  45457. fixedColumnsOnLeft,
  45458. fixedColumnsOnRight,
  45459. hasFixedColumns,
  45460. mainColumns,
  45461. onColumnSorted
  45462. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  45463. const {
  45464. scrollTo,
  45465. scrollToLeft,
  45466. scrollToTop,
  45467. scrollToRow,
  45468. onScroll,
  45469. onVerticalScroll,
  45470. scrollPos
  45471. } = useScrollbar(props, {
  45472. mainTableRef,
  45473. leftTableRef,
  45474. rightTableRef,
  45475. onMaybeEndReached
  45476. });
  45477. const {
  45478. expandedRowKeys,
  45479. hoveringRowKey,
  45480. lastRenderedRowIndex,
  45481. isDynamic,
  45482. isResetting,
  45483. rowHeights,
  45484. resetAfterIndex,
  45485. onRowExpanded,
  45486. onRowHeightChange,
  45487. onRowHovered,
  45488. onRowsRendered
  45489. } = useRow(props, {
  45490. mainTableRef,
  45491. leftTableRef,
  45492. rightTableRef
  45493. });
  45494. const { data, depthMap } = useData(props, {
  45495. expandedRowKeys,
  45496. lastRenderedRowIndex,
  45497. resetAfterIndex
  45498. });
  45499. const {
  45500. bodyWidth,
  45501. fixedTableHeight,
  45502. mainTableHeight,
  45503. leftTableWidth,
  45504. rightTableWidth,
  45505. headerWidth,
  45506. rowsHeight,
  45507. windowHeight,
  45508. footerHeight,
  45509. emptyStyle,
  45510. rootStyle,
  45511. headerHeight
  45512. } = useStyles(props, {
  45513. columnsTotalWidth,
  45514. data,
  45515. fixedColumnsOnLeft,
  45516. fixedColumnsOnRight
  45517. });
  45518. const isScrolling = vue.shallowRef(false);
  45519. const containerRef = vue.ref();
  45520. const showEmpty = vue.computed(() => {
  45521. const noData = vue.unref(data).length === 0;
  45522. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  45523. });
  45524. function getRowHeight(rowIndex) {
  45525. const { estimatedRowHeight, rowHeight, rowKey } = props;
  45526. if (!estimatedRowHeight)
  45527. return rowHeight;
  45528. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  45529. }
  45530. function onMaybeEndReached() {
  45531. const { onEndReached } = props;
  45532. if (!onEndReached)
  45533. return;
  45534. const { scrollTop } = vue.unref(scrollPos);
  45535. const _totalHeight = vue.unref(rowsHeight);
  45536. const clientHeight = vue.unref(windowHeight);
  45537. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  45538. if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  45539. onEndReached(heightUntilEnd);
  45540. }
  45541. }
  45542. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  45543. deep: true
  45544. });
  45545. return {
  45546. columns,
  45547. containerRef,
  45548. mainTableRef,
  45549. leftTableRef,
  45550. rightTableRef,
  45551. isDynamic,
  45552. isResetting,
  45553. isScrolling,
  45554. hoveringRowKey,
  45555. hasFixedColumns,
  45556. columnsStyles,
  45557. columnsTotalWidth,
  45558. data,
  45559. expandedRowKeys,
  45560. depthMap,
  45561. fixedColumnsOnLeft,
  45562. fixedColumnsOnRight,
  45563. mainColumns,
  45564. bodyWidth,
  45565. emptyStyle,
  45566. rootStyle,
  45567. headerWidth,
  45568. footerHeight,
  45569. mainTableHeight,
  45570. fixedTableHeight,
  45571. leftTableWidth,
  45572. rightTableWidth,
  45573. showEmpty,
  45574. getRowHeight,
  45575. onColumnSorted,
  45576. onRowHovered,
  45577. onRowExpanded,
  45578. onRowsRendered,
  45579. onRowHeightChange,
  45580. scrollTo,
  45581. scrollToLeft,
  45582. scrollToTop,
  45583. scrollToRow,
  45584. onScroll,
  45585. onVerticalScroll
  45586. };
  45587. }
  45588. const TableV2InjectionKey = Symbol("tableV2");
  45589. const classType = String;
  45590. const columns = {
  45591. type: definePropType(Array),
  45592. required: true
  45593. };
  45594. const fixedDataType = {
  45595. type: definePropType(Array)
  45596. };
  45597. const dataType = {
  45598. ...fixedDataType,
  45599. required: true
  45600. };
  45601. const expandColumnKey = String;
  45602. const expandKeys = {
  45603. type: definePropType(Array),
  45604. default: () => mutable([])
  45605. };
  45606. const requiredNumber = {
  45607. type: Number,
  45608. required: true
  45609. };
  45610. const rowKey = {
  45611. type: definePropType([String, Number, Symbol]),
  45612. default: "id"
  45613. };
  45614. const styleType = {
  45615. type: definePropType(Object)
  45616. };
  45617. const tableV2RowProps = buildProps({
  45618. class: String,
  45619. columns,
  45620. columnsStyles: {
  45621. type: definePropType(Object),
  45622. required: true
  45623. },
  45624. depth: Number,
  45625. expandColumnKey,
  45626. estimatedRowHeight: {
  45627. ...virtualizedGridProps.estimatedRowHeight,
  45628. default: void 0
  45629. },
  45630. isScrolling: Boolean,
  45631. onRowExpand: {
  45632. type: definePropType(Function)
  45633. },
  45634. onRowHover: {
  45635. type: definePropType(Function)
  45636. },
  45637. onRowHeightChange: {
  45638. type: definePropType(Function)
  45639. },
  45640. rowData: {
  45641. type: definePropType(Object),
  45642. required: true
  45643. },
  45644. rowEventHandlers: {
  45645. type: definePropType(Object)
  45646. },
  45647. rowIndex: {
  45648. type: Number,
  45649. required: true
  45650. },
  45651. rowKey,
  45652. style: {
  45653. type: definePropType(Object)
  45654. }
  45655. });
  45656. const requiredNumberType = {
  45657. type: Number,
  45658. required: true
  45659. };
  45660. const tableV2HeaderProps = buildProps({
  45661. class: String,
  45662. columns,
  45663. fixedHeaderData: {
  45664. type: definePropType(Array)
  45665. },
  45666. headerData: {
  45667. type: definePropType(Array),
  45668. required: true
  45669. },
  45670. headerHeight: {
  45671. type: definePropType([Number, Array]),
  45672. default: 50
  45673. },
  45674. rowWidth: requiredNumberType,
  45675. rowHeight: {
  45676. type: Number,
  45677. default: 50
  45678. },
  45679. height: requiredNumberType,
  45680. width: requiredNumberType
  45681. });
  45682. const tableV2GridProps = buildProps({
  45683. columns,
  45684. data: dataType,
  45685. fixedData: fixedDataType,
  45686. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  45687. width: requiredNumber,
  45688. height: requiredNumber,
  45689. headerWidth: requiredNumber,
  45690. headerHeight: tableV2HeaderProps.headerHeight,
  45691. bodyWidth: requiredNumber,
  45692. rowHeight: requiredNumber,
  45693. cache: virtualizedListProps.cache,
  45694. useIsScrolling: Boolean,
  45695. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  45696. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  45697. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  45698. class: classType,
  45699. style: styleType,
  45700. containerStyle: styleType,
  45701. getRowHeight: {
  45702. type: definePropType(Function),
  45703. required: true
  45704. },
  45705. rowKey: tableV2RowProps.rowKey,
  45706. onRowsRendered: {
  45707. type: definePropType(Function)
  45708. },
  45709. onScroll: {
  45710. type: definePropType(Function)
  45711. }
  45712. });
  45713. const tableV2Props = buildProps({
  45714. cache: tableV2GridProps.cache,
  45715. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  45716. rowKey,
  45717. headerClass: {
  45718. type: definePropType([
  45719. String,
  45720. Function
  45721. ])
  45722. },
  45723. headerProps: {
  45724. type: definePropType([
  45725. Object,
  45726. Function
  45727. ])
  45728. },
  45729. headerCellProps: {
  45730. type: definePropType([
  45731. Object,
  45732. Function
  45733. ])
  45734. },
  45735. headerHeight: tableV2HeaderProps.headerHeight,
  45736. footerHeight: {
  45737. type: Number,
  45738. default: 0
  45739. },
  45740. rowClass: {
  45741. type: definePropType([String, Function])
  45742. },
  45743. rowProps: {
  45744. type: definePropType([Object, Function])
  45745. },
  45746. rowHeight: {
  45747. type: Number,
  45748. default: 50
  45749. },
  45750. cellProps: {
  45751. type: definePropType([
  45752. Object,
  45753. Function
  45754. ])
  45755. },
  45756. columns,
  45757. data: dataType,
  45758. dataGetter: {
  45759. type: definePropType(Function)
  45760. },
  45761. fixedData: fixedDataType,
  45762. expandColumnKey: tableV2RowProps.expandColumnKey,
  45763. expandedRowKeys: expandKeys,
  45764. defaultExpandedRowKeys: expandKeys,
  45765. class: classType,
  45766. fixed: Boolean,
  45767. style: {
  45768. type: definePropType(Object)
  45769. },
  45770. width: requiredNumber,
  45771. height: requiredNumber,
  45772. maxHeight: Number,
  45773. useIsScrolling: Boolean,
  45774. indentSize: {
  45775. type: Number,
  45776. default: 12
  45777. },
  45778. iconSize: {
  45779. type: Number,
  45780. default: 12
  45781. },
  45782. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  45783. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  45784. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  45785. sortBy: {
  45786. type: definePropType(Object),
  45787. default: () => ({})
  45788. },
  45789. sortState: {
  45790. type: definePropType(Object),
  45791. default: void 0
  45792. },
  45793. onColumnSort: {
  45794. type: definePropType(Function)
  45795. },
  45796. onExpandedRowsChange: {
  45797. type: definePropType(Function)
  45798. },
  45799. onEndReached: {
  45800. type: definePropType(Function)
  45801. },
  45802. onRowExpand: tableV2RowProps.onRowExpand,
  45803. onScroll: tableV2GridProps.onScroll,
  45804. onRowsRendered: tableV2GridProps.onRowsRendered,
  45805. rowEventHandlers: tableV2RowProps.rowEventHandlers
  45806. });
  45807. const TableV2Cell = (props, {
  45808. slots
  45809. }) => {
  45810. var _a;
  45811. const {
  45812. cellData,
  45813. style
  45814. } = props;
  45815. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  45816. return vue.createVNode("div", {
  45817. "class": props.class,
  45818. "title": displayText,
  45819. "style": style
  45820. }, [slots.default ? slots.default(props) : displayText]);
  45821. };
  45822. TableV2Cell.displayName = "ElTableV2Cell";
  45823. TableV2Cell.inheritAttrs = false;
  45824. var TableCell = TableV2Cell;
  45825. const HeaderCell = (props, {
  45826. slots
  45827. }) => {
  45828. var _a, _b;
  45829. return slots.default ? slots.default(props) : vue.createVNode("div", {
  45830. "class": props.class,
  45831. "title": (_a = props.column) == null ? void 0 : _a.title
  45832. }, [(_b = props.column) == null ? void 0 : _b.title]);
  45833. };
  45834. HeaderCell.displayName = "ElTableV2HeaderCell";
  45835. HeaderCell.inheritAttrs = false;
  45836. var HeaderCell$1 = HeaderCell;
  45837. const tableV2HeaderRowProps = buildProps({
  45838. class: String,
  45839. columns,
  45840. columnsStyles: {
  45841. type: definePropType(Object),
  45842. required: true
  45843. },
  45844. headerIndex: Number,
  45845. style: { type: definePropType(Object) }
  45846. });
  45847. const TableV2HeaderRow = vue.defineComponent({
  45848. name: "ElTableV2HeaderRow",
  45849. props: tableV2HeaderRowProps,
  45850. setup(props, {
  45851. slots
  45852. }) {
  45853. return () => {
  45854. const {
  45855. columns,
  45856. columnsStyles,
  45857. headerIndex,
  45858. style
  45859. } = props;
  45860. let Cells = columns.map((column, columnIndex) => {
  45861. return slots.cell({
  45862. columns,
  45863. column,
  45864. columnIndex,
  45865. headerIndex,
  45866. style: columnsStyles[column.key]
  45867. });
  45868. });
  45869. if (slots.header) {
  45870. Cells = slots.header({
  45871. cells: Cells.map((node) => {
  45872. if (isArray$1(node) && node.length === 1) {
  45873. return node[0];
  45874. }
  45875. return node;
  45876. }),
  45877. columns,
  45878. headerIndex
  45879. });
  45880. }
  45881. return vue.createVNode("div", {
  45882. "class": props.class,
  45883. "style": style,
  45884. "role": "row"
  45885. }, [Cells]);
  45886. };
  45887. }
  45888. });
  45889. var HeaderRow = TableV2HeaderRow;
  45890. const COMPONENT_NAME$7 = "ElTableV2Header";
  45891. const TableV2Header = vue.defineComponent({
  45892. name: COMPONENT_NAME$7,
  45893. props: tableV2HeaderProps,
  45894. setup(props, {
  45895. slots,
  45896. expose
  45897. }) {
  45898. const ns = useNamespace("table-v2");
  45899. const headerRef = vue.ref();
  45900. const headerStyle = vue.computed(() => enforceUnit({
  45901. width: props.width,
  45902. height: props.height
  45903. }));
  45904. const rowStyle = vue.computed(() => enforceUnit({
  45905. width: props.rowWidth,
  45906. height: props.height
  45907. }));
  45908. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  45909. const scrollToLeft = (left) => {
  45910. const headerEl = vue.unref(headerRef);
  45911. vue.nextTick(() => {
  45912. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  45913. left
  45914. });
  45915. });
  45916. };
  45917. const renderFixedRows = () => {
  45918. const fixedRowClassName = ns.e("fixed-header-row");
  45919. const {
  45920. columns,
  45921. fixedHeaderData,
  45922. rowHeight
  45923. } = props;
  45924. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  45925. var _a;
  45926. const style = enforceUnit({
  45927. height: rowHeight,
  45928. width: "100%"
  45929. });
  45930. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  45931. class: fixedRowClassName,
  45932. columns,
  45933. rowData: fixedRowData,
  45934. rowIndex: -(fixedRowIndex + 1),
  45935. style
  45936. });
  45937. });
  45938. };
  45939. const renderDynamicRows = () => {
  45940. const dynamicRowClassName = ns.e("dynamic-header-row");
  45941. const {
  45942. columns
  45943. } = props;
  45944. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  45945. var _a;
  45946. const style = enforceUnit({
  45947. width: "100%",
  45948. height: rowHeight
  45949. });
  45950. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  45951. class: dynamicRowClassName,
  45952. columns,
  45953. headerIndex: rowIndex,
  45954. style
  45955. });
  45956. });
  45957. };
  45958. expose({
  45959. scrollToLeft
  45960. });
  45961. return () => {
  45962. if (props.height <= 0)
  45963. return;
  45964. return vue.createVNode("div", {
  45965. "ref": headerRef,
  45966. "class": props.class,
  45967. "style": vue.unref(headerStyle),
  45968. "role": "rowgroup"
  45969. }, [vue.createVNode("div", {
  45970. "style": vue.unref(rowStyle),
  45971. "class": ns.e("header")
  45972. }, [renderDynamicRows(), renderFixedRows()])]);
  45973. };
  45974. }
  45975. });
  45976. var Header = TableV2Header;
  45977. const useTableRow = (props) => {
  45978. const {
  45979. isScrolling
  45980. } = vue.inject(TableV2InjectionKey);
  45981. const measured = vue.ref(false);
  45982. const rowRef = vue.ref();
  45983. const measurable = vue.computed(() => {
  45984. return isNumber$1(props.estimatedRowHeight) && props.rowIndex >= 0;
  45985. });
  45986. const doMeasure = (isInit = false) => {
  45987. const $rowRef = vue.unref(rowRef);
  45988. if (!$rowRef)
  45989. return;
  45990. const {
  45991. columns,
  45992. onRowHeightChange,
  45993. rowKey,
  45994. rowIndex,
  45995. style
  45996. } = props;
  45997. const {
  45998. height
  45999. } = $rowRef.getBoundingClientRect();
  46000. measured.value = true;
  46001. vue.nextTick(() => {
  46002. if (isInit || height !== Number.parseInt(style.height)) {
  46003. const firstColumn = columns[0];
  46004. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  46005. onRowHeightChange == null ? void 0 : onRowHeightChange({
  46006. rowKey,
  46007. height,
  46008. rowIndex
  46009. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  46010. }
  46011. });
  46012. };
  46013. const eventHandlers = vue.computed(() => {
  46014. const {
  46015. rowData,
  46016. rowIndex,
  46017. rowKey,
  46018. onRowHover
  46019. } = props;
  46020. const handlers = props.rowEventHandlers || {};
  46021. const eventHandlers2 = {};
  46022. Object.entries(handlers).forEach(([eventName, handler]) => {
  46023. if (isFunction$1(handler)) {
  46024. eventHandlers2[eventName] = (event) => {
  46025. handler({
  46026. event,
  46027. rowData,
  46028. rowIndex,
  46029. rowKey
  46030. });
  46031. };
  46032. }
  46033. });
  46034. if (onRowHover) {
  46035. [{
  46036. name: "onMouseleave",
  46037. hovered: false
  46038. }, {
  46039. name: "onMouseenter",
  46040. hovered: true
  46041. }].forEach(({
  46042. name,
  46043. hovered
  46044. }) => {
  46045. const existedHandler = eventHandlers2[name];
  46046. eventHandlers2[name] = (event) => {
  46047. onRowHover({
  46048. event,
  46049. hovered,
  46050. rowData,
  46051. rowIndex,
  46052. rowKey
  46053. });
  46054. existedHandler == null ? void 0 : existedHandler(event);
  46055. };
  46056. });
  46057. }
  46058. return eventHandlers2;
  46059. });
  46060. const onExpand = (expanded) => {
  46061. const {
  46062. onRowExpand,
  46063. rowData,
  46064. rowIndex,
  46065. rowKey
  46066. } = props;
  46067. onRowExpand == null ? void 0 : onRowExpand({
  46068. expanded,
  46069. rowData,
  46070. rowIndex,
  46071. rowKey
  46072. });
  46073. };
  46074. vue.onMounted(() => {
  46075. if (vue.unref(measurable)) {
  46076. doMeasure(true);
  46077. }
  46078. });
  46079. return {
  46080. isScrolling,
  46081. measurable,
  46082. measured,
  46083. rowRef,
  46084. eventHandlers,
  46085. onExpand
  46086. };
  46087. };
  46088. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  46089. const TableV2Row = vue.defineComponent({
  46090. name: COMPONENT_NAME$6,
  46091. props: tableV2RowProps,
  46092. setup(props, {
  46093. expose,
  46094. slots,
  46095. attrs
  46096. }) {
  46097. const {
  46098. eventHandlers,
  46099. isScrolling,
  46100. measurable,
  46101. measured,
  46102. rowRef,
  46103. onExpand
  46104. } = useTableRow(props);
  46105. expose({
  46106. onExpand
  46107. });
  46108. return () => {
  46109. const {
  46110. columns,
  46111. columnsStyles,
  46112. expandColumnKey,
  46113. depth,
  46114. rowData,
  46115. rowIndex,
  46116. style
  46117. } = props;
  46118. let ColumnCells = columns.map((column, columnIndex) => {
  46119. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  46120. return slots.cell({
  46121. column,
  46122. columns,
  46123. columnIndex,
  46124. depth,
  46125. style: columnsStyles[column.key],
  46126. rowData,
  46127. rowIndex,
  46128. isScrolling: vue.unref(isScrolling),
  46129. expandIconProps: expandable ? {
  46130. rowData,
  46131. rowIndex,
  46132. onExpand
  46133. } : void 0
  46134. });
  46135. });
  46136. if (slots.row) {
  46137. ColumnCells = slots.row({
  46138. cells: ColumnCells.map((node) => {
  46139. if (isArray$1(node) && node.length === 1) {
  46140. return node[0];
  46141. }
  46142. return node;
  46143. }),
  46144. style,
  46145. columns,
  46146. depth,
  46147. rowData,
  46148. rowIndex,
  46149. isScrolling: vue.unref(isScrolling)
  46150. });
  46151. }
  46152. if (vue.unref(measurable)) {
  46153. const {
  46154. height,
  46155. ...exceptHeightStyle
  46156. } = style || {};
  46157. const _measured = vue.unref(measured);
  46158. return vue.createVNode("div", vue.mergeProps({
  46159. "ref": rowRef,
  46160. "class": props.class,
  46161. "style": _measured ? style : exceptHeightStyle,
  46162. "role": "row"
  46163. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  46164. }
  46165. return vue.createVNode("div", vue.mergeProps(attrs, {
  46166. "ref": rowRef,
  46167. "class": props.class,
  46168. "style": style,
  46169. "role": "row"
  46170. }, vue.unref(eventHandlers)), [ColumnCells]);
  46171. };
  46172. }
  46173. });
  46174. var Row = TableV2Row;
  46175. const SortIcon = (props) => {
  46176. const {
  46177. sortOrder
  46178. } = props;
  46179. return vue.createVNode(ElIcon, {
  46180. "size": 14,
  46181. "class": props.class
  46182. }, {
  46183. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  46184. });
  46185. };
  46186. var SortIcon$1 = SortIcon;
  46187. const ExpandIcon = (props) => {
  46188. const {
  46189. expanded,
  46190. expandable,
  46191. onExpand,
  46192. style,
  46193. size
  46194. } = props;
  46195. const expandIconProps = {
  46196. onClick: expandable ? () => onExpand(!expanded) : void 0,
  46197. class: props.class
  46198. };
  46199. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  46200. "size": size,
  46201. "style": style
  46202. }), {
  46203. default: () => [vue.createVNode(arrow_right_default, null, null)]
  46204. });
  46205. };
  46206. var ExpandIcon$1 = ExpandIcon;
  46207. const COMPONENT_NAME$5 = "ElTableV2Grid";
  46208. const useTableGrid = (props) => {
  46209. const headerRef = vue.ref();
  46210. const bodyRef = vue.ref();
  46211. const totalHeight = vue.computed(() => {
  46212. const {
  46213. data,
  46214. rowHeight,
  46215. estimatedRowHeight
  46216. } = props;
  46217. if (estimatedRowHeight) {
  46218. return;
  46219. }
  46220. return data.length * rowHeight;
  46221. });
  46222. const fixedRowHeight = vue.computed(() => {
  46223. const {
  46224. fixedData,
  46225. rowHeight
  46226. } = props;
  46227. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  46228. });
  46229. const headerHeight = vue.computed(() => sum(props.headerHeight));
  46230. const gridHeight = vue.computed(() => {
  46231. const {
  46232. height
  46233. } = props;
  46234. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  46235. });
  46236. const hasHeader = vue.computed(() => {
  46237. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  46238. });
  46239. const itemKey = ({
  46240. data,
  46241. rowIndex
  46242. }) => data[rowIndex][props.rowKey];
  46243. function onItemRendered({
  46244. rowCacheStart,
  46245. rowCacheEnd,
  46246. rowVisibleStart,
  46247. rowVisibleEnd
  46248. }) {
  46249. var _a;
  46250. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  46251. rowCacheStart,
  46252. rowCacheEnd,
  46253. rowVisibleStart,
  46254. rowVisibleEnd
  46255. });
  46256. }
  46257. function resetAfterRowIndex(index, forceUpdate2) {
  46258. var _a;
  46259. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  46260. }
  46261. function scrollTo(leftOrOptions, top) {
  46262. const header$ = vue.unref(headerRef);
  46263. const body$ = vue.unref(bodyRef);
  46264. if (!header$ || !body$)
  46265. return;
  46266. if (isObject$1(leftOrOptions)) {
  46267. header$.scrollToLeft(leftOrOptions.scrollLeft);
  46268. body$.scrollTo(leftOrOptions);
  46269. } else {
  46270. header$.scrollToLeft(leftOrOptions);
  46271. body$.scrollTo({
  46272. scrollLeft: leftOrOptions,
  46273. scrollTop: top
  46274. });
  46275. }
  46276. }
  46277. function scrollToTop(scrollTop) {
  46278. var _a;
  46279. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  46280. scrollTop
  46281. });
  46282. }
  46283. function scrollToRow(row, strategy) {
  46284. var _a;
  46285. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  46286. }
  46287. function forceUpdate() {
  46288. var _a, _b;
  46289. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  46290. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  46291. }
  46292. return {
  46293. bodyRef,
  46294. forceUpdate,
  46295. fixedRowHeight,
  46296. gridHeight,
  46297. hasHeader,
  46298. headerHeight,
  46299. headerRef,
  46300. totalHeight,
  46301. itemKey,
  46302. onItemRendered,
  46303. resetAfterRowIndex,
  46304. scrollTo,
  46305. scrollToTop,
  46306. scrollToRow
  46307. };
  46308. };
  46309. const TableGrid = vue.defineComponent({
  46310. name: COMPONENT_NAME$5,
  46311. props: tableV2GridProps,
  46312. setup(props, {
  46313. slots,
  46314. expose
  46315. }) {
  46316. const {
  46317. ns
  46318. } = vue.inject(TableV2InjectionKey);
  46319. const {
  46320. bodyRef,
  46321. fixedRowHeight,
  46322. gridHeight,
  46323. hasHeader,
  46324. headerRef,
  46325. headerHeight,
  46326. totalHeight,
  46327. forceUpdate,
  46328. itemKey,
  46329. onItemRendered,
  46330. resetAfterRowIndex,
  46331. scrollTo,
  46332. scrollToTop,
  46333. scrollToRow
  46334. } = useTableGrid(props);
  46335. expose({
  46336. forceUpdate,
  46337. totalHeight,
  46338. scrollTo,
  46339. scrollToTop,
  46340. scrollToRow,
  46341. resetAfterRowIndex
  46342. });
  46343. const getColumnWidth = () => props.bodyWidth;
  46344. return () => {
  46345. const {
  46346. cache,
  46347. columns,
  46348. data,
  46349. fixedData,
  46350. useIsScrolling,
  46351. scrollbarAlwaysOn,
  46352. scrollbarEndGap,
  46353. scrollbarStartGap,
  46354. style,
  46355. rowHeight,
  46356. bodyWidth,
  46357. estimatedRowHeight,
  46358. headerWidth,
  46359. height,
  46360. width,
  46361. getRowHeight,
  46362. onScroll
  46363. } = props;
  46364. const isDynamicRowEnabled = isNumber$1(estimatedRowHeight);
  46365. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  46366. const _headerHeight = vue.unref(headerHeight);
  46367. return vue.createVNode("div", {
  46368. "role": "table",
  46369. "class": [ns.e("table"), props.class],
  46370. "style": style
  46371. }, [vue.createVNode(Grid, {
  46372. "ref": bodyRef,
  46373. "data": data,
  46374. "useIsScrolling": useIsScrolling,
  46375. "itemKey": itemKey,
  46376. "columnCache": 0,
  46377. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  46378. "totalColumn": 1,
  46379. "totalRow": data.length,
  46380. "rowCache": cache,
  46381. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  46382. "width": width,
  46383. "height": vue.unref(gridHeight),
  46384. "class": ns.e("body"),
  46385. "role": "rowgroup",
  46386. "scrollbarStartGap": scrollbarStartGap,
  46387. "scrollbarEndGap": scrollbarEndGap,
  46388. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  46389. "onScroll": onScroll,
  46390. "onItemRendered": onItemRendered,
  46391. "perfMode": false
  46392. }, {
  46393. default: (params) => {
  46394. var _a;
  46395. const rowData = data[params.rowIndex];
  46396. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  46397. ...params,
  46398. columns,
  46399. rowData
  46400. });
  46401. }
  46402. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  46403. "ref": headerRef,
  46404. "class": ns.e("header-wrapper"),
  46405. "columns": columns,
  46406. "headerData": data,
  46407. "headerHeight": props.headerHeight,
  46408. "fixedHeaderData": fixedData,
  46409. "rowWidth": headerWidth,
  46410. "rowHeight": rowHeight,
  46411. "width": width,
  46412. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  46413. }, {
  46414. dynamic: slots.header,
  46415. fixed: slots.row
  46416. })]);
  46417. };
  46418. }
  46419. });
  46420. function _isSlot$5(s) {
  46421. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  46422. }
  46423. const MainTable = (props, {
  46424. slots
  46425. }) => {
  46426. const {
  46427. mainTableRef,
  46428. ...rest
  46429. } = props;
  46430. return vue.createVNode(TableGrid, vue.mergeProps({
  46431. "ref": mainTableRef
  46432. }, rest), _isSlot$5(slots) ? slots : {
  46433. default: () => [slots]
  46434. });
  46435. };
  46436. function _isSlot$4(s) {
  46437. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  46438. }
  46439. const LeftTable$1 = (props, {
  46440. slots
  46441. }) => {
  46442. if (!props.columns.length)
  46443. return;
  46444. const {
  46445. leftTableRef,
  46446. ...rest
  46447. } = props;
  46448. return vue.createVNode(TableGrid, vue.mergeProps({
  46449. "ref": leftTableRef
  46450. }, rest), _isSlot$4(slots) ? slots : {
  46451. default: () => [slots]
  46452. });
  46453. };
  46454. function _isSlot$3(s) {
  46455. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  46456. }
  46457. const LeftTable = (props, {
  46458. slots
  46459. }) => {
  46460. if (!props.columns.length)
  46461. return;
  46462. const {
  46463. rightTableRef,
  46464. ...rest
  46465. } = props;
  46466. return vue.createVNode(TableGrid, vue.mergeProps({
  46467. "ref": rightTableRef
  46468. }, rest), _isSlot$3(slots) ? slots : {
  46469. default: () => [slots]
  46470. });
  46471. };
  46472. function _isSlot$2(s) {
  46473. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  46474. }
  46475. const RowRenderer = (props, {
  46476. slots
  46477. }) => {
  46478. const {
  46479. columns,
  46480. columnsStyles,
  46481. depthMap,
  46482. expandColumnKey,
  46483. expandedRowKeys,
  46484. estimatedRowHeight,
  46485. hasFixedColumns,
  46486. hoveringRowKey,
  46487. rowData,
  46488. rowIndex,
  46489. style,
  46490. isScrolling,
  46491. rowProps,
  46492. rowClass,
  46493. rowKey,
  46494. rowEventHandlers,
  46495. ns,
  46496. onRowHovered,
  46497. onRowExpanded
  46498. } = props;
  46499. const rowKls = tryCall(rowClass, {
  46500. columns,
  46501. rowData,
  46502. rowIndex
  46503. }, "");
  46504. const additionalProps = tryCall(rowProps, {
  46505. columns,
  46506. rowData,
  46507. rowIndex
  46508. });
  46509. const _rowKey = rowData[rowKey];
  46510. const depth = depthMap[_rowKey] || 0;
  46511. const canExpand = Boolean(expandColumnKey);
  46512. const isFixedRow = rowIndex < 0;
  46513. const kls = [ns.e("row"), rowKls, {
  46514. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  46515. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  46516. [ns.is("hovered")]: !isScrolling && _rowKey === hoveringRowKey,
  46517. [ns.is("fixed")]: !depth && isFixedRow,
  46518. [ns.is("customized")]: Boolean(slots.row)
  46519. }];
  46520. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  46521. const _rowProps = {
  46522. ...additionalProps,
  46523. columns,
  46524. columnsStyles,
  46525. class: kls,
  46526. depth,
  46527. expandColumnKey,
  46528. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  46529. isScrolling,
  46530. rowIndex,
  46531. rowData,
  46532. rowKey: _rowKey,
  46533. rowEventHandlers,
  46534. style
  46535. };
  46536. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  46537. "onRowHover": onRowHover,
  46538. "onRowExpand": onRowExpanded
  46539. }), _isSlot$2(slots) ? slots : {
  46540. default: () => [slots]
  46541. });
  46542. };
  46543. const CellRenderer = ({
  46544. columns,
  46545. column,
  46546. columnIndex,
  46547. depth,
  46548. expandIconProps,
  46549. isScrolling,
  46550. rowData,
  46551. rowIndex,
  46552. style,
  46553. expandedRowKeys,
  46554. ns,
  46555. cellProps: _cellProps,
  46556. expandColumnKey,
  46557. indentSize,
  46558. iconSize,
  46559. rowKey
  46560. }, {
  46561. slots
  46562. }) => {
  46563. const cellStyle = enforceUnit(style);
  46564. if (column.placeholderSign === placeholderSign) {
  46565. return vue.createVNode("div", {
  46566. "class": ns.em("row-cell", "placeholder"),
  46567. "style": cellStyle
  46568. }, null);
  46569. }
  46570. const {
  46571. cellRenderer,
  46572. dataKey,
  46573. dataGetter
  46574. } = column;
  46575. const columnCellRenderer = componentToSlot(cellRenderer);
  46576. const CellComponent = columnCellRenderer || slots.default || ((props) => vue.createVNode(TableCell, props, null));
  46577. const cellData = isFunction$1(dataGetter) ? dataGetter({
  46578. columns,
  46579. column,
  46580. columnIndex,
  46581. rowData,
  46582. rowIndex
  46583. }) : get(rowData, dataKey != null ? dataKey : "");
  46584. const extraCellProps = tryCall(_cellProps, {
  46585. cellData,
  46586. columns,
  46587. column,
  46588. columnIndex,
  46589. rowIndex,
  46590. rowData
  46591. });
  46592. const cellProps = {
  46593. class: ns.e("cell-text"),
  46594. columns,
  46595. column,
  46596. columnIndex,
  46597. cellData,
  46598. isScrolling,
  46599. rowData,
  46600. rowIndex
  46601. };
  46602. const Cell = CellComponent(cellProps);
  46603. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  46604. const expandable = rowIndex >= 0 && column.key === expandColumnKey;
  46605. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  46606. let IconOrPlaceholder;
  46607. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  46608. if (expandable) {
  46609. if (isObject$1(expandIconProps)) {
  46610. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  46611. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  46612. "size": iconSize,
  46613. "expanded": expanded,
  46614. "style": iconStyle,
  46615. "expandable": true
  46616. }), null);
  46617. } else {
  46618. IconOrPlaceholder = vue.createVNode("div", {
  46619. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  46620. }, null);
  46621. }
  46622. }
  46623. return vue.createVNode("div", vue.mergeProps({
  46624. "class": kls,
  46625. "style": cellStyle
  46626. }, extraCellProps, {
  46627. "role": "cell"
  46628. }), [IconOrPlaceholder, Cell]);
  46629. };
  46630. CellRenderer.inheritAttrs = false;
  46631. function _isSlot$1(s) {
  46632. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  46633. }
  46634. const HeaderRenderer = ({
  46635. columns,
  46636. columnsStyles,
  46637. headerIndex,
  46638. style,
  46639. headerClass,
  46640. headerProps,
  46641. ns
  46642. }, {
  46643. slots
  46644. }) => {
  46645. const param = {
  46646. columns,
  46647. headerIndex
  46648. };
  46649. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  46650. [ns.is("customized")]: Boolean(slots.header)
  46651. }];
  46652. const extraProps = {
  46653. ...tryCall(headerProps, param),
  46654. columnsStyles,
  46655. class: kls,
  46656. columns,
  46657. headerIndex,
  46658. style
  46659. };
  46660. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  46661. default: () => [slots]
  46662. });
  46663. };
  46664. const HeaderCellRenderer = (props, {
  46665. slots
  46666. }) => {
  46667. const {
  46668. column,
  46669. ns,
  46670. style,
  46671. onColumnSorted
  46672. } = props;
  46673. const cellStyle = enforceUnit(style);
  46674. if (column.placeholderSign === placeholderSign) {
  46675. return vue.createVNode("div", {
  46676. "class": ns.em("header-row-cell", "placeholder"),
  46677. "style": cellStyle
  46678. }, null);
  46679. }
  46680. const {
  46681. headerCellRenderer,
  46682. headerClass,
  46683. sortable
  46684. } = column;
  46685. const cellProps = {
  46686. ...props,
  46687. class: ns.e("header-cell-text")
  46688. };
  46689. const cellRenderer = componentToSlot(headerCellRenderer) || slots.default || ((props2) => vue.createVNode(HeaderCell$1, props2, null));
  46690. const Cell = cellRenderer(cellProps);
  46691. const {
  46692. sortBy,
  46693. sortState,
  46694. headerCellProps
  46695. } = props;
  46696. let sorting, sortOrder;
  46697. if (sortState) {
  46698. const order = sortState[column.key];
  46699. sorting = Boolean(oppositeOrderMap[order]);
  46700. sortOrder = sorting ? order : SortOrder.ASC;
  46701. } else {
  46702. sorting = column.key === sortBy.key;
  46703. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  46704. }
  46705. 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")];
  46706. const cellWrapperProps = {
  46707. ...tryCall(headerCellProps, props),
  46708. onClick: column.sortable ? onColumnSorted : void 0,
  46709. class: cellKls,
  46710. style: cellStyle,
  46711. ["data-key"]: column.key
  46712. };
  46713. return vue.createVNode("div", vue.mergeProps(cellWrapperProps, {
  46714. "role": "columnheader"
  46715. }), [Cell, sortable && vue.createVNode(SortIcon$1, {
  46716. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  46717. "sortOrder": sortOrder
  46718. }, null)]);
  46719. };
  46720. const Footer$1 = (props, {
  46721. slots
  46722. }) => {
  46723. var _a;
  46724. return vue.createVNode("div", {
  46725. "class": props.class,
  46726. "style": props.style
  46727. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  46728. };
  46729. Footer$1.displayName = "ElTableV2Footer";
  46730. const Footer = (props, {
  46731. slots
  46732. }) => {
  46733. return vue.createVNode("div", {
  46734. "class": props.class,
  46735. "style": props.style
  46736. }, [slots.default ? slots.default() : vue.createVNode(ElEmpty, null, null)]);
  46737. };
  46738. Footer.displayName = "ElTableV2Empty";
  46739. const Overlay = (props, {
  46740. slots
  46741. }) => {
  46742. var _a;
  46743. return vue.createVNode("div", {
  46744. "class": props.class,
  46745. "style": props.style
  46746. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  46747. };
  46748. Overlay.displayName = "ElTableV2Overlay";
  46749. function _isSlot(s) {
  46750. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  46751. }
  46752. const COMPONENT_NAME$4 = "ElTableV2";
  46753. const TableV2 = vue.defineComponent({
  46754. name: COMPONENT_NAME$4,
  46755. props: tableV2Props,
  46756. setup(props, {
  46757. slots,
  46758. expose
  46759. }) {
  46760. const ns = useNamespace("table-v2");
  46761. const {
  46762. columnsStyles,
  46763. fixedColumnsOnLeft,
  46764. fixedColumnsOnRight,
  46765. mainColumns,
  46766. mainTableHeight,
  46767. fixedTableHeight,
  46768. leftTableWidth,
  46769. rightTableWidth,
  46770. data,
  46771. depthMap,
  46772. expandedRowKeys,
  46773. hasFixedColumns,
  46774. hoveringRowKey,
  46775. mainTableRef,
  46776. leftTableRef,
  46777. rightTableRef,
  46778. isDynamic,
  46779. isResetting,
  46780. isScrolling,
  46781. bodyWidth,
  46782. emptyStyle,
  46783. rootStyle,
  46784. headerWidth,
  46785. footerHeight,
  46786. showEmpty,
  46787. scrollTo,
  46788. scrollToLeft,
  46789. scrollToTop,
  46790. scrollToRow,
  46791. getRowHeight,
  46792. onColumnSorted,
  46793. onRowHeightChange,
  46794. onRowHovered,
  46795. onRowExpanded,
  46796. onRowsRendered,
  46797. onScroll,
  46798. onVerticalScroll
  46799. } = useTable(props);
  46800. expose({
  46801. scrollTo,
  46802. scrollToLeft,
  46803. scrollToTop,
  46804. scrollToRow
  46805. });
  46806. vue.provide(TableV2InjectionKey, {
  46807. ns,
  46808. isResetting,
  46809. hoveringRowKey,
  46810. isScrolling
  46811. });
  46812. return () => {
  46813. const {
  46814. cache,
  46815. cellProps,
  46816. estimatedRowHeight,
  46817. expandColumnKey,
  46818. fixedData,
  46819. headerHeight,
  46820. headerClass,
  46821. headerProps,
  46822. headerCellProps,
  46823. sortBy,
  46824. sortState,
  46825. rowHeight,
  46826. rowClass,
  46827. rowEventHandlers,
  46828. rowKey,
  46829. rowProps,
  46830. scrollbarAlwaysOn,
  46831. indentSize,
  46832. iconSize,
  46833. useIsScrolling,
  46834. vScrollbarSize,
  46835. width
  46836. } = props;
  46837. const _data = vue.unref(data);
  46838. const mainTableProps = {
  46839. cache,
  46840. class: ns.e("main"),
  46841. columns: vue.unref(mainColumns),
  46842. data: _data,
  46843. fixedData,
  46844. estimatedRowHeight,
  46845. bodyWidth: vue.unref(bodyWidth),
  46846. headerHeight,
  46847. headerWidth: vue.unref(headerWidth),
  46848. height: vue.unref(mainTableHeight),
  46849. mainTableRef,
  46850. rowKey,
  46851. rowHeight,
  46852. scrollbarAlwaysOn,
  46853. scrollbarStartGap: 2,
  46854. scrollbarEndGap: vScrollbarSize,
  46855. useIsScrolling,
  46856. width,
  46857. getRowHeight,
  46858. onRowsRendered,
  46859. onScroll
  46860. };
  46861. const leftColumnsWidth = vue.unref(leftTableWidth);
  46862. const _fixedTableHeight = vue.unref(fixedTableHeight);
  46863. const leftTableProps = {
  46864. cache,
  46865. class: ns.e("left"),
  46866. columns: vue.unref(fixedColumnsOnLeft),
  46867. data: _data,
  46868. estimatedRowHeight,
  46869. leftTableRef,
  46870. rowHeight,
  46871. bodyWidth: leftColumnsWidth,
  46872. headerWidth: leftColumnsWidth,
  46873. headerHeight,
  46874. height: _fixedTableHeight,
  46875. rowKey,
  46876. scrollbarAlwaysOn,
  46877. scrollbarStartGap: 2,
  46878. scrollbarEndGap: vScrollbarSize,
  46879. useIsScrolling,
  46880. width: leftColumnsWidth,
  46881. getRowHeight,
  46882. onScroll: onVerticalScroll
  46883. };
  46884. const rightColumnsWidth = vue.unref(rightTableWidth);
  46885. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  46886. const rightTableProps = {
  46887. cache,
  46888. class: ns.e("right"),
  46889. columns: vue.unref(fixedColumnsOnRight),
  46890. data: _data,
  46891. estimatedRowHeight,
  46892. rightTableRef,
  46893. rowHeight,
  46894. bodyWidth: rightColumnsWidthWithScrollbar,
  46895. headerWidth: rightColumnsWidthWithScrollbar,
  46896. headerHeight,
  46897. height: _fixedTableHeight,
  46898. rowKey,
  46899. scrollbarAlwaysOn,
  46900. scrollbarStartGap: 2,
  46901. scrollbarEndGap: vScrollbarSize,
  46902. width: rightColumnsWidthWithScrollbar,
  46903. style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  46904. useIsScrolling,
  46905. getRowHeight,
  46906. onScroll: onVerticalScroll
  46907. };
  46908. const _columnsStyles = vue.unref(columnsStyles);
  46909. const tableRowProps = {
  46910. ns,
  46911. depthMap: vue.unref(depthMap),
  46912. columnsStyles: _columnsStyles,
  46913. expandColumnKey,
  46914. expandedRowKeys: vue.unref(expandedRowKeys),
  46915. estimatedRowHeight,
  46916. hasFixedColumns: vue.unref(hasFixedColumns),
  46917. hoveringRowKey: vue.unref(hoveringRowKey),
  46918. rowProps,
  46919. rowClass,
  46920. rowKey,
  46921. rowEventHandlers,
  46922. onRowHovered,
  46923. onRowExpanded,
  46924. onRowHeightChange
  46925. };
  46926. const tableCellProps = {
  46927. cellProps,
  46928. expandColumnKey,
  46929. indentSize,
  46930. iconSize,
  46931. rowKey,
  46932. expandedRowKeys: vue.unref(expandedRowKeys),
  46933. ns
  46934. };
  46935. const tableHeaderProps = {
  46936. ns,
  46937. headerClass,
  46938. headerProps,
  46939. columnsStyles: _columnsStyles
  46940. };
  46941. const tableHeaderCellProps = {
  46942. ns,
  46943. sortBy,
  46944. sortState,
  46945. headerCellProps,
  46946. onColumnSorted
  46947. };
  46948. const tableSlots = {
  46949. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  46950. row: slots.row,
  46951. cell: (props3) => {
  46952. let _slot;
  46953. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  46954. "style": _columnsStyles[props3.column.key]
  46955. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  46956. default: () => [_slot]
  46957. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  46958. "style": _columnsStyles[props3.column.key]
  46959. }), null);
  46960. }
  46961. }),
  46962. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  46963. header: slots.header,
  46964. cell: (props3) => {
  46965. let _slot2;
  46966. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  46967. "style": _columnsStyles[props3.column.key]
  46968. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  46969. default: () => [_slot2]
  46970. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  46971. "style": _columnsStyles[props3.column.key]
  46972. }), null);
  46973. }
  46974. })
  46975. };
  46976. const rootKls = [props.class, ns.b(), ns.e("root"), {
  46977. [ns.is("dynamic")]: vue.unref(isDynamic)
  46978. }];
  46979. const footerProps = {
  46980. class: ns.e("footer"),
  46981. style: vue.unref(footerHeight)
  46982. };
  46983. return vue.createVNode("div", {
  46984. "class": rootKls,
  46985. "style": vue.unref(rootStyle)
  46986. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  46987. default: () => [tableSlots]
  46988. }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  46989. default: () => [tableSlots]
  46990. }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  46991. default: () => [tableSlots]
  46992. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  46993. default: slots.footer
  46994. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  46995. "class": ns.e("empty"),
  46996. "style": vue.unref(emptyStyle)
  46997. }, {
  46998. default: slots.empty
  46999. }), slots.overlay && vue.createVNode(Overlay, {
  47000. "class": ns.e("overlay")
  47001. }, {
  47002. default: slots.overlay
  47003. })]);
  47004. };
  47005. }
  47006. });
  47007. var TableV2$1 = TableV2;
  47008. const autoResizerProps = buildProps({
  47009. disableWidth: Boolean,
  47010. disableHeight: Boolean,
  47011. onResize: {
  47012. type: definePropType(Function)
  47013. }
  47014. });
  47015. const AutoResizer = vue.defineComponent({
  47016. name: "ElAutoResizer",
  47017. props: autoResizerProps,
  47018. setup(props, {
  47019. slots
  47020. }) {
  47021. const ns = useNamespace("auto-resizer");
  47022. const {
  47023. height,
  47024. width,
  47025. sizer
  47026. } = useAutoResize(props);
  47027. const style = {
  47028. width: "100%",
  47029. height: "100%"
  47030. };
  47031. return () => {
  47032. var _a;
  47033. return vue.createVNode("div", {
  47034. "ref": sizer,
  47035. "class": ns.b(),
  47036. "style": style
  47037. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  47038. height: height.value,
  47039. width: width.value
  47040. })]);
  47041. };
  47042. }
  47043. });
  47044. const ElTableV2 = withInstall(TableV2$1);
  47045. const ElAutoResizer = withInstall(AutoResizer);
  47046. const tabsRootContextKey = Symbol("tabsRootContextKey");
  47047. const tabBarProps = buildProps({
  47048. tabs: {
  47049. type: definePropType(Array),
  47050. default: () => mutable([])
  47051. }
  47052. });
  47053. const COMPONENT_NAME$3 = "ElTabBar";
  47054. const __default__$k = vue.defineComponent({
  47055. name: COMPONENT_NAME$3
  47056. });
  47057. const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
  47058. ...__default__$k,
  47059. props: tabBarProps,
  47060. setup(__props, { expose }) {
  47061. const props = __props;
  47062. const instance = vue.getCurrentInstance();
  47063. const rootTabs = vue.inject(tabsRootContextKey);
  47064. if (!rootTabs)
  47065. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  47066. const ns = useNamespace("tabs");
  47067. const barRef = vue.ref();
  47068. const barStyle = vue.ref();
  47069. const getBarStyle = () => {
  47070. let offset = 0;
  47071. let tabSize = 0;
  47072. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  47073. const sizeDir = sizeName === "width" ? "x" : "y";
  47074. const position = sizeDir === "x" ? "left" : "top";
  47075. props.tabs.every((tab) => {
  47076. var _a, _b;
  47077. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  47078. if (!$el)
  47079. return false;
  47080. if (!tab.active) {
  47081. return true;
  47082. }
  47083. offset = $el[`offset${capitalize(position)}`];
  47084. tabSize = $el[`client${capitalize(sizeName)}`];
  47085. const tabStyles = window.getComputedStyle($el);
  47086. if (sizeName === "width") {
  47087. if (props.tabs.length > 1) {
  47088. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  47089. }
  47090. offset += Number.parseFloat(tabStyles.paddingLeft);
  47091. }
  47092. return false;
  47093. });
  47094. return {
  47095. [sizeName]: `${tabSize}px`,
  47096. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  47097. };
  47098. };
  47099. const update = () => barStyle.value = getBarStyle();
  47100. vue.watch(() => props.tabs, async () => {
  47101. await vue.nextTick();
  47102. update();
  47103. }, { immediate: true });
  47104. useResizeObserver(barRef, () => update());
  47105. expose({
  47106. ref: barRef,
  47107. update
  47108. });
  47109. return (_ctx, _cache) => {
  47110. return vue.openBlock(), vue.createElementBlock("div", {
  47111. ref_key: "barRef",
  47112. ref: barRef,
  47113. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  47114. style: vue.normalizeStyle(barStyle.value)
  47115. }, null, 6);
  47116. };
  47117. }
  47118. });
  47119. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tab-bar.vue"]]);
  47120. const tabNavProps = buildProps({
  47121. panes: {
  47122. type: definePropType(Array),
  47123. default: () => mutable([])
  47124. },
  47125. currentName: {
  47126. type: [String, Number],
  47127. default: ""
  47128. },
  47129. editable: Boolean,
  47130. type: {
  47131. type: String,
  47132. values: ["card", "border-card", ""],
  47133. default: ""
  47134. },
  47135. stretch: Boolean
  47136. });
  47137. const tabNavEmits = {
  47138. tabClick: (tab, tabName, ev) => ev instanceof Event,
  47139. tabRemove: (tab, ev) => ev instanceof Event
  47140. };
  47141. const COMPONENT_NAME$2 = "ElTabNav";
  47142. const TabNav = vue.defineComponent({
  47143. name: COMPONENT_NAME$2,
  47144. props: tabNavProps,
  47145. emits: tabNavEmits,
  47146. setup(props, {
  47147. expose,
  47148. emit
  47149. }) {
  47150. const vm = vue.getCurrentInstance();
  47151. const rootTabs = vue.inject(tabsRootContextKey);
  47152. if (!rootTabs)
  47153. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  47154. const ns = useNamespace("tabs");
  47155. const visibility = useDocumentVisibility();
  47156. const focused = useWindowFocus();
  47157. const navScroll$ = vue.ref();
  47158. const nav$ = vue.ref();
  47159. const el$ = vue.ref();
  47160. const tabBarRef = vue.ref();
  47161. const scrollable = vue.ref(false);
  47162. const navOffset = vue.ref(0);
  47163. const isFocus = vue.ref(false);
  47164. const focusable = vue.ref(true);
  47165. const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  47166. const navStyle = vue.computed(() => {
  47167. const dir = sizeName.value === "width" ? "X" : "Y";
  47168. return {
  47169. transform: `translate${dir}(-${navOffset.value}px)`
  47170. };
  47171. });
  47172. const scrollPrev = () => {
  47173. if (!navScroll$.value)
  47174. return;
  47175. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  47176. const currentOffset = navOffset.value;
  47177. if (!currentOffset)
  47178. return;
  47179. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  47180. navOffset.value = newOffset;
  47181. };
  47182. const scrollNext = () => {
  47183. if (!navScroll$.value || !nav$.value)
  47184. return;
  47185. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  47186. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  47187. const currentOffset = navOffset.value;
  47188. if (navSize - currentOffset <= containerSize)
  47189. return;
  47190. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  47191. navOffset.value = newOffset;
  47192. };
  47193. const scrollToActiveTab = async () => {
  47194. const nav = nav$.value;
  47195. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  47196. return;
  47197. await vue.nextTick();
  47198. const activeTab = el$.value.querySelector(".is-active");
  47199. if (!activeTab)
  47200. return;
  47201. const navScroll = navScroll$.value;
  47202. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  47203. const activeTabBounding = activeTab.getBoundingClientRect();
  47204. const navScrollBounding = navScroll.getBoundingClientRect();
  47205. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  47206. const currentOffset = navOffset.value;
  47207. let newOffset = currentOffset;
  47208. if (isHorizontal) {
  47209. if (activeTabBounding.left < navScrollBounding.left) {
  47210. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  47211. }
  47212. if (activeTabBounding.right > navScrollBounding.right) {
  47213. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  47214. }
  47215. } else {
  47216. if (activeTabBounding.top < navScrollBounding.top) {
  47217. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  47218. }
  47219. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  47220. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  47221. }
  47222. }
  47223. newOffset = Math.max(newOffset, 0);
  47224. navOffset.value = Math.min(newOffset, maxOffset);
  47225. };
  47226. const update = () => {
  47227. var _a;
  47228. if (!nav$.value || !navScroll$.value)
  47229. return;
  47230. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  47231. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  47232. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  47233. const currentOffset = navOffset.value;
  47234. if (containerSize < navSize) {
  47235. scrollable.value = scrollable.value || {};
  47236. scrollable.value.prev = currentOffset;
  47237. scrollable.value.next = currentOffset + containerSize < navSize;
  47238. if (navSize - currentOffset < containerSize) {
  47239. navOffset.value = navSize - containerSize;
  47240. }
  47241. } else {
  47242. scrollable.value = false;
  47243. if (currentOffset > 0) {
  47244. navOffset.value = 0;
  47245. }
  47246. }
  47247. };
  47248. const changeTab = (e) => {
  47249. const code = e.code;
  47250. const {
  47251. up,
  47252. down,
  47253. left,
  47254. right
  47255. } = EVENT_CODE;
  47256. if (![up, down, left, right].includes(code))
  47257. return;
  47258. const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  47259. const currentIndex = tabList.indexOf(e.target);
  47260. let nextIndex;
  47261. if (code === left || code === up) {
  47262. if (currentIndex === 0) {
  47263. nextIndex = tabList.length - 1;
  47264. } else {
  47265. nextIndex = currentIndex - 1;
  47266. }
  47267. } else {
  47268. if (currentIndex < tabList.length - 1) {
  47269. nextIndex = currentIndex + 1;
  47270. } else {
  47271. nextIndex = 0;
  47272. }
  47273. }
  47274. tabList[nextIndex].focus({
  47275. preventScroll: true
  47276. });
  47277. tabList[nextIndex].click();
  47278. setFocus();
  47279. };
  47280. const setFocus = () => {
  47281. if (focusable.value)
  47282. isFocus.value = true;
  47283. };
  47284. const removeFocus = () => isFocus.value = false;
  47285. vue.watch(visibility, (visibility2) => {
  47286. if (visibility2 === "hidden") {
  47287. focusable.value = false;
  47288. } else if (visibility2 === "visible") {
  47289. setTimeout(() => focusable.value = true, 50);
  47290. }
  47291. });
  47292. vue.watch(focused, (focused2) => {
  47293. if (focused2) {
  47294. setTimeout(() => focusable.value = true, 50);
  47295. } else {
  47296. focusable.value = false;
  47297. }
  47298. });
  47299. useResizeObserver(el$, update);
  47300. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  47301. vue.onUpdated(() => update());
  47302. expose({
  47303. scrollToActiveTab,
  47304. removeFocus
  47305. });
  47306. vue.watch(() => props.panes, () => vm.update(), {
  47307. flush: "post",
  47308. deep: true
  47309. });
  47310. return () => {
  47311. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  47312. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  47313. "onClick": scrollPrev
  47314. }, [vue.createVNode(ElIcon, null, {
  47315. default: () => [vue.createVNode(arrow_left_default, null, null)]
  47316. })]), vue.createVNode("span", {
  47317. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  47318. "onClick": scrollNext
  47319. }, [vue.createVNode(ElIcon, null, {
  47320. default: () => [vue.createVNode(arrow_right_default, null, null)]
  47321. })])] : null;
  47322. const tabs = props.panes.map((pane, index) => {
  47323. var _a, _b, _c, _d;
  47324. const uid = pane.uid;
  47325. const disabled = pane.props.disabled;
  47326. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  47327. const closable = !disabled && (pane.isClosable || props.editable);
  47328. pane.index = `${index}`;
  47329. const btnClose = closable ? vue.createVNode(ElIcon, {
  47330. "class": "is-icon-close",
  47331. "onClick": (ev) => emit("tabRemove", pane, ev)
  47332. }, {
  47333. default: () => [vue.createVNode(close_default, null, null)]
  47334. }) : null;
  47335. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  47336. const tabindex = !disabled && pane.active ? 0 : -1;
  47337. return vue.createVNode("div", {
  47338. "ref": `tab-${uid}`,
  47339. "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)],
  47340. "id": `tab-${tabName}`,
  47341. "key": `tab-${uid}`,
  47342. "aria-controls": `pane-${tabName}`,
  47343. "role": "tab",
  47344. "aria-selected": pane.active,
  47345. "tabindex": tabindex,
  47346. "onFocus": () => setFocus(),
  47347. "onBlur": () => removeFocus(),
  47348. "onClick": (ev) => {
  47349. removeFocus();
  47350. emit("tabClick", pane, tabName, ev);
  47351. },
  47352. "onKeydown": (ev) => {
  47353. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  47354. emit("tabRemove", pane, ev);
  47355. }
  47356. }
  47357. }, [...[tabLabelContent, btnClose]]);
  47358. });
  47359. return vue.createVNode("div", {
  47360. "ref": el$,
  47361. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  47362. }, [scrollBtn, vue.createVNode("div", {
  47363. "class": ns.e("nav-scroll"),
  47364. "ref": navScroll$
  47365. }, [vue.createVNode("div", {
  47366. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  47367. "ref": nav$,
  47368. "style": navStyle.value,
  47369. "role": "tablist",
  47370. "onKeydown": changeTab
  47371. }, [...[!props.type ? vue.createVNode(TabBar, {
  47372. "ref": tabBarRef,
  47373. "tabs": [...props.panes]
  47374. }, null) : null, tabs]])])]);
  47375. };
  47376. }
  47377. });
  47378. const tabsProps = buildProps({
  47379. type: {
  47380. type: String,
  47381. values: ["card", "border-card", ""],
  47382. default: ""
  47383. },
  47384. activeName: {
  47385. type: [String, Number]
  47386. },
  47387. closable: Boolean,
  47388. addable: Boolean,
  47389. modelValue: {
  47390. type: [String, Number]
  47391. },
  47392. editable: Boolean,
  47393. tabPosition: {
  47394. type: String,
  47395. values: ["top", "right", "bottom", "left"],
  47396. default: "top"
  47397. },
  47398. beforeLeave: {
  47399. type: definePropType(Function),
  47400. default: () => true
  47401. },
  47402. stretch: Boolean
  47403. });
  47404. const isPaneName = (value) => isString$1(value) || isNumber$1(value);
  47405. const tabsEmits = {
  47406. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  47407. tabClick: (pane, ev) => ev instanceof Event,
  47408. tabChange: (name) => isPaneName(name),
  47409. edit: (paneName, action) => ["remove", "add"].includes(action),
  47410. tabRemove: (name) => isPaneName(name),
  47411. tabAdd: () => true
  47412. };
  47413. var Tabs = vue.defineComponent({
  47414. name: "ElTabs",
  47415. props: tabsProps,
  47416. emits: tabsEmits,
  47417. setup(props, {
  47418. emit,
  47419. slots,
  47420. expose
  47421. }) {
  47422. var _a, _b;
  47423. const ns = useNamespace("tabs");
  47424. const {
  47425. children: panes,
  47426. addChild: registerPane,
  47427. removeChild: unregisterPane
  47428. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  47429. const nav$ = vue.ref();
  47430. const currentName = vue.ref((_b = (_a = props.modelValue) != null ? _a : props.activeName) != null ? _b : "0");
  47431. const changeCurrentName = (value) => {
  47432. currentName.value = value;
  47433. emit(UPDATE_MODEL_EVENT, value);
  47434. emit("tabChange", value);
  47435. };
  47436. const setCurrentName = async (value) => {
  47437. var _a2, _b2, _c;
  47438. if (currentName.value === value || isUndefined(value))
  47439. return;
  47440. try {
  47441. const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value));
  47442. if (canLeave !== false) {
  47443. changeCurrentName(value);
  47444. (_c = (_b2 = nav$.value) == null ? void 0 : _b2.removeFocus) == null ? void 0 : _c.call(_b2);
  47445. }
  47446. } catch (e) {
  47447. }
  47448. };
  47449. const handleTabClick = (tab, tabName, event) => {
  47450. if (tab.props.disabled)
  47451. return;
  47452. setCurrentName(tabName);
  47453. emit("tabClick", tab, event);
  47454. };
  47455. const handleTabRemove = (pane, ev) => {
  47456. if (pane.props.disabled || isUndefined(pane.props.name))
  47457. return;
  47458. ev.stopPropagation();
  47459. emit("edit", pane.props.name, "remove");
  47460. emit("tabRemove", pane.props.name);
  47461. };
  47462. const handleTabAdd = () => {
  47463. emit("edit", void 0, "add");
  47464. emit("tabAdd");
  47465. };
  47466. useDeprecated({
  47467. from: '"activeName"',
  47468. replacement: '"model-value" or "v-model"',
  47469. scope: "ElTabs",
  47470. version: "2.3.0",
  47471. ref: "https://element-plus.org/en-US/component/tabs.html#attributes",
  47472. type: "Attribute"
  47473. }, vue.computed(() => !!props.activeName));
  47474. vue.watch(() => props.activeName, (modelValue) => setCurrentName(modelValue));
  47475. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  47476. vue.watch(currentName, async () => {
  47477. var _a2;
  47478. await vue.nextTick();
  47479. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  47480. });
  47481. vue.provide(tabsRootContextKey, {
  47482. props,
  47483. currentName,
  47484. registerPane,
  47485. unregisterPane
  47486. });
  47487. expose({
  47488. currentName
  47489. });
  47490. return () => {
  47491. const newButton = props.editable || props.addable ? vue.createVNode("span", {
  47492. "class": ns.e("new-tab"),
  47493. "tabindex": "0",
  47494. "onClick": handleTabAdd,
  47495. "onKeydown": (ev) => {
  47496. if (ev.code === EVENT_CODE.enter)
  47497. handleTabAdd();
  47498. }
  47499. }, [vue.createVNode(ElIcon, {
  47500. "class": ns.is("icon-plus")
  47501. }, {
  47502. default: () => [vue.createVNode(plus_default, null, null)]
  47503. })]) : null;
  47504. const header = vue.createVNode("div", {
  47505. "class": [ns.e("header"), ns.is(props.tabPosition)]
  47506. }, [newButton, vue.createVNode(TabNav, {
  47507. "ref": nav$,
  47508. "currentName": currentName.value,
  47509. "editable": props.editable,
  47510. "type": props.type,
  47511. "panes": panes.value,
  47512. "stretch": props.stretch,
  47513. "onTabClick": handleTabClick,
  47514. "onTabRemove": handleTabRemove
  47515. }, null)]);
  47516. const panels = vue.createVNode("div", {
  47517. "class": ns.e("content")
  47518. }, [vue.renderSlot(slots, "default")]);
  47519. return vue.createVNode("div", {
  47520. "class": [ns.b(), ns.m(props.tabPosition), {
  47521. [ns.m("card")]: props.type === "card",
  47522. [ns.m("border-card")]: props.type === "border-card"
  47523. }]
  47524. }, [...props.tabPosition !== "bottom" ? [header, panels] : [panels, header]]);
  47525. };
  47526. }
  47527. });
  47528. const tabPaneProps = buildProps({
  47529. label: {
  47530. type: String,
  47531. default: ""
  47532. },
  47533. name: {
  47534. type: [String, Number]
  47535. },
  47536. closable: Boolean,
  47537. disabled: Boolean,
  47538. lazy: Boolean
  47539. });
  47540. const _hoisted_1$a = ["id", "aria-hidden", "aria-labelledby"];
  47541. const COMPONENT_NAME$1 = "ElTabPane";
  47542. const __default__$j = vue.defineComponent({
  47543. name: COMPONENT_NAME$1
  47544. });
  47545. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  47546. ...__default__$j,
  47547. props: tabPaneProps,
  47548. setup(__props) {
  47549. const props = __props;
  47550. const instance = vue.getCurrentInstance();
  47551. const slots = vue.useSlots();
  47552. const tabsRoot = vue.inject(tabsRootContextKey);
  47553. if (!tabsRoot)
  47554. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  47555. const ns = useNamespace("tab-pane");
  47556. const index = vue.ref();
  47557. const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
  47558. const active = computedEager(() => {
  47559. var _a;
  47560. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  47561. });
  47562. const loaded = vue.ref(active.value);
  47563. const paneName = vue.computed(() => {
  47564. var _a;
  47565. return (_a = props.name) != null ? _a : index.value;
  47566. });
  47567. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  47568. vue.watch(active, (val) => {
  47569. if (val)
  47570. loaded.value = true;
  47571. });
  47572. const pane = vue.reactive({
  47573. uid: instance.uid,
  47574. slots,
  47575. props,
  47576. paneName,
  47577. active,
  47578. index,
  47579. isClosable
  47580. });
  47581. vue.onMounted(() => {
  47582. tabsRoot.registerPane(pane);
  47583. });
  47584. vue.onUnmounted(() => {
  47585. tabsRoot.unregisterPane(pane.uid);
  47586. });
  47587. return (_ctx, _cache) => {
  47588. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  47589. key: 0,
  47590. id: `pane-${vue.unref(paneName)}`,
  47591. class: vue.normalizeClass(vue.unref(ns).b()),
  47592. role: "tabpanel",
  47593. "aria-hidden": !vue.unref(active),
  47594. "aria-labelledby": `tab-${vue.unref(paneName)}`
  47595. }, [
  47596. vue.renderSlot(_ctx.$slots, "default")
  47597. ], 10, _hoisted_1$a)), [
  47598. [vue.vShow, vue.unref(active)]
  47599. ]) : vue.createCommentVNode("v-if", true);
  47600. };
  47601. }
  47602. });
  47603. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "tab-pane.vue"]]);
  47604. const ElTabs = withInstall(Tabs, {
  47605. TabPane
  47606. });
  47607. const ElTabPane = withNoopInstall(TabPane);
  47608. const textProps = buildProps({
  47609. type: {
  47610. type: String,
  47611. values: ["primary", "success", "info", "warning", "danger", ""],
  47612. default: ""
  47613. },
  47614. size: {
  47615. type: String,
  47616. values: componentSizes,
  47617. default: ""
  47618. },
  47619. truncated: {
  47620. type: Boolean
  47621. },
  47622. tag: {
  47623. type: String,
  47624. default: "span"
  47625. }
  47626. });
  47627. const __default__$i = vue.defineComponent({
  47628. name: "ElText"
  47629. });
  47630. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  47631. ...__default__$i,
  47632. props: textProps,
  47633. setup(__props) {
  47634. const props = __props;
  47635. const textSize = useFormSize();
  47636. const ns = useNamespace("text");
  47637. const textKls = vue.computed(() => [
  47638. ns.b(),
  47639. ns.m(props.type),
  47640. ns.m(textSize.value),
  47641. ns.is("truncated", props.truncated)
  47642. ]);
  47643. return (_ctx, _cache) => {
  47644. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  47645. class: vue.normalizeClass(vue.unref(textKls))
  47646. }, {
  47647. default: vue.withCtx(() => [
  47648. vue.renderSlot(_ctx.$slots, "default")
  47649. ]),
  47650. _: 3
  47651. }, 8, ["class"]);
  47652. };
  47653. }
  47654. });
  47655. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "text.vue"]]);
  47656. const ElText = withInstall(Text);
  47657. const timeSelectProps = buildProps({
  47658. format: {
  47659. type: String,
  47660. default: "HH:mm"
  47661. },
  47662. modelValue: String,
  47663. disabled: Boolean,
  47664. editable: {
  47665. type: Boolean,
  47666. default: true
  47667. },
  47668. effect: {
  47669. type: String,
  47670. default: "light"
  47671. },
  47672. clearable: {
  47673. type: Boolean,
  47674. default: true
  47675. },
  47676. size: useSizeProp,
  47677. placeholder: String,
  47678. start: {
  47679. type: String,
  47680. default: "09:00"
  47681. },
  47682. end: {
  47683. type: String,
  47684. default: "18:00"
  47685. },
  47686. step: {
  47687. type: String,
  47688. default: "00:30"
  47689. },
  47690. minTime: String,
  47691. maxTime: String,
  47692. name: String,
  47693. prefixIcon: {
  47694. type: definePropType([String, Object]),
  47695. default: () => clock_default
  47696. },
  47697. clearIcon: {
  47698. type: definePropType([String, Object]),
  47699. default: () => circle_close_default
  47700. }
  47701. });
  47702. const parseTime = (time) => {
  47703. const values = (time || "").split(":");
  47704. if (values.length >= 2) {
  47705. let hours = Number.parseInt(values[0], 10);
  47706. const minutes = Number.parseInt(values[1], 10);
  47707. const timeUpper = time.toUpperCase();
  47708. if (timeUpper.includes("AM") && hours === 12) {
  47709. hours = 0;
  47710. } else if (timeUpper.includes("PM") && hours !== 12) {
  47711. hours += 12;
  47712. }
  47713. return {
  47714. hours,
  47715. minutes
  47716. };
  47717. }
  47718. return null;
  47719. };
  47720. const compareTime = (time1, time2) => {
  47721. const value1 = parseTime(time1);
  47722. if (!value1)
  47723. return -1;
  47724. const value2 = parseTime(time2);
  47725. if (!value2)
  47726. return -1;
  47727. const minutes1 = value1.minutes + value1.hours * 60;
  47728. const minutes2 = value2.minutes + value2.hours * 60;
  47729. if (minutes1 === minutes2) {
  47730. return 0;
  47731. }
  47732. return minutes1 > minutes2 ? 1 : -1;
  47733. };
  47734. const padTime = (time) => {
  47735. return `${time}`.padStart(2, "0");
  47736. };
  47737. const formatTime = (time) => {
  47738. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  47739. };
  47740. const nextTime = (time, step) => {
  47741. const timeValue = parseTime(time);
  47742. if (!timeValue)
  47743. return "";
  47744. const stepValue = parseTime(step);
  47745. if (!stepValue)
  47746. return "";
  47747. const next = {
  47748. hours: timeValue.hours,
  47749. minutes: timeValue.minutes
  47750. };
  47751. next.minutes += stepValue.minutes;
  47752. next.hours += stepValue.hours;
  47753. next.hours += Math.floor(next.minutes / 60);
  47754. next.minutes = next.minutes % 60;
  47755. return formatTime(next);
  47756. };
  47757. const __default__$h = vue.defineComponent({
  47758. name: "ElTimeSelect"
  47759. });
  47760. const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
  47761. ...__default__$h,
  47762. props: timeSelectProps,
  47763. emits: ["change", "blur", "focus", "update:modelValue"],
  47764. setup(__props, { expose }) {
  47765. const props = __props;
  47766. dayjs.extend(customParseFormat);
  47767. const { Option: ElOption } = ElSelect;
  47768. const nsInput = useNamespace("input");
  47769. const select = vue.ref();
  47770. const _disabled = useFormDisabled();
  47771. const value = vue.computed(() => props.modelValue);
  47772. const start = vue.computed(() => {
  47773. const time = parseTime(props.start);
  47774. return time ? formatTime(time) : null;
  47775. });
  47776. const end = vue.computed(() => {
  47777. const time = parseTime(props.end);
  47778. return time ? formatTime(time) : null;
  47779. });
  47780. const step = vue.computed(() => {
  47781. const time = parseTime(props.step);
  47782. return time ? formatTime(time) : null;
  47783. });
  47784. const minTime = vue.computed(() => {
  47785. const time = parseTime(props.minTime || "");
  47786. return time ? formatTime(time) : null;
  47787. });
  47788. const maxTime = vue.computed(() => {
  47789. const time = parseTime(props.maxTime || "");
  47790. return time ? formatTime(time) : null;
  47791. });
  47792. const items = vue.computed(() => {
  47793. const result = [];
  47794. if (props.start && props.end && props.step) {
  47795. let current = start.value;
  47796. let currentTime;
  47797. while (current && end.value && compareTime(current, end.value) <= 0) {
  47798. currentTime = dayjs(current, "HH:mm").format(props.format);
  47799. result.push({
  47800. value: currentTime,
  47801. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  47802. });
  47803. current = nextTime(current, step.value);
  47804. }
  47805. }
  47806. return result;
  47807. });
  47808. const blur = () => {
  47809. var _a, _b;
  47810. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  47811. };
  47812. const focus = () => {
  47813. var _a, _b;
  47814. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  47815. };
  47816. expose({
  47817. blur,
  47818. focus
  47819. });
  47820. return (_ctx, _cache) => {
  47821. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  47822. ref_key: "select",
  47823. ref: select,
  47824. "model-value": vue.unref(value),
  47825. disabled: vue.unref(_disabled),
  47826. clearable: _ctx.clearable,
  47827. "clear-icon": _ctx.clearIcon,
  47828. size: _ctx.size,
  47829. effect: _ctx.effect,
  47830. placeholder: _ctx.placeholder,
  47831. "default-first-option": "",
  47832. filterable: _ctx.editable,
  47833. "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)),
  47834. onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)),
  47835. onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
  47836. onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event))
  47837. }, {
  47838. prefix: vue.withCtx(() => [
  47839. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  47840. key: 0,
  47841. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  47842. }, {
  47843. default: vue.withCtx(() => [
  47844. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  47845. ]),
  47846. _: 1
  47847. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  47848. ]),
  47849. default: vue.withCtx(() => [
  47850. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  47851. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  47852. key: item.value,
  47853. label: item.value,
  47854. value: item.value,
  47855. disabled: item.disabled
  47856. }, null, 8, ["label", "value", "disabled"]);
  47857. }), 128))
  47858. ]),
  47859. _: 1
  47860. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable"]);
  47861. };
  47862. }
  47863. });
  47864. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "time-select.vue"]]);
  47865. TimeSelect.install = (app) => {
  47866. app.component(TimeSelect.name, TimeSelect);
  47867. };
  47868. const _TimeSelect = TimeSelect;
  47869. const ElTimeSelect = _TimeSelect;
  47870. const Timeline = vue.defineComponent({
  47871. name: "ElTimeline",
  47872. setup(_, { slots }) {
  47873. const ns = useNamespace("timeline");
  47874. vue.provide("timeline", slots);
  47875. return () => {
  47876. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  47877. };
  47878. }
  47879. });
  47880. var Timeline$1 = Timeline;
  47881. const timelineItemProps = buildProps({
  47882. timestamp: {
  47883. type: String,
  47884. default: ""
  47885. },
  47886. hideTimestamp: {
  47887. type: Boolean,
  47888. default: false
  47889. },
  47890. center: {
  47891. type: Boolean,
  47892. default: false
  47893. },
  47894. placement: {
  47895. type: String,
  47896. values: ["top", "bottom"],
  47897. default: "bottom"
  47898. },
  47899. type: {
  47900. type: String,
  47901. values: ["primary", "success", "warning", "danger", "info"],
  47902. default: ""
  47903. },
  47904. color: {
  47905. type: String,
  47906. default: ""
  47907. },
  47908. size: {
  47909. type: String,
  47910. values: ["normal", "large"],
  47911. default: "normal"
  47912. },
  47913. icon: {
  47914. type: iconPropType
  47915. },
  47916. hollow: {
  47917. type: Boolean,
  47918. default: false
  47919. }
  47920. });
  47921. const __default__$g = vue.defineComponent({
  47922. name: "ElTimelineItem"
  47923. });
  47924. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  47925. ...__default__$g,
  47926. props: timelineItemProps,
  47927. setup(__props) {
  47928. const ns = useNamespace("timeline-item");
  47929. return (_ctx, _cache) => {
  47930. return vue.openBlock(), vue.createElementBlock("li", {
  47931. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  47932. }, [
  47933. vue.createElementVNode("div", {
  47934. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  47935. }, null, 2),
  47936. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  47937. key: 0,
  47938. class: vue.normalizeClass([
  47939. vue.unref(ns).e("node"),
  47940. vue.unref(ns).em("node", _ctx.size || ""),
  47941. vue.unref(ns).em("node", _ctx.type || ""),
  47942. vue.unref(ns).is("hollow", _ctx.hollow)
  47943. ]),
  47944. style: vue.normalizeStyle({
  47945. backgroundColor: _ctx.color
  47946. })
  47947. }, [
  47948. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  47949. key: 0,
  47950. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  47951. }, {
  47952. default: vue.withCtx(() => [
  47953. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  47954. ]),
  47955. _: 1
  47956. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  47957. ], 6)) : vue.createCommentVNode("v-if", true),
  47958. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  47959. key: 1,
  47960. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  47961. }, [
  47962. vue.renderSlot(_ctx.$slots, "dot")
  47963. ], 2)) : vue.createCommentVNode("v-if", true),
  47964. vue.createElementVNode("div", {
  47965. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  47966. }, [
  47967. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  47968. key: 0,
  47969. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  47970. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  47971. vue.createElementVNode("div", {
  47972. class: vue.normalizeClass(vue.unref(ns).e("content"))
  47973. }, [
  47974. vue.renderSlot(_ctx.$slots, "default")
  47975. ], 2),
  47976. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  47977. key: 1,
  47978. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  47979. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  47980. ], 2)
  47981. ], 2);
  47982. };
  47983. }
  47984. });
  47985. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "timeline-item.vue"]]);
  47986. const ElTimeline = withInstall(Timeline$1, {
  47987. TimelineItem
  47988. });
  47989. const ElTimelineItem = withNoopInstall(TimelineItem);
  47990. const tooltipV2CommonProps = buildProps({
  47991. nowrap: Boolean
  47992. });
  47993. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  47994. TooltipV2Sides2["top"] = "top";
  47995. TooltipV2Sides2["bottom"] = "bottom";
  47996. TooltipV2Sides2["left"] = "left";
  47997. TooltipV2Sides2["right"] = "right";
  47998. return TooltipV2Sides2;
  47999. })(TooltipV2Sides || {});
  48000. const tooltipV2Sides = Object.values(TooltipV2Sides);
  48001. const tooltipV2ArrowProps = buildProps({
  48002. width: {
  48003. type: Number,
  48004. default: 10
  48005. },
  48006. height: {
  48007. type: Number,
  48008. default: 10
  48009. },
  48010. style: {
  48011. type: definePropType(Object),
  48012. default: null
  48013. }
  48014. });
  48015. const tooltipV2ArrowSpecialProps = buildProps({
  48016. side: {
  48017. type: definePropType(String),
  48018. values: tooltipV2Sides,
  48019. required: true
  48020. }
  48021. });
  48022. const tooltipV2Strategies = ["absolute", "fixed"];
  48023. const tooltipV2Placements = [
  48024. "top-start",
  48025. "top-end",
  48026. "top",
  48027. "bottom-start",
  48028. "bottom-end",
  48029. "bottom",
  48030. "left-start",
  48031. "left-end",
  48032. "left",
  48033. "right-start",
  48034. "right-end",
  48035. "right"
  48036. ];
  48037. const tooltipV2ContentProps = buildProps({
  48038. ariaLabel: String,
  48039. arrowPadding: {
  48040. type: definePropType(Number),
  48041. default: 5
  48042. },
  48043. effect: {
  48044. type: String,
  48045. default: ""
  48046. },
  48047. contentClass: String,
  48048. placement: {
  48049. type: definePropType(String),
  48050. values: tooltipV2Placements,
  48051. default: "bottom"
  48052. },
  48053. reference: {
  48054. type: definePropType(Object),
  48055. default: null
  48056. },
  48057. offset: {
  48058. type: Number,
  48059. default: 8
  48060. },
  48061. strategy: {
  48062. type: definePropType(String),
  48063. values: tooltipV2Strategies,
  48064. default: "absolute"
  48065. },
  48066. showArrow: {
  48067. type: Boolean,
  48068. default: false
  48069. }
  48070. });
  48071. const tooltipV2RootProps = buildProps({
  48072. delayDuration: {
  48073. type: Number,
  48074. default: 300
  48075. },
  48076. defaultOpen: Boolean,
  48077. open: {
  48078. type: Boolean,
  48079. default: void 0
  48080. },
  48081. onOpenChange: {
  48082. type: definePropType(Function)
  48083. },
  48084. "onUpdate:open": {
  48085. type: definePropType(Function)
  48086. }
  48087. });
  48088. const EventHandler = {
  48089. type: definePropType(Function)
  48090. };
  48091. const tooltipV2TriggerProps = buildProps({
  48092. onBlur: EventHandler,
  48093. onClick: EventHandler,
  48094. onFocus: EventHandler,
  48095. onMouseDown: EventHandler,
  48096. onMouseEnter: EventHandler,
  48097. onMouseLeave: EventHandler
  48098. });
  48099. const tooltipV2Props = buildProps({
  48100. ...tooltipV2RootProps,
  48101. ...tooltipV2ArrowProps,
  48102. ...tooltipV2TriggerProps,
  48103. ...tooltipV2ContentProps,
  48104. alwaysOn: Boolean,
  48105. fullTransition: Boolean,
  48106. transitionProps: {
  48107. type: definePropType(Object),
  48108. default: null
  48109. },
  48110. teleported: Boolean,
  48111. to: {
  48112. type: definePropType(String),
  48113. default: "body"
  48114. }
  48115. });
  48116. const tooltipV2RootKey = Symbol("tooltipV2");
  48117. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  48118. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  48119. const __default__$f = vue.defineComponent({
  48120. name: "ElTooltipV2Root"
  48121. });
  48122. const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
  48123. ...__default__$f,
  48124. props: tooltipV2RootProps,
  48125. setup(__props, { expose }) {
  48126. const props = __props;
  48127. const _open = vue.ref(props.defaultOpen);
  48128. const triggerRef = vue.ref(null);
  48129. const open = vue.computed({
  48130. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  48131. set: (open2) => {
  48132. var _a;
  48133. _open.value = open2;
  48134. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  48135. }
  48136. });
  48137. const isOpenDelayed = vue.computed(() => isNumber$1(props.delayDuration) && props.delayDuration > 0);
  48138. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  48139. open.value = true;
  48140. }, vue.computed(() => props.delayDuration), {
  48141. immediate: false
  48142. });
  48143. const ns = useNamespace("tooltip-v2");
  48144. const contentId = useId();
  48145. const onNormalOpen = () => {
  48146. clearTimer();
  48147. open.value = true;
  48148. };
  48149. const onDelayOpen = () => {
  48150. vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  48151. };
  48152. const onOpen = onNormalOpen;
  48153. const onClose = () => {
  48154. clearTimer();
  48155. open.value = false;
  48156. };
  48157. const onChange = (open2) => {
  48158. var _a;
  48159. if (open2) {
  48160. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  48161. onOpen();
  48162. }
  48163. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  48164. };
  48165. vue.watch(open, onChange);
  48166. vue.onMounted(() => {
  48167. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  48168. });
  48169. vue.onBeforeUnmount(() => {
  48170. clearTimer();
  48171. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  48172. });
  48173. vue.provide(tooltipV2RootKey, {
  48174. contentId,
  48175. triggerRef,
  48176. ns,
  48177. onClose,
  48178. onDelayOpen,
  48179. onOpen
  48180. });
  48181. expose({
  48182. onOpen,
  48183. onClose
  48184. });
  48185. return (_ctx, _cache) => {
  48186. return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) });
  48187. };
  48188. }
  48189. });
  48190. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "root.vue"]]);
  48191. const __default__$e = vue.defineComponent({
  48192. name: "ElTooltipV2Arrow"
  48193. });
  48194. const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
  48195. ...__default__$e,
  48196. props: {
  48197. ...tooltipV2ArrowProps,
  48198. ...tooltipV2ArrowSpecialProps
  48199. },
  48200. setup(__props) {
  48201. const props = __props;
  48202. const { ns } = vue.inject(tooltipV2RootKey);
  48203. const { arrowRef } = vue.inject(tooltipV2ContentKey);
  48204. const arrowStyle = vue.computed(() => {
  48205. const { style, width, height } = props;
  48206. const namespace = ns.namespace.value;
  48207. return {
  48208. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  48209. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  48210. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  48211. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  48212. ...style || {}
  48213. };
  48214. });
  48215. return (_ctx, _cache) => {
  48216. return vue.openBlock(), vue.createElementBlock("span", {
  48217. ref_key: "arrowRef",
  48218. ref: arrowRef,
  48219. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  48220. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  48221. }, null, 6);
  48222. };
  48223. }
  48224. });
  48225. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "arrow.vue"]]);
  48226. const visualHiddenProps = buildProps({
  48227. style: {
  48228. type: definePropType([String, Object, Array]),
  48229. default: () => ({})
  48230. }
  48231. });
  48232. const __default__$d = vue.defineComponent({
  48233. name: "ElVisuallyHidden"
  48234. });
  48235. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  48236. ...__default__$d,
  48237. props: visualHiddenProps,
  48238. setup(__props) {
  48239. const props = __props;
  48240. const computedStyle = vue.computed(() => {
  48241. return [
  48242. props.style,
  48243. {
  48244. position: "absolute",
  48245. border: 0,
  48246. width: 1,
  48247. height: 1,
  48248. padding: 0,
  48249. margin: -1,
  48250. overflow: "hidden",
  48251. clip: "rect(0, 0, 0, 0)",
  48252. whiteSpace: "nowrap",
  48253. wordWrap: "normal"
  48254. }
  48255. ];
  48256. });
  48257. return (_ctx, _cache) => {
  48258. return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
  48259. vue.renderSlot(_ctx.$slots, "default")
  48260. ], 16);
  48261. };
  48262. }
  48263. });
  48264. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "visual-hidden.vue"]]);
  48265. const _hoisted_1$9 = ["data-side"];
  48266. const __default__$c = vue.defineComponent({
  48267. name: "ElTooltipV2Content"
  48268. });
  48269. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  48270. ...__default__$c,
  48271. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  48272. setup(__props) {
  48273. const props = __props;
  48274. const { triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  48275. const placement = vue.ref(props.placement);
  48276. const strategy = vue.ref(props.strategy);
  48277. const arrowRef = vue.ref(null);
  48278. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating({
  48279. placement,
  48280. strategy,
  48281. middleware: vue.computed(() => {
  48282. const middleware = [offset(props.offset)];
  48283. if (props.showArrow) {
  48284. middleware.push(arrowMiddleware({
  48285. arrowRef
  48286. }));
  48287. }
  48288. return middleware;
  48289. })
  48290. });
  48291. const zIndex = useZIndex().nextZIndex();
  48292. const ns = useNamespace("tooltip-v2");
  48293. const side = vue.computed(() => {
  48294. return placement.value.split("-")[0];
  48295. });
  48296. const contentStyle = vue.computed(() => {
  48297. return {
  48298. position: vue.unref(strategy),
  48299. top: `${vue.unref(y) || 0}px`,
  48300. left: `${vue.unref(x) || 0}px`,
  48301. zIndex
  48302. };
  48303. });
  48304. const arrowStyle = vue.computed(() => {
  48305. if (!props.showArrow)
  48306. return {};
  48307. const { arrow } = vue.unref(middlewareData);
  48308. return {
  48309. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  48310. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  48311. };
  48312. });
  48313. const contentClass = vue.computed(() => [
  48314. ns.e("content"),
  48315. ns.is("dark", props.effect === "dark"),
  48316. ns.is(vue.unref(strategy)),
  48317. props.contentClass
  48318. ]);
  48319. vue.watch(arrowRef, () => update());
  48320. vue.watch(() => props.placement, (val) => placement.value = val);
  48321. vue.onMounted(() => {
  48322. vue.watch(() => props.reference || triggerRef.value, (el) => {
  48323. referenceRef.value = el || void 0;
  48324. }, {
  48325. immediate: true
  48326. });
  48327. });
  48328. vue.provide(tooltipV2ContentKey, { arrowRef });
  48329. return (_ctx, _cache) => {
  48330. return vue.openBlock(), vue.createElementBlock("div", {
  48331. ref_key: "contentRef",
  48332. ref: contentRef,
  48333. style: vue.normalizeStyle(vue.unref(contentStyle)),
  48334. "data-tooltip-v2-root": ""
  48335. }, [
  48336. !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", {
  48337. key: 0,
  48338. "data-side": vue.unref(side),
  48339. class: vue.normalizeClass(vue.unref(contentClass))
  48340. }, [
  48341. vue.renderSlot(_ctx.$slots, "default", {
  48342. contentStyle: vue.unref(contentStyle),
  48343. contentClass: vue.unref(contentClass)
  48344. }),
  48345. vue.createVNode(vue.unref(ElVisuallyHidden), {
  48346. id: vue.unref(contentId),
  48347. role: "tooltip"
  48348. }, {
  48349. default: vue.withCtx(() => [
  48350. _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  48351. vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1)
  48352. ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
  48353. ]),
  48354. _: 3
  48355. }, 8, ["id"]),
  48356. vue.renderSlot(_ctx.$slots, "arrow", {
  48357. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  48358. side: vue.unref(side)
  48359. })
  48360. ], 10, _hoisted_1$9)) : vue.createCommentVNode("v-if", true)
  48361. ], 4);
  48362. };
  48363. }
  48364. });
  48365. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "content.vue"]]);
  48366. const forwardRefProps = buildProps({
  48367. setRef: {
  48368. type: definePropType(Function),
  48369. required: true
  48370. },
  48371. onlyChild: Boolean
  48372. });
  48373. var ForwardRef = vue.defineComponent({
  48374. props: forwardRefProps,
  48375. setup(props, {
  48376. slots
  48377. }) {
  48378. const fragmentRef = vue.ref();
  48379. const setRef = composeRefs(fragmentRef, (el) => {
  48380. if (el) {
  48381. props.setRef(el.nextElementSibling);
  48382. } else {
  48383. props.setRef(null);
  48384. }
  48385. });
  48386. return () => {
  48387. var _a;
  48388. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  48389. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  48390. return vue.createVNode(vue.Fragment, {
  48391. "ref": setRef
  48392. }, [child]);
  48393. };
  48394. }
  48395. });
  48396. const __default__$b = vue.defineComponent({
  48397. name: "ElTooltipV2Trigger"
  48398. });
  48399. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  48400. ...__default__$b,
  48401. props: {
  48402. ...tooltipV2CommonProps,
  48403. ...tooltipV2TriggerProps
  48404. },
  48405. setup(__props) {
  48406. const props = __props;
  48407. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  48408. let isMousedown = false;
  48409. const setTriggerRef = (el) => {
  48410. triggerRef.value = el;
  48411. };
  48412. const onMouseup = () => {
  48413. isMousedown = false;
  48414. };
  48415. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  48416. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  48417. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  48418. onClose();
  48419. isMousedown = true;
  48420. document.addEventListener("mouseup", onMouseup, { once: true });
  48421. });
  48422. const onFocus = composeEventHandlers(props.onFocus, () => {
  48423. if (!isMousedown)
  48424. onOpen();
  48425. });
  48426. const onBlur = composeEventHandlers(props.onBlur, onClose);
  48427. const onClick = composeEventHandlers(props.onClick, (e) => {
  48428. if (e.detail === 0)
  48429. onClose();
  48430. });
  48431. const events = {
  48432. blur: onBlur,
  48433. click: onClick,
  48434. focus: onFocus,
  48435. mousedown: onMousedown,
  48436. mouseenter: onMouseenter,
  48437. mouseleave: onMouseleave
  48438. };
  48439. const setEvents = (el, events2, type) => {
  48440. if (el) {
  48441. Object.entries(events2).forEach(([name, handler]) => {
  48442. el[type](name, handler);
  48443. });
  48444. }
  48445. };
  48446. vue.watch(triggerRef, (triggerEl, previousTriggerEl) => {
  48447. setEvents(triggerEl, events, "addEventListener");
  48448. setEvents(previousTriggerEl, events, "removeEventListener");
  48449. if (triggerEl) {
  48450. triggerEl.setAttribute("aria-describedby", contentId.value);
  48451. }
  48452. });
  48453. vue.onBeforeUnmount(() => {
  48454. setEvents(triggerRef.value, events, "removeEventListener");
  48455. document.removeEventListener("mouseup", onMouseup);
  48456. });
  48457. return (_ctx, _cache) => {
  48458. return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), {
  48459. key: 0,
  48460. "set-ref": setTriggerRef,
  48461. "only-child": ""
  48462. }, {
  48463. default: vue.withCtx(() => [
  48464. vue.renderSlot(_ctx.$slots, "default")
  48465. ]),
  48466. _: 3
  48467. })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
  48468. key: 1,
  48469. ref_key: "triggerRef",
  48470. ref: triggerRef
  48471. }, _ctx.$attrs), [
  48472. vue.renderSlot(_ctx.$slots, "default")
  48473. ], 16));
  48474. };
  48475. }
  48476. });
  48477. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "trigger.vue"]]);
  48478. const __default__$a = vue.defineComponent({
  48479. name: "ElTooltipV2"
  48480. });
  48481. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  48482. ...__default__$a,
  48483. props: tooltipV2Props,
  48484. setup(__props) {
  48485. const props = __props;
  48486. const refedProps = vue.toRefs(props);
  48487. const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  48488. const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  48489. const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  48490. const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  48491. return (_ctx, _cache) => {
  48492. return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), {
  48493. default: vue.withCtx(({ open }) => [
  48494. vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), {
  48495. default: vue.withCtx(() => [
  48496. vue.renderSlot(_ctx.$slots, "trigger")
  48497. ]),
  48498. _: 3
  48499. }, 16),
  48500. (vue.openBlock(), vue.createBlock(vue.Teleport, {
  48501. to: _ctx.to,
  48502. disabled: !_ctx.teleported
  48503. }, [
  48504. _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), {
  48505. default: vue.withCtx(() => [
  48506. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  48507. arrow: vue.withCtx(({ style, side }) => [
  48508. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  48509. style,
  48510. side
  48511. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  48512. ]),
  48513. default: vue.withCtx(() => [
  48514. vue.renderSlot(_ctx.$slots, "default")
  48515. ]),
  48516. _: 3
  48517. }, 16)) : vue.createCommentVNode("v-if", true)
  48518. ]),
  48519. _: 2
  48520. }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  48521. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  48522. arrow: vue.withCtx(({ style, side }) => [
  48523. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  48524. style,
  48525. side
  48526. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  48527. ]),
  48528. default: vue.withCtx(() => [
  48529. vue.renderSlot(_ctx.$slots, "default")
  48530. ]),
  48531. _: 3
  48532. }, 16)) : vue.createCommentVNode("v-if", true)
  48533. ], 64))
  48534. ], 8, ["to", "disabled"]))
  48535. ]),
  48536. _: 3
  48537. }, 16);
  48538. };
  48539. }
  48540. });
  48541. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "tooltip.vue"]]);
  48542. const ElTooltipV2 = withInstall(TooltipV2);
  48543. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  48544. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  48545. const transferProps = buildProps({
  48546. data: {
  48547. type: definePropType(Array),
  48548. default: () => []
  48549. },
  48550. titles: {
  48551. type: definePropType(Array),
  48552. default: () => []
  48553. },
  48554. buttonTexts: {
  48555. type: definePropType(Array),
  48556. default: () => []
  48557. },
  48558. filterPlaceholder: String,
  48559. filterMethod: {
  48560. type: definePropType(Function)
  48561. },
  48562. leftDefaultChecked: {
  48563. type: definePropType(Array),
  48564. default: () => []
  48565. },
  48566. rightDefaultChecked: {
  48567. type: definePropType(Array),
  48568. default: () => []
  48569. },
  48570. renderContent: {
  48571. type: definePropType(Function)
  48572. },
  48573. modelValue: {
  48574. type: definePropType(Array),
  48575. default: () => []
  48576. },
  48577. format: {
  48578. type: definePropType(Object),
  48579. default: () => ({})
  48580. },
  48581. filterable: Boolean,
  48582. props: {
  48583. type: definePropType(Object),
  48584. default: () => mutable({
  48585. label: "label",
  48586. key: "key",
  48587. disabled: "disabled"
  48588. })
  48589. },
  48590. targetOrder: {
  48591. type: String,
  48592. values: ["original", "push", "unshift"],
  48593. default: "original"
  48594. },
  48595. validateEvent: {
  48596. type: Boolean,
  48597. default: true
  48598. }
  48599. });
  48600. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  48601. const transferEmits = {
  48602. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  48603. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  48604. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  48605. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  48606. };
  48607. const CHECKED_CHANGE_EVENT = "checked-change";
  48608. const transferPanelProps = buildProps({
  48609. data: transferProps.data,
  48610. optionRender: {
  48611. type: definePropType(Function)
  48612. },
  48613. placeholder: String,
  48614. title: String,
  48615. filterable: Boolean,
  48616. format: transferProps.format,
  48617. filterMethod: transferProps.filterMethod,
  48618. defaultChecked: transferProps.leftDefaultChecked,
  48619. props: transferProps.props
  48620. });
  48621. const transferPanelEmits = {
  48622. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  48623. };
  48624. const usePropsAlias = (props) => {
  48625. const initProps = {
  48626. label: "label",
  48627. key: "key",
  48628. disabled: "disabled"
  48629. };
  48630. return vue.computed(() => ({
  48631. ...initProps,
  48632. ...props.props
  48633. }));
  48634. };
  48635. const useCheck$1 = (props, panelState, emit) => {
  48636. const propsAlias = usePropsAlias(props);
  48637. const filteredData = vue.computed(() => {
  48638. return props.data.filter((item) => {
  48639. if (isFunction$1(props.filterMethod)) {
  48640. return props.filterMethod(panelState.query, item);
  48641. } else {
  48642. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  48643. return label.toLowerCase().includes(panelState.query.toLowerCase());
  48644. }
  48645. });
  48646. });
  48647. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  48648. const checkedSummary = vue.computed(() => {
  48649. const checkedLength = panelState.checked.length;
  48650. const dataLength = props.data.length;
  48651. const { noChecked, hasChecked } = props.format;
  48652. if (noChecked && hasChecked) {
  48653. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  48654. } else {
  48655. return `${checkedLength}/${dataLength}`;
  48656. }
  48657. });
  48658. const isIndeterminate = vue.computed(() => {
  48659. const checkedLength = panelState.checked.length;
  48660. return checkedLength > 0 && checkedLength < checkableData.value.length;
  48661. });
  48662. const updateAllChecked = () => {
  48663. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  48664. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  48665. };
  48666. const handleAllCheckedChange = (value) => {
  48667. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  48668. };
  48669. vue.watch(() => panelState.checked, (val, oldVal) => {
  48670. updateAllChecked();
  48671. if (panelState.checkChangeByUser) {
  48672. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  48673. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  48674. } else {
  48675. emit(CHECKED_CHANGE_EVENT, val);
  48676. panelState.checkChangeByUser = true;
  48677. }
  48678. });
  48679. vue.watch(checkableData, () => {
  48680. updateAllChecked();
  48681. });
  48682. vue.watch(() => props.data, () => {
  48683. const checked = [];
  48684. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  48685. panelState.checked.forEach((item) => {
  48686. if (filteredDataKeys.includes(item)) {
  48687. checked.push(item);
  48688. }
  48689. });
  48690. panelState.checkChangeByUser = false;
  48691. panelState.checked = checked;
  48692. });
  48693. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  48694. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  48695. return;
  48696. const checked = [];
  48697. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  48698. val.forEach((item) => {
  48699. if (checkableDataKeys.includes(item)) {
  48700. checked.push(item);
  48701. }
  48702. });
  48703. panelState.checkChangeByUser = false;
  48704. panelState.checked = checked;
  48705. }, {
  48706. immediate: true
  48707. });
  48708. return {
  48709. filteredData,
  48710. checkableData,
  48711. checkedSummary,
  48712. isIndeterminate,
  48713. updateAllChecked,
  48714. handleAllCheckedChange
  48715. };
  48716. };
  48717. const useCheckedChange = (checkedState, emit) => {
  48718. const onSourceCheckedChange = (val, movedKeys) => {
  48719. checkedState.leftChecked = val;
  48720. if (!movedKeys)
  48721. return;
  48722. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  48723. };
  48724. const onTargetCheckedChange = (val, movedKeys) => {
  48725. checkedState.rightChecked = val;
  48726. if (!movedKeys)
  48727. return;
  48728. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  48729. };
  48730. return {
  48731. onSourceCheckedChange,
  48732. onTargetCheckedChange
  48733. };
  48734. };
  48735. const useComputedData = (props) => {
  48736. const propsAlias = usePropsAlias(props);
  48737. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  48738. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  48739. const targetData = vue.computed(() => {
  48740. if (props.targetOrder === "original") {
  48741. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  48742. } else {
  48743. return props.modelValue.reduce((arr, cur) => {
  48744. const val = dataObj.value[cur];
  48745. if (val) {
  48746. arr.push(val);
  48747. }
  48748. return arr;
  48749. }, []);
  48750. }
  48751. });
  48752. return {
  48753. sourceData,
  48754. targetData
  48755. };
  48756. };
  48757. const useMove = (props, checkedState, emit) => {
  48758. const propsAlias = usePropsAlias(props);
  48759. const _emit = (value, direction, movedKeys) => {
  48760. emit(UPDATE_MODEL_EVENT, value);
  48761. emit(CHANGE_EVENT, value, direction, movedKeys);
  48762. };
  48763. const addToLeft = () => {
  48764. const currentValue = props.modelValue.slice();
  48765. checkedState.rightChecked.forEach((item) => {
  48766. const index = currentValue.indexOf(item);
  48767. if (index > -1) {
  48768. currentValue.splice(index, 1);
  48769. }
  48770. });
  48771. _emit(currentValue, "left", checkedState.rightChecked);
  48772. };
  48773. const addToRight = () => {
  48774. let currentValue = props.modelValue.slice();
  48775. const itemsToBeMoved = props.data.filter((item) => {
  48776. const itemKey = item[propsAlias.value.key];
  48777. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  48778. }).map((item) => item[propsAlias.value.key]);
  48779. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  48780. if (props.targetOrder === "original") {
  48781. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  48782. }
  48783. _emit(currentValue, "right", checkedState.leftChecked);
  48784. };
  48785. return {
  48786. addToLeft,
  48787. addToRight
  48788. };
  48789. };
  48790. const __default__$9 = vue.defineComponent({
  48791. name: "ElTransferPanel"
  48792. });
  48793. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  48794. ...__default__$9,
  48795. props: transferPanelProps,
  48796. emits: transferPanelEmits,
  48797. setup(__props, { expose, emit }) {
  48798. const props = __props;
  48799. const slots = vue.useSlots();
  48800. const OptionContent = ({ option }) => option;
  48801. const { t } = useLocale();
  48802. const ns = useNamespace("transfer");
  48803. const panelState = vue.reactive({
  48804. checked: [],
  48805. allChecked: false,
  48806. query: "",
  48807. checkChangeByUser: true
  48808. });
  48809. const propsAlias = usePropsAlias(props);
  48810. const {
  48811. filteredData,
  48812. checkedSummary,
  48813. isIndeterminate,
  48814. handleAllCheckedChange
  48815. } = useCheck$1(props, panelState, emit);
  48816. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  48817. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  48818. const { checked, allChecked, query } = vue.toRefs(panelState);
  48819. expose({
  48820. query
  48821. });
  48822. return (_ctx, _cache) => {
  48823. return vue.openBlock(), vue.createElementBlock("div", {
  48824. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  48825. }, [
  48826. vue.createElementVNode("p", {
  48827. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  48828. }, [
  48829. vue.createVNode(vue.unref(ElCheckbox), {
  48830. modelValue: vue.unref(allChecked),
  48831. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null),
  48832. indeterminate: vue.unref(isIndeterminate),
  48833. "validate-event": false,
  48834. onChange: vue.unref(handleAllCheckedChange)
  48835. }, {
  48836. default: vue.withCtx(() => [
  48837. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  48838. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  48839. ]),
  48840. _: 1
  48841. }, 8, ["modelValue", "indeterminate", "onChange"])
  48842. ], 2),
  48843. vue.createElementVNode("div", {
  48844. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  48845. }, [
  48846. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  48847. key: 0,
  48848. modelValue: vue.unref(query),
  48849. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(query) ? query.value = $event : null),
  48850. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  48851. size: "default",
  48852. placeholder: _ctx.placeholder,
  48853. "prefix-icon": vue.unref(search_default),
  48854. clearable: "",
  48855. "validate-event": false
  48856. }, null, 8, ["modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  48857. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  48858. modelValue: vue.unref(checked),
  48859. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(checked) ? checked.value = $event : null),
  48860. "validate-event": false,
  48861. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  48862. }, {
  48863. default: vue.withCtx(() => [
  48864. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  48865. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  48866. key: item[vue.unref(propsAlias).key],
  48867. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  48868. label: item[vue.unref(propsAlias).key],
  48869. disabled: item[vue.unref(propsAlias).disabled],
  48870. "validate-event": false
  48871. }, {
  48872. default: vue.withCtx(() => {
  48873. var _a;
  48874. return [
  48875. vue.createVNode(OptionContent, {
  48876. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  48877. }, null, 8, ["option"])
  48878. ];
  48879. }),
  48880. _: 2
  48881. }, 1032, ["class", "label", "disabled"]);
  48882. }), 128))
  48883. ]),
  48884. _: 1
  48885. }, 8, ["modelValue", "class"]), [
  48886. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  48887. ]),
  48888. vue.withDirectives(vue.createElementVNode("p", {
  48889. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  48890. }, vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 3), [
  48891. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  48892. ])
  48893. ], 2),
  48894. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  48895. key: 0,
  48896. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  48897. }, [
  48898. vue.renderSlot(_ctx.$slots, "default")
  48899. ], 2)) : vue.createCommentVNode("v-if", true)
  48900. ], 2);
  48901. };
  48902. }
  48903. });
  48904. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "transfer-panel.vue"]]);
  48905. const _hoisted_1$8 = { key: 0 };
  48906. const _hoisted_2$6 = { key: 0 };
  48907. const __default__$8 = vue.defineComponent({
  48908. name: "ElTransfer"
  48909. });
  48910. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  48911. ...__default__$8,
  48912. props: transferProps,
  48913. emits: transferEmits,
  48914. setup(__props, { expose, emit }) {
  48915. const props = __props;
  48916. const slots = vue.useSlots();
  48917. const { t } = useLocale();
  48918. const ns = useNamespace("transfer");
  48919. const { formItem } = useFormItem();
  48920. const checkedState = vue.reactive({
  48921. leftChecked: [],
  48922. rightChecked: []
  48923. });
  48924. const propsAlias = usePropsAlias(props);
  48925. const { sourceData, targetData } = useComputedData(props);
  48926. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  48927. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  48928. const leftPanel = vue.ref();
  48929. const rightPanel = vue.ref();
  48930. const clearQuery = (which) => {
  48931. switch (which) {
  48932. case "left":
  48933. leftPanel.value.query = "";
  48934. break;
  48935. case "right":
  48936. rightPanel.value.query = "";
  48937. break;
  48938. }
  48939. };
  48940. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  48941. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  48942. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  48943. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  48944. vue.watch(() => props.modelValue, () => {
  48945. var _a;
  48946. if (props.validateEvent) {
  48947. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  48948. }
  48949. });
  48950. const optionRender = vue.computed(() => (option) => {
  48951. if (props.renderContent)
  48952. return props.renderContent(vue.h, option);
  48953. if (slots.default)
  48954. return slots.default({ option });
  48955. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  48956. });
  48957. expose({
  48958. clearQuery,
  48959. leftPanel,
  48960. rightPanel
  48961. });
  48962. return (_ctx, _cache) => {
  48963. return vue.openBlock(), vue.createElementBlock("div", {
  48964. class: vue.normalizeClass(vue.unref(ns).b())
  48965. }, [
  48966. vue.createVNode(TransferPanel, {
  48967. ref_key: "leftPanel",
  48968. ref: leftPanel,
  48969. data: vue.unref(sourceData),
  48970. "option-render": vue.unref(optionRender),
  48971. placeholder: vue.unref(panelFilterPlaceholder),
  48972. title: vue.unref(leftPanelTitle),
  48973. filterable: _ctx.filterable,
  48974. format: _ctx.format,
  48975. "filter-method": _ctx.filterMethod,
  48976. "default-checked": _ctx.leftDefaultChecked,
  48977. props: props.props,
  48978. onCheckedChange: vue.unref(onSourceCheckedChange)
  48979. }, {
  48980. default: vue.withCtx(() => [
  48981. vue.renderSlot(_ctx.$slots, "left-footer")
  48982. ]),
  48983. _: 3
  48984. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  48985. vue.createElementVNode("div", {
  48986. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  48987. }, [
  48988. vue.createVNode(vue.unref(ElButton), {
  48989. type: "primary",
  48990. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  48991. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  48992. onClick: vue.unref(addToLeft)
  48993. }, {
  48994. default: vue.withCtx(() => [
  48995. vue.createVNode(vue.unref(ElIcon), null, {
  48996. default: vue.withCtx(() => [
  48997. vue.createVNode(vue.unref(arrow_left_default))
  48998. ]),
  48999. _: 1
  49000. }),
  49001. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$8, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  49002. ]),
  49003. _: 1
  49004. }, 8, ["class", "disabled", "onClick"]),
  49005. vue.createVNode(vue.unref(ElButton), {
  49006. type: "primary",
  49007. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  49008. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  49009. onClick: vue.unref(addToRight)
  49010. }, {
  49011. default: vue.withCtx(() => [
  49012. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$6, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  49013. vue.createVNode(vue.unref(ElIcon), null, {
  49014. default: vue.withCtx(() => [
  49015. vue.createVNode(vue.unref(arrow_right_default))
  49016. ]),
  49017. _: 1
  49018. })
  49019. ]),
  49020. _: 1
  49021. }, 8, ["class", "disabled", "onClick"])
  49022. ], 2),
  49023. vue.createVNode(TransferPanel, {
  49024. ref_key: "rightPanel",
  49025. ref: rightPanel,
  49026. data: vue.unref(targetData),
  49027. "option-render": vue.unref(optionRender),
  49028. placeholder: vue.unref(panelFilterPlaceholder),
  49029. filterable: _ctx.filterable,
  49030. format: _ctx.format,
  49031. "filter-method": _ctx.filterMethod,
  49032. title: vue.unref(rightPanelTitle),
  49033. "default-checked": _ctx.rightDefaultChecked,
  49034. props: props.props,
  49035. onCheckedChange: vue.unref(onTargetCheckedChange)
  49036. }, {
  49037. default: vue.withCtx(() => [
  49038. vue.renderSlot(_ctx.$slots, "right-footer")
  49039. ]),
  49040. _: 3
  49041. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  49042. ], 2);
  49043. };
  49044. }
  49045. });
  49046. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "transfer.vue"]]);
  49047. const ElTransfer = withInstall(Transfer);
  49048. const NODE_KEY = "$treeNodeId";
  49049. const markNodeData = function(node, data) {
  49050. if (!data || data[NODE_KEY])
  49051. return;
  49052. Object.defineProperty(data, NODE_KEY, {
  49053. value: node.id,
  49054. enumerable: false,
  49055. configurable: false,
  49056. writable: false
  49057. });
  49058. };
  49059. const getNodeKey = function(key, data) {
  49060. if (!key)
  49061. return data[NODE_KEY];
  49062. return data[key];
  49063. };
  49064. const handleCurrentChange = (store, emit, setCurrent) => {
  49065. const preCurrentNode = store.value.currentNode;
  49066. setCurrent();
  49067. const currentNode = store.value.currentNode;
  49068. if (preCurrentNode === currentNode)
  49069. return;
  49070. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  49071. };
  49072. const getChildState = (node) => {
  49073. let all = true;
  49074. let none = true;
  49075. let allWithoutDisable = true;
  49076. for (let i = 0, j = node.length; i < j; i++) {
  49077. const n = node[i];
  49078. if (n.checked !== true || n.indeterminate) {
  49079. all = false;
  49080. if (!n.disabled) {
  49081. allWithoutDisable = false;
  49082. }
  49083. }
  49084. if (n.checked !== false || n.indeterminate) {
  49085. none = false;
  49086. }
  49087. }
  49088. return { all, none, allWithoutDisable, half: !all && !none };
  49089. };
  49090. const reInitChecked = function(node) {
  49091. if (node.childNodes.length === 0 || node.loading)
  49092. return;
  49093. const { all, none, half } = getChildState(node.childNodes);
  49094. if (all) {
  49095. node.checked = true;
  49096. node.indeterminate = false;
  49097. } else if (half) {
  49098. node.checked = false;
  49099. node.indeterminate = true;
  49100. } else if (none) {
  49101. node.checked = false;
  49102. node.indeterminate = false;
  49103. }
  49104. const parent = node.parent;
  49105. if (!parent || parent.level === 0)
  49106. return;
  49107. if (!node.store.checkStrictly) {
  49108. reInitChecked(parent);
  49109. }
  49110. };
  49111. const getPropertyFromData = function(node, prop) {
  49112. const props = node.store.props;
  49113. const data = node.data || {};
  49114. const config = props[prop];
  49115. if (typeof config === "function") {
  49116. return config(data, node);
  49117. } else if (typeof config === "string") {
  49118. return data[config];
  49119. } else if (typeof config === "undefined") {
  49120. const dataProp = data[prop];
  49121. return dataProp === void 0 ? "" : dataProp;
  49122. }
  49123. };
  49124. let nodeIdSeed = 0;
  49125. class Node {
  49126. constructor(options) {
  49127. this.id = nodeIdSeed++;
  49128. this.text = null;
  49129. this.checked = false;
  49130. this.indeterminate = false;
  49131. this.data = null;
  49132. this.expanded = false;
  49133. this.parent = null;
  49134. this.visible = true;
  49135. this.isCurrent = false;
  49136. this.canFocus = false;
  49137. for (const name in options) {
  49138. if (hasOwn(options, name)) {
  49139. this[name] = options[name];
  49140. }
  49141. }
  49142. this.level = 0;
  49143. this.loaded = false;
  49144. this.childNodes = [];
  49145. this.loading = false;
  49146. if (this.parent) {
  49147. this.level = this.parent.level + 1;
  49148. }
  49149. }
  49150. initialize() {
  49151. const store = this.store;
  49152. if (!store) {
  49153. throw new Error("[Node]store is required!");
  49154. }
  49155. store.registerNode(this);
  49156. const props = store.props;
  49157. if (props && typeof props.isLeaf !== "undefined") {
  49158. const isLeaf = getPropertyFromData(this, "isLeaf");
  49159. if (typeof isLeaf === "boolean") {
  49160. this.isLeafByUser = isLeaf;
  49161. }
  49162. }
  49163. if (store.lazy !== true && this.data) {
  49164. this.setData(this.data);
  49165. if (store.defaultExpandAll) {
  49166. this.expanded = true;
  49167. this.canFocus = true;
  49168. }
  49169. } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
  49170. this.expand();
  49171. }
  49172. if (!Array.isArray(this.data)) {
  49173. markNodeData(this, this.data);
  49174. }
  49175. if (!this.data)
  49176. return;
  49177. const defaultExpandedKeys = store.defaultExpandedKeys;
  49178. const key = store.key;
  49179. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  49180. this.expand(null, store.autoExpandParent);
  49181. }
  49182. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  49183. store.currentNode = this;
  49184. store.currentNode.isCurrent = true;
  49185. }
  49186. if (store.lazy) {
  49187. store._initDefaultCheckedNode(this);
  49188. }
  49189. this.updateLeafState();
  49190. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  49191. this.canFocus = true;
  49192. }
  49193. setData(data) {
  49194. if (!Array.isArray(data)) {
  49195. markNodeData(this, data);
  49196. }
  49197. this.data = data;
  49198. this.childNodes = [];
  49199. let children;
  49200. if (this.level === 0 && Array.isArray(this.data)) {
  49201. children = this.data;
  49202. } else {
  49203. children = getPropertyFromData(this, "children") || [];
  49204. }
  49205. for (let i = 0, j = children.length; i < j; i++) {
  49206. this.insertChild({ data: children[i] });
  49207. }
  49208. }
  49209. get label() {
  49210. return getPropertyFromData(this, "label");
  49211. }
  49212. get key() {
  49213. const nodeKey = this.store.key;
  49214. if (this.data)
  49215. return this.data[nodeKey];
  49216. return null;
  49217. }
  49218. get disabled() {
  49219. return getPropertyFromData(this, "disabled");
  49220. }
  49221. get nextSibling() {
  49222. const parent = this.parent;
  49223. if (parent) {
  49224. const index = parent.childNodes.indexOf(this);
  49225. if (index > -1) {
  49226. return parent.childNodes[index + 1];
  49227. }
  49228. }
  49229. return null;
  49230. }
  49231. get previousSibling() {
  49232. const parent = this.parent;
  49233. if (parent) {
  49234. const index = parent.childNodes.indexOf(this);
  49235. if (index > -1) {
  49236. return index > 0 ? parent.childNodes[index - 1] : null;
  49237. }
  49238. }
  49239. return null;
  49240. }
  49241. contains(target, deep = true) {
  49242. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  49243. }
  49244. remove() {
  49245. const parent = this.parent;
  49246. if (parent) {
  49247. parent.removeChild(this);
  49248. }
  49249. }
  49250. insertChild(child, index, batch) {
  49251. if (!child)
  49252. throw new Error("InsertChild error: child is required.");
  49253. if (!(child instanceof Node)) {
  49254. if (!batch) {
  49255. const children = this.getChildren(true);
  49256. if (!children.includes(child.data)) {
  49257. if (typeof index === "undefined" || index < 0) {
  49258. children.push(child.data);
  49259. } else {
  49260. children.splice(index, 0, child.data);
  49261. }
  49262. }
  49263. }
  49264. Object.assign(child, {
  49265. parent: this,
  49266. store: this.store
  49267. });
  49268. child = vue.reactive(new Node(child));
  49269. if (child instanceof Node) {
  49270. child.initialize();
  49271. }
  49272. }
  49273. child.level = this.level + 1;
  49274. if (typeof index === "undefined" || index < 0) {
  49275. this.childNodes.push(child);
  49276. } else {
  49277. this.childNodes.splice(index, 0, child);
  49278. }
  49279. this.updateLeafState();
  49280. }
  49281. insertBefore(child, ref) {
  49282. let index;
  49283. if (ref) {
  49284. index = this.childNodes.indexOf(ref);
  49285. }
  49286. this.insertChild(child, index);
  49287. }
  49288. insertAfter(child, ref) {
  49289. let index;
  49290. if (ref) {
  49291. index = this.childNodes.indexOf(ref);
  49292. if (index !== -1)
  49293. index += 1;
  49294. }
  49295. this.insertChild(child, index);
  49296. }
  49297. removeChild(child) {
  49298. const children = this.getChildren() || [];
  49299. const dataIndex = children.indexOf(child.data);
  49300. if (dataIndex > -1) {
  49301. children.splice(dataIndex, 1);
  49302. }
  49303. const index = this.childNodes.indexOf(child);
  49304. if (index > -1) {
  49305. this.store && this.store.deregisterNode(child);
  49306. child.parent = null;
  49307. this.childNodes.splice(index, 1);
  49308. }
  49309. this.updateLeafState();
  49310. }
  49311. removeChildByData(data) {
  49312. let targetNode = null;
  49313. for (let i = 0; i < this.childNodes.length; i++) {
  49314. if (this.childNodes[i].data === data) {
  49315. targetNode = this.childNodes[i];
  49316. break;
  49317. }
  49318. }
  49319. if (targetNode) {
  49320. this.removeChild(targetNode);
  49321. }
  49322. }
  49323. expand(callback, expandParent) {
  49324. const done = () => {
  49325. if (expandParent) {
  49326. let parent = this.parent;
  49327. while (parent.level > 0) {
  49328. parent.expanded = true;
  49329. parent = parent.parent;
  49330. }
  49331. }
  49332. this.expanded = true;
  49333. if (callback)
  49334. callback();
  49335. this.childNodes.forEach((item) => {
  49336. item.canFocus = true;
  49337. });
  49338. };
  49339. if (this.shouldLoadData()) {
  49340. this.loadData((data) => {
  49341. if (Array.isArray(data)) {
  49342. if (this.checked) {
  49343. this.setChecked(true, true);
  49344. } else if (!this.store.checkStrictly) {
  49345. reInitChecked(this);
  49346. }
  49347. done();
  49348. }
  49349. });
  49350. } else {
  49351. done();
  49352. }
  49353. }
  49354. doCreateChildren(array, defaultProps = {}) {
  49355. array.forEach((item) => {
  49356. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  49357. });
  49358. }
  49359. collapse() {
  49360. this.expanded = false;
  49361. this.childNodes.forEach((item) => {
  49362. item.canFocus = false;
  49363. });
  49364. }
  49365. shouldLoadData() {
  49366. return this.store.lazy === true && this.store.load && !this.loaded;
  49367. }
  49368. updateLeafState() {
  49369. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  49370. this.isLeaf = this.isLeafByUser;
  49371. return;
  49372. }
  49373. const childNodes = this.childNodes;
  49374. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  49375. this.isLeaf = !childNodes || childNodes.length === 0;
  49376. return;
  49377. }
  49378. this.isLeaf = false;
  49379. }
  49380. setChecked(value, deep, recursion, passValue) {
  49381. this.indeterminate = value === "half";
  49382. this.checked = value === true;
  49383. if (this.store.checkStrictly)
  49384. return;
  49385. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  49386. const { all, allWithoutDisable } = getChildState(this.childNodes);
  49387. if (!this.isLeaf && !all && allWithoutDisable) {
  49388. this.checked = false;
  49389. value = false;
  49390. }
  49391. const handleDescendants = () => {
  49392. if (deep) {
  49393. const childNodes = this.childNodes;
  49394. for (let i = 0, j = childNodes.length; i < j; i++) {
  49395. const child = childNodes[i];
  49396. passValue = passValue || value !== false;
  49397. const isCheck = child.disabled ? child.checked : passValue;
  49398. child.setChecked(isCheck, deep, true, passValue);
  49399. }
  49400. const { half, all: all2 } = getChildState(childNodes);
  49401. if (!all2) {
  49402. this.checked = all2;
  49403. this.indeterminate = half;
  49404. }
  49405. }
  49406. };
  49407. if (this.shouldLoadData()) {
  49408. this.loadData(() => {
  49409. handleDescendants();
  49410. reInitChecked(this);
  49411. }, {
  49412. checked: value !== false
  49413. });
  49414. return;
  49415. } else {
  49416. handleDescendants();
  49417. }
  49418. }
  49419. const parent = this.parent;
  49420. if (!parent || parent.level === 0)
  49421. return;
  49422. if (!recursion) {
  49423. reInitChecked(parent);
  49424. }
  49425. }
  49426. getChildren(forceInit = false) {
  49427. if (this.level === 0)
  49428. return this.data;
  49429. const data = this.data;
  49430. if (!data)
  49431. return null;
  49432. const props = this.store.props;
  49433. let children = "children";
  49434. if (props) {
  49435. children = props.children || "children";
  49436. }
  49437. if (data[children] === void 0) {
  49438. data[children] = null;
  49439. }
  49440. if (forceInit && !data[children]) {
  49441. data[children] = [];
  49442. }
  49443. return data[children];
  49444. }
  49445. updateChildren() {
  49446. const newData = this.getChildren() || [];
  49447. const oldData = this.childNodes.map((node) => node.data);
  49448. const newDataMap = {};
  49449. const newNodes = [];
  49450. newData.forEach((item, index) => {
  49451. const key = item[NODE_KEY];
  49452. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  49453. if (isNodeExists) {
  49454. newDataMap[key] = { index, data: item };
  49455. } else {
  49456. newNodes.push({ index, data: item });
  49457. }
  49458. });
  49459. if (!this.store.lazy) {
  49460. oldData.forEach((item) => {
  49461. if (!newDataMap[item[NODE_KEY]])
  49462. this.removeChildByData(item);
  49463. });
  49464. }
  49465. newNodes.forEach(({ index, data }) => {
  49466. this.insertChild({ data }, index);
  49467. });
  49468. this.updateLeafState();
  49469. }
  49470. loadData(callback, defaultProps = {}) {
  49471. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  49472. this.loading = true;
  49473. const resolve = (children) => {
  49474. this.childNodes = [];
  49475. this.doCreateChildren(children, defaultProps);
  49476. this.loaded = true;
  49477. this.loading = false;
  49478. this.updateLeafState();
  49479. if (callback) {
  49480. callback.call(this, children);
  49481. }
  49482. };
  49483. this.store.load(this, resolve);
  49484. } else {
  49485. if (callback) {
  49486. callback.call(this);
  49487. }
  49488. }
  49489. }
  49490. }
  49491. var Node$1 = Node;
  49492. class TreeStore {
  49493. constructor(options) {
  49494. this.currentNode = null;
  49495. this.currentNodeKey = null;
  49496. for (const option in options) {
  49497. if (hasOwn(options, option)) {
  49498. this[option] = options[option];
  49499. }
  49500. }
  49501. this.nodesMap = {};
  49502. }
  49503. initialize() {
  49504. this.root = new Node$1({
  49505. data: this.data,
  49506. store: this
  49507. });
  49508. this.root.initialize();
  49509. if (this.lazy && this.load) {
  49510. const loadFn = this.load;
  49511. loadFn(this.root, (data) => {
  49512. this.root.doCreateChildren(data);
  49513. this._initDefaultCheckedNodes();
  49514. });
  49515. } else {
  49516. this._initDefaultCheckedNodes();
  49517. }
  49518. }
  49519. filter(value) {
  49520. const filterNodeMethod = this.filterNodeMethod;
  49521. const lazy = this.lazy;
  49522. const traverse = function(node) {
  49523. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  49524. childNodes.forEach((child) => {
  49525. child.visible = filterNodeMethod.call(child, value, child.data, child);
  49526. traverse(child);
  49527. });
  49528. if (!node.visible && childNodes.length) {
  49529. let allHidden = true;
  49530. allHidden = !childNodes.some((child) => child.visible);
  49531. if (node.root) {
  49532. node.root.visible = allHidden === false;
  49533. } else {
  49534. node.visible = allHidden === false;
  49535. }
  49536. }
  49537. if (!value)
  49538. return;
  49539. if (node.visible && !node.isLeaf && !lazy)
  49540. node.expand();
  49541. };
  49542. traverse(this);
  49543. }
  49544. setData(newVal) {
  49545. const instanceChanged = newVal !== this.root.data;
  49546. if (instanceChanged) {
  49547. this.root.setData(newVal);
  49548. this._initDefaultCheckedNodes();
  49549. } else {
  49550. this.root.updateChildren();
  49551. }
  49552. }
  49553. getNode(data) {
  49554. if (data instanceof Node$1)
  49555. return data;
  49556. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  49557. return this.nodesMap[key] || null;
  49558. }
  49559. insertBefore(data, refData) {
  49560. const refNode = this.getNode(refData);
  49561. refNode.parent.insertBefore({ data }, refNode);
  49562. }
  49563. insertAfter(data, refData) {
  49564. const refNode = this.getNode(refData);
  49565. refNode.parent.insertAfter({ data }, refNode);
  49566. }
  49567. remove(data) {
  49568. const node = this.getNode(data);
  49569. if (node && node.parent) {
  49570. if (node === this.currentNode) {
  49571. this.currentNode = null;
  49572. }
  49573. node.parent.removeChild(node);
  49574. }
  49575. }
  49576. append(data, parentData) {
  49577. const parentNode = parentData ? this.getNode(parentData) : this.root;
  49578. if (parentNode) {
  49579. parentNode.insertChild({ data });
  49580. }
  49581. }
  49582. _initDefaultCheckedNodes() {
  49583. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  49584. const nodesMap = this.nodesMap;
  49585. defaultCheckedKeys.forEach((checkedKey) => {
  49586. const node = nodesMap[checkedKey];
  49587. if (node) {
  49588. node.setChecked(true, !this.checkStrictly);
  49589. }
  49590. });
  49591. }
  49592. _initDefaultCheckedNode(node) {
  49593. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  49594. if (defaultCheckedKeys.includes(node.key)) {
  49595. node.setChecked(true, !this.checkStrictly);
  49596. }
  49597. }
  49598. setDefaultCheckedKey(newVal) {
  49599. if (newVal !== this.defaultCheckedKeys) {
  49600. this.defaultCheckedKeys = newVal;
  49601. this._initDefaultCheckedNodes();
  49602. }
  49603. }
  49604. registerNode(node) {
  49605. const key = this.key;
  49606. if (!node || !node.data)
  49607. return;
  49608. if (!key) {
  49609. this.nodesMap[node.id] = node;
  49610. } else {
  49611. const nodeKey = node.key;
  49612. if (nodeKey !== void 0)
  49613. this.nodesMap[node.key] = node;
  49614. }
  49615. }
  49616. deregisterNode(node) {
  49617. const key = this.key;
  49618. if (!key || !node || !node.data)
  49619. return;
  49620. node.childNodes.forEach((child) => {
  49621. this.deregisterNode(child);
  49622. });
  49623. delete this.nodesMap[node.key];
  49624. }
  49625. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  49626. const checkedNodes = [];
  49627. const traverse = function(node) {
  49628. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  49629. childNodes.forEach((child) => {
  49630. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  49631. checkedNodes.push(child.data);
  49632. }
  49633. traverse(child);
  49634. });
  49635. };
  49636. traverse(this);
  49637. return checkedNodes;
  49638. }
  49639. getCheckedKeys(leafOnly = false) {
  49640. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  49641. }
  49642. getHalfCheckedNodes() {
  49643. const nodes = [];
  49644. const traverse = function(node) {
  49645. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  49646. childNodes.forEach((child) => {
  49647. if (child.indeterminate) {
  49648. nodes.push(child.data);
  49649. }
  49650. traverse(child);
  49651. });
  49652. };
  49653. traverse(this);
  49654. return nodes;
  49655. }
  49656. getHalfCheckedKeys() {
  49657. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  49658. }
  49659. _getAllNodes() {
  49660. const allNodes = [];
  49661. const nodesMap = this.nodesMap;
  49662. for (const nodeKey in nodesMap) {
  49663. if (hasOwn(nodesMap, nodeKey)) {
  49664. allNodes.push(nodesMap[nodeKey]);
  49665. }
  49666. }
  49667. return allNodes;
  49668. }
  49669. updateChildren(key, data) {
  49670. const node = this.nodesMap[key];
  49671. if (!node)
  49672. return;
  49673. const childNodes = node.childNodes;
  49674. for (let i = childNodes.length - 1; i >= 0; i--) {
  49675. const child = childNodes[i];
  49676. this.remove(child.data);
  49677. }
  49678. for (let i = 0, j = data.length; i < j; i++) {
  49679. const child = data[i];
  49680. this.append(child, node.data);
  49681. }
  49682. }
  49683. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  49684. const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level);
  49685. const cache = /* @__PURE__ */ Object.create(null);
  49686. const keys = Object.keys(checkedKeys);
  49687. allNodes.forEach((node) => node.setChecked(false, false));
  49688. for (let i = 0, j = allNodes.length; i < j; i++) {
  49689. const node = allNodes[i];
  49690. const nodeKey = node.data[key].toString();
  49691. const checked = keys.includes(nodeKey);
  49692. if (!checked) {
  49693. if (node.checked && !cache[nodeKey]) {
  49694. node.setChecked(false, false);
  49695. }
  49696. continue;
  49697. }
  49698. let parent = node.parent;
  49699. while (parent && parent.level > 0) {
  49700. cache[parent.data[key]] = true;
  49701. parent = parent.parent;
  49702. }
  49703. if (node.isLeaf || this.checkStrictly) {
  49704. node.setChecked(true, false);
  49705. continue;
  49706. }
  49707. node.setChecked(true, true);
  49708. if (leafOnly) {
  49709. node.setChecked(false, false);
  49710. const traverse = function(node2) {
  49711. const childNodes = node2.childNodes;
  49712. childNodes.forEach((child) => {
  49713. if (!child.isLeaf) {
  49714. child.setChecked(false, false);
  49715. }
  49716. traverse(child);
  49717. });
  49718. };
  49719. traverse(node);
  49720. }
  49721. }
  49722. }
  49723. setCheckedNodes(array, leafOnly = false) {
  49724. const key = this.key;
  49725. const checkedKeys = {};
  49726. array.forEach((item) => {
  49727. checkedKeys[(item || {})[key]] = true;
  49728. });
  49729. this._setCheckedKeys(key, leafOnly, checkedKeys);
  49730. }
  49731. setCheckedKeys(keys, leafOnly = false) {
  49732. this.defaultCheckedKeys = keys;
  49733. const key = this.key;
  49734. const checkedKeys = {};
  49735. keys.forEach((key2) => {
  49736. checkedKeys[key2] = true;
  49737. });
  49738. this._setCheckedKeys(key, leafOnly, checkedKeys);
  49739. }
  49740. setDefaultExpandedKeys(keys) {
  49741. keys = keys || [];
  49742. this.defaultExpandedKeys = keys;
  49743. keys.forEach((key) => {
  49744. const node = this.getNode(key);
  49745. if (node)
  49746. node.expand(null, this.autoExpandParent);
  49747. });
  49748. }
  49749. setChecked(data, checked, deep) {
  49750. const node = this.getNode(data);
  49751. if (node) {
  49752. node.setChecked(!!checked, deep);
  49753. }
  49754. }
  49755. getCurrentNode() {
  49756. return this.currentNode;
  49757. }
  49758. setCurrentNode(currentNode) {
  49759. const prevCurrentNode = this.currentNode;
  49760. if (prevCurrentNode) {
  49761. prevCurrentNode.isCurrent = false;
  49762. }
  49763. this.currentNode = currentNode;
  49764. this.currentNode.isCurrent = true;
  49765. }
  49766. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  49767. const key = node[this.key];
  49768. const currNode = this.nodesMap[key];
  49769. this.setCurrentNode(currNode);
  49770. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  49771. this.currentNode.parent.expand(null, true);
  49772. }
  49773. }
  49774. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  49775. if (key === null || key === void 0) {
  49776. this.currentNode && (this.currentNode.isCurrent = false);
  49777. this.currentNode = null;
  49778. return;
  49779. }
  49780. const node = this.getNode(key);
  49781. if (node) {
  49782. this.setCurrentNode(node);
  49783. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  49784. this.currentNode.parent.expand(null, true);
  49785. }
  49786. }
  49787. }
  49788. }
  49789. const _sfc_main$c = vue.defineComponent({
  49790. name: "ElTreeNodeContent",
  49791. props: {
  49792. node: {
  49793. type: Object,
  49794. required: true
  49795. },
  49796. renderContent: Function
  49797. },
  49798. setup(props) {
  49799. const ns = useNamespace("tree");
  49800. const nodeInstance = vue.inject("NodeInstance");
  49801. const tree = vue.inject("RootTree");
  49802. return () => {
  49803. const node = props.node;
  49804. const { data, store } = node;
  49805. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : tree.ctx.slots.default ? tree.ctx.slots.default({ node, data }) : vue.h("span", { class: ns.be("node", "label") }, [node.label]);
  49806. };
  49807. }
  49808. });
  49809. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "tree-node-content.vue"]]);
  49810. function useNodeExpandEventBroadcast(props) {
  49811. const parentNodeMap = vue.inject("TreeNodeMap", null);
  49812. const currentNodeMap = {
  49813. treeNodeExpand: (node) => {
  49814. if (props.node !== node) {
  49815. props.node.collapse();
  49816. }
  49817. },
  49818. children: []
  49819. };
  49820. if (parentNodeMap) {
  49821. parentNodeMap.children.push(currentNodeMap);
  49822. }
  49823. vue.provide("TreeNodeMap", currentNodeMap);
  49824. return {
  49825. broadcastExpanded: (node) => {
  49826. if (!props.accordion)
  49827. return;
  49828. for (const childNode of currentNodeMap.children) {
  49829. childNode.treeNodeExpand(node);
  49830. }
  49831. }
  49832. };
  49833. }
  49834. const dragEventsKey = Symbol("dragEvents");
  49835. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  49836. const ns = useNamespace("tree");
  49837. const dragState = vue.ref({
  49838. showDropIndicator: false,
  49839. draggingNode: null,
  49840. dropNode: null,
  49841. allowDrop: true,
  49842. dropType: null
  49843. });
  49844. const treeNodeDragStart = ({ event, treeNode }) => {
  49845. if (typeof props.allowDrag === "function" && !props.allowDrag(treeNode.node)) {
  49846. event.preventDefault();
  49847. return false;
  49848. }
  49849. event.dataTransfer.effectAllowed = "move";
  49850. try {
  49851. event.dataTransfer.setData("text/plain", "");
  49852. } catch (e) {
  49853. }
  49854. dragState.value.draggingNode = treeNode;
  49855. ctx.emit("node-drag-start", treeNode.node, event);
  49856. };
  49857. const treeNodeDragOver = ({ event, treeNode }) => {
  49858. const dropNode = treeNode;
  49859. const oldDropNode = dragState.value.dropNode;
  49860. if (oldDropNode && oldDropNode !== dropNode) {
  49861. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  49862. }
  49863. const draggingNode = dragState.value.draggingNode;
  49864. if (!draggingNode || !dropNode)
  49865. return;
  49866. let dropPrev = true;
  49867. let dropInner = true;
  49868. let dropNext = true;
  49869. let userAllowDropInner = true;
  49870. if (typeof props.allowDrop === "function") {
  49871. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  49872. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  49873. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  49874. }
  49875. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  49876. if ((dropPrev || dropInner || dropNext) && oldDropNode !== dropNode) {
  49877. if (oldDropNode) {
  49878. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  49879. }
  49880. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  49881. }
  49882. if (dropPrev || dropInner || dropNext) {
  49883. dragState.value.dropNode = dropNode;
  49884. }
  49885. if (dropNode.node.nextSibling === draggingNode.node) {
  49886. dropNext = false;
  49887. }
  49888. if (dropNode.node.previousSibling === draggingNode.node) {
  49889. dropPrev = false;
  49890. }
  49891. if (dropNode.node.contains(draggingNode.node, false)) {
  49892. dropInner = false;
  49893. }
  49894. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  49895. dropPrev = false;
  49896. dropInner = false;
  49897. dropNext = false;
  49898. }
  49899. const targetPosition = dropNode.$el.getBoundingClientRect();
  49900. const treePosition = el$.value.getBoundingClientRect();
  49901. let dropType;
  49902. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  49903. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  49904. let indicatorTop = -9999;
  49905. const distance = event.clientY - targetPosition.top;
  49906. if (distance < targetPosition.height * prevPercent) {
  49907. dropType = "before";
  49908. } else if (distance > targetPosition.height * nextPercent) {
  49909. dropType = "after";
  49910. } else if (dropInner) {
  49911. dropType = "inner";
  49912. } else {
  49913. dropType = "none";
  49914. }
  49915. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  49916. const dropIndicator = dropIndicator$.value;
  49917. if (dropType === "before") {
  49918. indicatorTop = iconPosition.top - treePosition.top;
  49919. } else if (dropType === "after") {
  49920. indicatorTop = iconPosition.bottom - treePosition.top;
  49921. }
  49922. dropIndicator.style.top = `${indicatorTop}px`;
  49923. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  49924. if (dropType === "inner") {
  49925. addClass(dropNode.$el, ns.is("drop-inner"));
  49926. } else {
  49927. removeClass(dropNode.$el, ns.is("drop-inner"));
  49928. }
  49929. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  49930. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  49931. dragState.value.dropType = dropType;
  49932. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  49933. };
  49934. const treeNodeDragEnd = (event) => {
  49935. const { draggingNode, dropType, dropNode } = dragState.value;
  49936. event.preventDefault();
  49937. event.dataTransfer.dropEffect = "move";
  49938. if (draggingNode && dropNode) {
  49939. const draggingNodeCopy = { data: draggingNode.node.data };
  49940. if (dropType !== "none") {
  49941. draggingNode.node.remove();
  49942. }
  49943. if (dropType === "before") {
  49944. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  49945. } else if (dropType === "after") {
  49946. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  49947. } else if (dropType === "inner") {
  49948. dropNode.node.insertChild(draggingNodeCopy);
  49949. }
  49950. if (dropType !== "none") {
  49951. store.value.registerNode(draggingNodeCopy);
  49952. }
  49953. removeClass(dropNode.$el, ns.is("drop-inner"));
  49954. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  49955. if (dropType !== "none") {
  49956. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  49957. }
  49958. }
  49959. if (draggingNode && !dropNode) {
  49960. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  49961. }
  49962. dragState.value.showDropIndicator = false;
  49963. dragState.value.draggingNode = null;
  49964. dragState.value.dropNode = null;
  49965. dragState.value.allowDrop = true;
  49966. };
  49967. vue.provide(dragEventsKey, {
  49968. treeNodeDragStart,
  49969. treeNodeDragOver,
  49970. treeNodeDragEnd
  49971. });
  49972. return {
  49973. dragState
  49974. };
  49975. }
  49976. const _sfc_main$b = vue.defineComponent({
  49977. name: "ElTreeNode",
  49978. components: {
  49979. ElCollapseTransition: _CollapseTransition,
  49980. ElCheckbox,
  49981. NodeContent,
  49982. ElIcon,
  49983. Loading: loading_default
  49984. },
  49985. props: {
  49986. node: {
  49987. type: Node$1,
  49988. default: () => ({})
  49989. },
  49990. props: {
  49991. type: Object,
  49992. default: () => ({})
  49993. },
  49994. accordion: Boolean,
  49995. renderContent: Function,
  49996. renderAfterExpand: Boolean,
  49997. showCheckbox: {
  49998. type: Boolean,
  49999. default: false
  50000. }
  50001. },
  50002. emits: ["node-expand"],
  50003. setup(props, ctx) {
  50004. const ns = useNamespace("tree");
  50005. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  50006. const tree = vue.inject("RootTree");
  50007. const expanded = vue.ref(false);
  50008. const childNodeRendered = vue.ref(false);
  50009. const oldChecked = vue.ref(null);
  50010. const oldIndeterminate = vue.ref(null);
  50011. const node$ = vue.ref(null);
  50012. const dragEvents = vue.inject(dragEventsKey);
  50013. const instance = vue.getCurrentInstance();
  50014. vue.provide("NodeInstance", instance);
  50015. if (props.node.expanded) {
  50016. expanded.value = true;
  50017. childNodeRendered.value = true;
  50018. }
  50019. const childrenKey = tree.props["children"] || "children";
  50020. vue.watch(() => {
  50021. const children = props.node.data[childrenKey];
  50022. return children && [...children];
  50023. }, () => {
  50024. props.node.updateChildren();
  50025. });
  50026. vue.watch(() => props.node.indeterminate, (val) => {
  50027. handleSelectChange(props.node.checked, val);
  50028. });
  50029. vue.watch(() => props.node.checked, (val) => {
  50030. handleSelectChange(val, props.node.indeterminate);
  50031. });
  50032. vue.watch(() => props.node.expanded, (val) => {
  50033. vue.nextTick(() => expanded.value = val);
  50034. if (val) {
  50035. childNodeRendered.value = true;
  50036. }
  50037. });
  50038. const getNodeKey$1 = (node) => {
  50039. return getNodeKey(tree.props.nodeKey, node.data);
  50040. };
  50041. const getNodeClass = (node) => {
  50042. const nodeClassFunc = props.props.class;
  50043. if (!nodeClassFunc) {
  50044. return {};
  50045. }
  50046. let className;
  50047. if (isFunction$1(nodeClassFunc)) {
  50048. const { data } = node;
  50049. className = nodeClassFunc(data, node);
  50050. } else {
  50051. className = nodeClassFunc;
  50052. }
  50053. if (isString$1(className)) {
  50054. return { [className]: true };
  50055. } else {
  50056. return className;
  50057. }
  50058. };
  50059. const handleSelectChange = (checked, indeterminate) => {
  50060. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  50061. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  50062. }
  50063. oldChecked.value = checked;
  50064. oldIndeterminate.value = indeterminate;
  50065. };
  50066. const handleClick = (e) => {
  50067. handleCurrentChange(tree.store, tree.ctx.emit, () => tree.store.value.setCurrentNode(props.node));
  50068. tree.currentNode.value = props.node;
  50069. if (tree.props.expandOnClickNode) {
  50070. handleExpandIconClick();
  50071. }
  50072. if (tree.props.checkOnClickNode && !props.node.disabled) {
  50073. handleCheckChange(null, {
  50074. target: { checked: !props.node.checked }
  50075. });
  50076. }
  50077. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  50078. };
  50079. const handleContextMenu = (event) => {
  50080. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  50081. event.stopPropagation();
  50082. event.preventDefault();
  50083. }
  50084. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  50085. };
  50086. const handleExpandIconClick = () => {
  50087. if (props.node.isLeaf)
  50088. return;
  50089. if (expanded.value) {
  50090. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  50091. props.node.collapse();
  50092. } else {
  50093. props.node.expand();
  50094. ctx.emit("node-expand", props.node.data, props.node, instance);
  50095. }
  50096. };
  50097. const handleCheckChange = (value, ev) => {
  50098. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  50099. vue.nextTick(() => {
  50100. const store = tree.store.value;
  50101. tree.ctx.emit("check", props.node.data, {
  50102. checkedNodes: store.getCheckedNodes(),
  50103. checkedKeys: store.getCheckedKeys(),
  50104. halfCheckedNodes: store.getHalfCheckedNodes(),
  50105. halfCheckedKeys: store.getHalfCheckedKeys()
  50106. });
  50107. });
  50108. };
  50109. const handleChildNodeExpand = (nodeData, node, instance2) => {
  50110. broadcastExpanded(node);
  50111. tree.ctx.emit("node-expand", nodeData, node, instance2);
  50112. };
  50113. const handleDragStart = (event) => {
  50114. if (!tree.props.draggable)
  50115. return;
  50116. dragEvents.treeNodeDragStart({ event, treeNode: props });
  50117. };
  50118. const handleDragOver = (event) => {
  50119. event.preventDefault();
  50120. if (!tree.props.draggable)
  50121. return;
  50122. dragEvents.treeNodeDragOver({
  50123. event,
  50124. treeNode: { $el: node$.value, node: props.node }
  50125. });
  50126. };
  50127. const handleDrop = (event) => {
  50128. event.preventDefault();
  50129. };
  50130. const handleDragEnd = (event) => {
  50131. if (!tree.props.draggable)
  50132. return;
  50133. dragEvents.treeNodeDragEnd(event);
  50134. };
  50135. return {
  50136. ns,
  50137. node$,
  50138. tree,
  50139. expanded,
  50140. childNodeRendered,
  50141. oldChecked,
  50142. oldIndeterminate,
  50143. getNodeKey: getNodeKey$1,
  50144. getNodeClass,
  50145. handleSelectChange,
  50146. handleClick,
  50147. handleContextMenu,
  50148. handleExpandIconClick,
  50149. handleCheckChange,
  50150. handleChildNodeExpand,
  50151. handleDragStart,
  50152. handleDragOver,
  50153. handleDrop,
  50154. handleDragEnd,
  50155. CaretRight: caret_right_default
  50156. };
  50157. }
  50158. });
  50159. const _hoisted_1$7 = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"];
  50160. const _hoisted_2$5 = ["aria-expanded"];
  50161. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  50162. const _component_el_icon = vue.resolveComponent("el-icon");
  50163. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  50164. const _component_loading = vue.resolveComponent("loading");
  50165. const _component_node_content = vue.resolveComponent("node-content");
  50166. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  50167. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  50168. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  50169. ref: "node$",
  50170. class: vue.normalizeClass([
  50171. _ctx.ns.b("node"),
  50172. _ctx.ns.is("expanded", _ctx.expanded),
  50173. _ctx.ns.is("current", _ctx.node.isCurrent),
  50174. _ctx.ns.is("hidden", !_ctx.node.visible),
  50175. _ctx.ns.is("focusable", !_ctx.node.disabled),
  50176. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  50177. _ctx.getNodeClass(_ctx.node)
  50178. ]),
  50179. role: "treeitem",
  50180. tabindex: "-1",
  50181. "aria-expanded": _ctx.expanded,
  50182. "aria-disabled": _ctx.node.disabled,
  50183. "aria-checked": _ctx.node.checked,
  50184. draggable: _ctx.tree.props.draggable,
  50185. "data-key": _ctx.getNodeKey(_ctx.node),
  50186. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
  50187. onContextmenu: _cache[2] || (_cache[2] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
  50188. onDragstart: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
  50189. onDragover: _cache[4] || (_cache[4] = vue.withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
  50190. onDragend: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
  50191. onDrop: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
  50192. }, [
  50193. vue.createElementVNode("div", {
  50194. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  50195. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  50196. }, [
  50197. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  50198. key: 0,
  50199. class: vue.normalizeClass([
  50200. _ctx.ns.be("node", "expand-icon"),
  50201. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  50202. {
  50203. expanded: !_ctx.node.isLeaf && _ctx.expanded
  50204. }
  50205. ]),
  50206. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  50207. }, {
  50208. default: vue.withCtx(() => [
  50209. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  50210. ]),
  50211. _: 1
  50212. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  50213. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  50214. key: 1,
  50215. "model-value": _ctx.node.checked,
  50216. indeterminate: _ctx.node.indeterminate,
  50217. disabled: !!_ctx.node.disabled,
  50218. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  50219. }, ["stop"])),
  50220. onChange: _ctx.handleCheckChange
  50221. }, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true),
  50222. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  50223. key: 2,
  50224. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  50225. }, {
  50226. default: vue.withCtx(() => [
  50227. vue.createVNode(_component_loading)
  50228. ]),
  50229. _: 1
  50230. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  50231. vue.createVNode(_component_node_content, {
  50232. node: _ctx.node,
  50233. "render-content": _ctx.renderContent
  50234. }, null, 8, ["node", "render-content"])
  50235. ], 6),
  50236. vue.createVNode(_component_el_collapse_transition, null, {
  50237. default: vue.withCtx(() => [
  50238. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  50239. key: 0,
  50240. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  50241. role: "group",
  50242. "aria-expanded": _ctx.expanded
  50243. }, [
  50244. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  50245. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  50246. key: _ctx.getNodeKey(child),
  50247. "render-content": _ctx.renderContent,
  50248. "render-after-expand": _ctx.renderAfterExpand,
  50249. "show-checkbox": _ctx.showCheckbox,
  50250. node: child,
  50251. accordion: _ctx.accordion,
  50252. props: _ctx.props,
  50253. onNodeExpand: _ctx.handleChildNodeExpand
  50254. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  50255. }), 128))
  50256. ], 10, _hoisted_2$5)), [
  50257. [vue.vShow, _ctx.expanded]
  50258. ]) : vue.createCommentVNode("v-if", true)
  50259. ]),
  50260. _: 1
  50261. })
  50262. ], 42, _hoisted_1$7)), [
  50263. [vue.vShow, _ctx.node.visible]
  50264. ]);
  50265. }
  50266. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  50267. function useKeydown({ el$ }, store) {
  50268. const ns = useNamespace("tree");
  50269. const treeItems = vue.shallowRef([]);
  50270. const checkboxItems = vue.shallowRef([]);
  50271. vue.onMounted(() => {
  50272. initTabIndex();
  50273. });
  50274. vue.onUpdated(() => {
  50275. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  50276. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  50277. });
  50278. vue.watch(checkboxItems, (val) => {
  50279. val.forEach((checkbox) => {
  50280. checkbox.setAttribute("tabindex", "-1");
  50281. });
  50282. });
  50283. const handleKeydown = (ev) => {
  50284. const currentItem = ev.target;
  50285. if (!currentItem.className.includes(ns.b("node")))
  50286. return;
  50287. const code = ev.code;
  50288. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  50289. const currentIndex = treeItems.value.indexOf(currentItem);
  50290. let nextIndex;
  50291. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  50292. ev.preventDefault();
  50293. if (code === EVENT_CODE.up) {
  50294. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  50295. const startIndex = nextIndex;
  50296. while (true) {
  50297. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  50298. break;
  50299. nextIndex--;
  50300. if (nextIndex === startIndex) {
  50301. nextIndex = -1;
  50302. break;
  50303. }
  50304. if (nextIndex < 0) {
  50305. nextIndex = treeItems.value.length - 1;
  50306. }
  50307. }
  50308. } else {
  50309. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  50310. const startIndex = nextIndex;
  50311. while (true) {
  50312. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  50313. break;
  50314. nextIndex++;
  50315. if (nextIndex === startIndex) {
  50316. nextIndex = -1;
  50317. break;
  50318. }
  50319. if (nextIndex >= treeItems.value.length) {
  50320. nextIndex = 0;
  50321. }
  50322. }
  50323. }
  50324. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  50325. }
  50326. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  50327. ev.preventDefault();
  50328. currentItem.click();
  50329. }
  50330. const hasInput = currentItem.querySelector('[type="checkbox"]');
  50331. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && hasInput) {
  50332. ev.preventDefault();
  50333. hasInput.click();
  50334. }
  50335. };
  50336. useEventListener(el$, "keydown", handleKeydown);
  50337. const initTabIndex = () => {
  50338. var _a;
  50339. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  50340. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  50341. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  50342. if (checkedItem.length) {
  50343. checkedItem[0].setAttribute("tabindex", "0");
  50344. return;
  50345. }
  50346. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  50347. };
  50348. }
  50349. const _sfc_main$a = vue.defineComponent({
  50350. name: "ElTree",
  50351. components: { ElTreeNode: ElTreeNode$1 },
  50352. props: {
  50353. data: {
  50354. type: Array,
  50355. default: () => []
  50356. },
  50357. emptyText: {
  50358. type: String
  50359. },
  50360. renderAfterExpand: {
  50361. type: Boolean,
  50362. default: true
  50363. },
  50364. nodeKey: String,
  50365. checkStrictly: Boolean,
  50366. defaultExpandAll: Boolean,
  50367. expandOnClickNode: {
  50368. type: Boolean,
  50369. default: true
  50370. },
  50371. checkOnClickNode: Boolean,
  50372. checkDescendants: {
  50373. type: Boolean,
  50374. default: false
  50375. },
  50376. autoExpandParent: {
  50377. type: Boolean,
  50378. default: true
  50379. },
  50380. defaultCheckedKeys: Array,
  50381. defaultExpandedKeys: Array,
  50382. currentNodeKey: [String, Number],
  50383. renderContent: Function,
  50384. showCheckbox: {
  50385. type: Boolean,
  50386. default: false
  50387. },
  50388. draggable: {
  50389. type: Boolean,
  50390. default: false
  50391. },
  50392. allowDrag: Function,
  50393. allowDrop: Function,
  50394. props: {
  50395. type: Object,
  50396. default: () => ({
  50397. children: "children",
  50398. label: "label",
  50399. disabled: "disabled"
  50400. })
  50401. },
  50402. lazy: {
  50403. type: Boolean,
  50404. default: false
  50405. },
  50406. highlightCurrent: Boolean,
  50407. load: Function,
  50408. filterNodeMethod: Function,
  50409. accordion: Boolean,
  50410. indent: {
  50411. type: Number,
  50412. default: 18
  50413. },
  50414. icon: {
  50415. type: iconPropType
  50416. }
  50417. },
  50418. emits: [
  50419. "check-change",
  50420. "current-change",
  50421. "node-click",
  50422. "node-contextmenu",
  50423. "node-collapse",
  50424. "node-expand",
  50425. "check",
  50426. "node-drag-start",
  50427. "node-drag-end",
  50428. "node-drop",
  50429. "node-drag-leave",
  50430. "node-drag-enter",
  50431. "node-drag-over"
  50432. ],
  50433. setup(props, ctx) {
  50434. const { t } = useLocale();
  50435. const ns = useNamespace("tree");
  50436. const store = vue.ref(new TreeStore({
  50437. key: props.nodeKey,
  50438. data: props.data,
  50439. lazy: props.lazy,
  50440. props: props.props,
  50441. load: props.load,
  50442. currentNodeKey: props.currentNodeKey,
  50443. checkStrictly: props.checkStrictly,
  50444. checkDescendants: props.checkDescendants,
  50445. defaultCheckedKeys: props.defaultCheckedKeys,
  50446. defaultExpandedKeys: props.defaultExpandedKeys,
  50447. autoExpandParent: props.autoExpandParent,
  50448. defaultExpandAll: props.defaultExpandAll,
  50449. filterNodeMethod: props.filterNodeMethod
  50450. }));
  50451. store.value.initialize();
  50452. const root = vue.ref(store.value.root);
  50453. const currentNode = vue.ref(null);
  50454. const el$ = vue.ref(null);
  50455. const dropIndicator$ = vue.ref(null);
  50456. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  50457. const { dragState } = useDragNodeHandler({
  50458. props,
  50459. ctx,
  50460. el$,
  50461. dropIndicator$,
  50462. store
  50463. });
  50464. useKeydown({ el$ }, store);
  50465. const isEmpty = vue.computed(() => {
  50466. const { childNodes } = root.value;
  50467. return !childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible);
  50468. });
  50469. vue.watch(() => props.currentNodeKey, (newVal) => {
  50470. store.value.setCurrentNodeKey(newVal);
  50471. });
  50472. vue.watch(() => props.defaultCheckedKeys, (newVal) => {
  50473. store.value.setDefaultCheckedKey(newVal);
  50474. });
  50475. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  50476. store.value.setDefaultExpandedKeys(newVal);
  50477. });
  50478. vue.watch(() => props.data, (newVal) => {
  50479. store.value.setData(newVal);
  50480. }, { deep: true });
  50481. vue.watch(() => props.checkStrictly, (newVal) => {
  50482. store.value.checkStrictly = newVal;
  50483. });
  50484. const filter = (value) => {
  50485. if (!props.filterNodeMethod)
  50486. throw new Error("[Tree] filterNodeMethod is required when filter");
  50487. store.value.filter(value);
  50488. };
  50489. const getNodeKey$1 = (node) => {
  50490. return getNodeKey(props.nodeKey, node.data);
  50491. };
  50492. const getNodePath = (data) => {
  50493. if (!props.nodeKey)
  50494. throw new Error("[Tree] nodeKey is required in getNodePath");
  50495. const node = store.value.getNode(data);
  50496. if (!node)
  50497. return [];
  50498. const path = [node.data];
  50499. let parent = node.parent;
  50500. while (parent && parent !== root.value) {
  50501. path.push(parent.data);
  50502. parent = parent.parent;
  50503. }
  50504. return path.reverse();
  50505. };
  50506. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  50507. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  50508. };
  50509. const getCheckedKeys = (leafOnly) => {
  50510. return store.value.getCheckedKeys(leafOnly);
  50511. };
  50512. const getCurrentNode = () => {
  50513. const currentNode2 = store.value.getCurrentNode();
  50514. return currentNode2 ? currentNode2.data : null;
  50515. };
  50516. const getCurrentKey = () => {
  50517. if (!props.nodeKey)
  50518. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  50519. const currentNode2 = getCurrentNode();
  50520. return currentNode2 ? currentNode2[props.nodeKey] : null;
  50521. };
  50522. const setCheckedNodes = (nodes, leafOnly) => {
  50523. if (!props.nodeKey)
  50524. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  50525. store.value.setCheckedNodes(nodes, leafOnly);
  50526. };
  50527. const setCheckedKeys = (keys, leafOnly) => {
  50528. if (!props.nodeKey)
  50529. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  50530. store.value.setCheckedKeys(keys, leafOnly);
  50531. };
  50532. const setChecked = (data, checked, deep) => {
  50533. store.value.setChecked(data, checked, deep);
  50534. };
  50535. const getHalfCheckedNodes = () => {
  50536. return store.value.getHalfCheckedNodes();
  50537. };
  50538. const getHalfCheckedKeys = () => {
  50539. return store.value.getHalfCheckedKeys();
  50540. };
  50541. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  50542. if (!props.nodeKey)
  50543. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  50544. handleCurrentChange(store, ctx.emit, () => store.value.setUserCurrentNode(node, shouldAutoExpandParent));
  50545. };
  50546. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  50547. if (!props.nodeKey)
  50548. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  50549. handleCurrentChange(store, ctx.emit, () => store.value.setCurrentNodeKey(key, shouldAutoExpandParent));
  50550. };
  50551. const getNode = (data) => {
  50552. return store.value.getNode(data);
  50553. };
  50554. const remove = (data) => {
  50555. store.value.remove(data);
  50556. };
  50557. const append = (data, parentNode) => {
  50558. store.value.append(data, parentNode);
  50559. };
  50560. const insertBefore = (data, refNode) => {
  50561. store.value.insertBefore(data, refNode);
  50562. };
  50563. const insertAfter = (data, refNode) => {
  50564. store.value.insertAfter(data, refNode);
  50565. };
  50566. const handleNodeExpand = (nodeData, node, instance) => {
  50567. broadcastExpanded(node);
  50568. ctx.emit("node-expand", nodeData, node, instance);
  50569. };
  50570. const updateKeyChildren = (key, data) => {
  50571. if (!props.nodeKey)
  50572. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  50573. store.value.updateChildren(key, data);
  50574. };
  50575. vue.provide("RootTree", {
  50576. ctx,
  50577. props,
  50578. store,
  50579. root,
  50580. currentNode,
  50581. instance: vue.getCurrentInstance()
  50582. });
  50583. vue.provide(formItemContextKey, void 0);
  50584. return {
  50585. ns,
  50586. store,
  50587. root,
  50588. currentNode,
  50589. dragState,
  50590. el$,
  50591. dropIndicator$,
  50592. isEmpty,
  50593. filter,
  50594. getNodeKey: getNodeKey$1,
  50595. getNodePath,
  50596. getCheckedNodes,
  50597. getCheckedKeys,
  50598. getCurrentNode,
  50599. getCurrentKey,
  50600. setCheckedNodes,
  50601. setCheckedKeys,
  50602. setChecked,
  50603. getHalfCheckedNodes,
  50604. getHalfCheckedKeys,
  50605. setCurrentNode,
  50606. setCurrentKey,
  50607. t,
  50608. getNode,
  50609. remove,
  50610. append,
  50611. insertBefore,
  50612. insertAfter,
  50613. handleNodeExpand,
  50614. updateKeyChildren
  50615. };
  50616. }
  50617. });
  50618. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  50619. var _a;
  50620. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  50621. return vue.openBlock(), vue.createElementBlock("div", {
  50622. ref: "el$",
  50623. class: vue.normalizeClass([
  50624. _ctx.ns.b(),
  50625. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  50626. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  50627. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  50628. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  50629. ]),
  50630. role: "tree"
  50631. }, [
  50632. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  50633. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  50634. key: _ctx.getNodeKey(child),
  50635. node: child,
  50636. props: _ctx.props,
  50637. accordion: _ctx.accordion,
  50638. "render-after-expand": _ctx.renderAfterExpand,
  50639. "show-checkbox": _ctx.showCheckbox,
  50640. "render-content": _ctx.renderContent,
  50641. onNodeExpand: _ctx.handleNodeExpand
  50642. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  50643. }), 128)),
  50644. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  50645. key: 0,
  50646. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  50647. }, [
  50648. vue.createElementVNode("span", {
  50649. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  50650. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  50651. ], 2)) : vue.createCommentVNode("v-if", true),
  50652. vue.withDirectives(vue.createElementVNode("div", {
  50653. ref: "dropIndicator$",
  50654. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  50655. }, null, 2), [
  50656. [vue.vShow, _ctx.dragState.showDropIndicator]
  50657. ])
  50658. ], 2);
  50659. }
  50660. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  50661. Tree.install = (app) => {
  50662. app.component(Tree.name, Tree);
  50663. };
  50664. const _Tree = Tree;
  50665. const ElTree = _Tree;
  50666. const useSelect = (props, { attrs }, {
  50667. tree,
  50668. key
  50669. }) => {
  50670. const ns = useNamespace("tree-select");
  50671. const result = {
  50672. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  50673. ...attrs,
  50674. valueKey: key,
  50675. popperClass: vue.computed(() => {
  50676. const classes = [ns.e("popper")];
  50677. if (props.popperClass)
  50678. classes.push(props.popperClass);
  50679. return classes.join(" ");
  50680. }),
  50681. filterMethod: (keyword = "") => {
  50682. if (props.filterMethod)
  50683. props.filterMethod(keyword);
  50684. vue.nextTick(() => {
  50685. var _a;
  50686. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  50687. });
  50688. },
  50689. onVisibleChange: (visible) => {
  50690. var _a;
  50691. (_a = attrs.onVisibleChange) == null ? void 0 : _a.call(attrs, visible);
  50692. if (props.filterable && visible) {
  50693. result.filterMethod();
  50694. }
  50695. }
  50696. };
  50697. return result;
  50698. };
  50699. const component = vue.defineComponent({
  50700. extends: ElOption,
  50701. setup(props, ctx) {
  50702. const result = ElOption.setup(props, ctx);
  50703. delete result.selectOptionClick;
  50704. const vm = vue.getCurrentInstance().proxy;
  50705. vue.nextTick(() => {
  50706. if (!result.select.cachedOptions.get(vm.value)) {
  50707. result.select.onOptionCreate(vm);
  50708. }
  50709. });
  50710. return result;
  50711. },
  50712. methods: {
  50713. selectOptionClick() {
  50714. this.$el.parentElement.click();
  50715. }
  50716. }
  50717. });
  50718. var TreeSelectOption = component;
  50719. function isValidValue(val) {
  50720. return val || val === 0;
  50721. }
  50722. function isValidArray(val) {
  50723. return Array.isArray(val) && val.length;
  50724. }
  50725. function toValidArray(val) {
  50726. return Array.isArray(val) ? val : isValidValue(val) ? [val] : [];
  50727. }
  50728. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  50729. for (let i = 0; i < treeData.length; i++) {
  50730. const data = treeData[i];
  50731. if (findCallback(data, i, treeData, parent)) {
  50732. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  50733. } else {
  50734. const children = getChildren(data);
  50735. if (isValidArray(children)) {
  50736. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  50737. if (find)
  50738. return find;
  50739. }
  50740. }
  50741. }
  50742. }
  50743. function treeEach(treeData, callback, getChildren, parent) {
  50744. for (let i = 0; i < treeData.length; i++) {
  50745. const data = treeData[i];
  50746. callback(data, i, treeData, parent);
  50747. const children = getChildren(data);
  50748. if (isValidArray(children)) {
  50749. treeEach(children, callback, getChildren, data);
  50750. }
  50751. }
  50752. }
  50753. const useTree$1 = (props, { attrs, slots, emit }, {
  50754. select,
  50755. tree,
  50756. key
  50757. }) => {
  50758. vue.watch(() => props.modelValue, () => {
  50759. if (props.showCheckbox) {
  50760. vue.nextTick(() => {
  50761. const treeInstance = tree.value;
  50762. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  50763. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  50764. }
  50765. });
  50766. }
  50767. }, {
  50768. immediate: true,
  50769. deep: true
  50770. });
  50771. const propsMap = vue.computed(() => ({
  50772. value: key.value,
  50773. label: "label",
  50774. children: "children",
  50775. disabled: "disabled",
  50776. isLeaf: "isLeaf",
  50777. ...props.props
  50778. }));
  50779. const getNodeValByProp = (prop, data) => {
  50780. var _a;
  50781. const propVal = propsMap.value[prop];
  50782. if (isFunction$1(propVal)) {
  50783. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  50784. } else {
  50785. return data[propVal];
  50786. }
  50787. };
  50788. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  50789. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  50790. }).filter((item) => isValidValue(item));
  50791. const cacheOptions = vue.computed(() => {
  50792. if (!props.renderAfterExpand && !props.lazy)
  50793. return [];
  50794. const options = [];
  50795. treeEach(props.data.concat(props.cacheData), (node) => {
  50796. const value = getNodeValByProp("value", node);
  50797. options.push({
  50798. value,
  50799. currentLabel: getNodeValByProp("label", node),
  50800. isDisabled: getNodeValByProp("disabled", node)
  50801. });
  50802. }, (data) => getNodeValByProp("children", data));
  50803. return options;
  50804. });
  50805. return {
  50806. ...pick(vue.toRefs(props), Object.keys(_Tree.props)),
  50807. ...attrs,
  50808. nodeKey: key,
  50809. expandOnClickNode: vue.computed(() => {
  50810. return !props.checkStrictly && props.expandOnClickNode;
  50811. }),
  50812. defaultExpandedKeys: vue.computed(() => {
  50813. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  50814. }),
  50815. renderContent: (h, { node, data, store }) => {
  50816. return h(TreeSelectOption, {
  50817. value: getNodeValByProp("value", data),
  50818. label: getNodeValByProp("label", data),
  50819. disabled: getNodeValByProp("disabled", data)
  50820. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  50821. },
  50822. filterNodeMethod: (value, data, node) => {
  50823. var _a;
  50824. if (props.filterNodeMethod)
  50825. return props.filterNodeMethod(value, data, node);
  50826. if (!value)
  50827. return true;
  50828. return (_a = getNodeValByProp("label", data)) == null ? void 0 : _a.includes(value);
  50829. },
  50830. onNodeClick: (data, node, e) => {
  50831. var _a, _b, _c;
  50832. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  50833. if (props.showCheckbox && props.checkOnClickNode)
  50834. return;
  50835. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  50836. if (!getNodeValByProp("disabled", data)) {
  50837. const option = (_b = select.value) == null ? void 0 : _b.options.get(getNodeValByProp("value", data));
  50838. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option, true);
  50839. }
  50840. } else if (props.expandOnClickNode) {
  50841. e.proxy.handleExpandIconClick();
  50842. }
  50843. },
  50844. onCheck: (data, params) => {
  50845. var _a;
  50846. (_a = attrs.onCheck) == null ? void 0 : _a.call(attrs, data, params);
  50847. const dataValue = getNodeValByProp("value", data);
  50848. if (props.checkStrictly) {
  50849. emit(UPDATE_MODEL_EVENT, props.multiple ? params.checkedKeys : params.checkedKeys.includes(dataValue) ? dataValue : void 0);
  50850. } else {
  50851. if (props.multiple) {
  50852. emit(UPDATE_MODEL_EVENT, tree.value.getCheckedKeys(true));
  50853. } else {
  50854. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  50855. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  50856. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  50857. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  50858. }
  50859. }
  50860. },
  50861. cacheOptions
  50862. };
  50863. };
  50864. var CacheOptions = vue.defineComponent({
  50865. props: {
  50866. data: {
  50867. type: Array,
  50868. default: () => []
  50869. }
  50870. },
  50871. setup(props) {
  50872. const select = vue.inject(selectKey);
  50873. vue.watch(() => props.data, () => {
  50874. var _a;
  50875. props.data.forEach((item) => {
  50876. if (!select.cachedOptions.has(item.value)) {
  50877. select.cachedOptions.set(item.value, item);
  50878. }
  50879. });
  50880. const inputs = ((_a = select.selectWrapper) == null ? void 0 : _a.querySelectorAll("input")) || [];
  50881. if (!Array.from(inputs).includes(document.activeElement)) {
  50882. select.setSelected();
  50883. }
  50884. }, { flush: "post", immediate: true });
  50885. return () => void 0;
  50886. }
  50887. });
  50888. const _sfc_main$9 = vue.defineComponent({
  50889. name: "ElTreeSelect",
  50890. inheritAttrs: false,
  50891. props: {
  50892. ...ElSelect.props,
  50893. ..._Tree.props,
  50894. cacheData: {
  50895. type: Array,
  50896. default: () => []
  50897. }
  50898. },
  50899. setup(props, context) {
  50900. const { slots, expose } = context;
  50901. const select = vue.ref();
  50902. const tree = vue.ref();
  50903. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  50904. const selectProps = useSelect(props, context, { select, tree, key });
  50905. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  50906. select,
  50907. tree,
  50908. key
  50909. });
  50910. const methods = vue.reactive({});
  50911. expose(methods);
  50912. vue.onMounted(() => {
  50913. Object.assign(methods, {
  50914. ...pick(tree.value, [
  50915. "filter",
  50916. "updateKeyChildren",
  50917. "getCheckedNodes",
  50918. "setCheckedNodes",
  50919. "getCheckedKeys",
  50920. "setCheckedKeys",
  50921. "setChecked",
  50922. "getHalfCheckedNodes",
  50923. "getHalfCheckedKeys",
  50924. "getCurrentKey",
  50925. "getCurrentNode",
  50926. "setCurrentKey",
  50927. "setCurrentNode",
  50928. "getNode",
  50929. "remove",
  50930. "append",
  50931. "insertBefore",
  50932. "insertAfter"
  50933. ]),
  50934. ...pick(select.value, ["focus", "blur"])
  50935. });
  50936. });
  50937. return () => vue.h(ElSelect, vue.reactive({
  50938. ...selectProps,
  50939. ref: (ref2) => select.value = ref2
  50940. }), {
  50941. ...slots,
  50942. default: () => [
  50943. vue.h(CacheOptions, { data: cacheOptions.value }),
  50944. vue.h(_Tree, vue.reactive({
  50945. ...treeProps,
  50946. ref: (ref2) => tree.value = ref2
  50947. }))
  50948. ]
  50949. });
  50950. }
  50951. });
  50952. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tree-select.vue"]]);
  50953. TreeSelect.install = (app) => {
  50954. app.component(TreeSelect.name, TreeSelect);
  50955. };
  50956. const _TreeSelect = TreeSelect;
  50957. const ElTreeSelect = _TreeSelect;
  50958. const ROOT_TREE_INJECTION_KEY = Symbol();
  50959. const EMPTY_NODE = {
  50960. key: -1,
  50961. level: -1,
  50962. data: {}
  50963. };
  50964. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  50965. TreeOptionsEnum2["KEY"] = "id";
  50966. TreeOptionsEnum2["LABEL"] = "label";
  50967. TreeOptionsEnum2["CHILDREN"] = "children";
  50968. TreeOptionsEnum2["DISABLED"] = "disabled";
  50969. return TreeOptionsEnum2;
  50970. })(TreeOptionsEnum || {});
  50971. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  50972. SetOperationEnum2["ADD"] = "add";
  50973. SetOperationEnum2["DELETE"] = "delete";
  50974. return SetOperationEnum2;
  50975. })(SetOperationEnum || {});
  50976. const itemSize = {
  50977. type: Number,
  50978. default: 26
  50979. };
  50980. const treeProps = buildProps({
  50981. data: {
  50982. type: definePropType(Array),
  50983. default: () => mutable([])
  50984. },
  50985. emptyText: {
  50986. type: String
  50987. },
  50988. height: {
  50989. type: Number,
  50990. default: 200
  50991. },
  50992. props: {
  50993. type: definePropType(Object),
  50994. default: () => mutable({
  50995. children: "children" /* CHILDREN */,
  50996. label: "label" /* LABEL */,
  50997. disabled: "disabled" /* DISABLED */,
  50998. value: "id" /* KEY */
  50999. })
  51000. },
  51001. highlightCurrent: {
  51002. type: Boolean,
  51003. default: false
  51004. },
  51005. showCheckbox: {
  51006. type: Boolean,
  51007. default: false
  51008. },
  51009. defaultCheckedKeys: {
  51010. type: definePropType(Array),
  51011. default: () => mutable([])
  51012. },
  51013. checkStrictly: {
  51014. type: Boolean,
  51015. default: false
  51016. },
  51017. defaultExpandedKeys: {
  51018. type: definePropType(Array),
  51019. default: () => mutable([])
  51020. },
  51021. indent: {
  51022. type: Number,
  51023. default: 16
  51024. },
  51025. itemSize,
  51026. icon: {
  51027. type: iconPropType
  51028. },
  51029. expandOnClickNode: {
  51030. type: Boolean,
  51031. default: true
  51032. },
  51033. checkOnClickNode: {
  51034. type: Boolean,
  51035. default: false
  51036. },
  51037. currentNodeKey: {
  51038. type: definePropType([String, Number])
  51039. },
  51040. accordion: {
  51041. type: Boolean,
  51042. default: false
  51043. },
  51044. filterMethod: {
  51045. type: definePropType(Function)
  51046. },
  51047. perfMode: {
  51048. type: Boolean,
  51049. default: true
  51050. }
  51051. });
  51052. const treeNodeProps = buildProps({
  51053. node: {
  51054. type: definePropType(Object),
  51055. default: () => mutable(EMPTY_NODE)
  51056. },
  51057. expanded: {
  51058. type: Boolean,
  51059. default: false
  51060. },
  51061. checked: {
  51062. type: Boolean,
  51063. default: false
  51064. },
  51065. indeterminate: {
  51066. type: Boolean,
  51067. default: false
  51068. },
  51069. showCheckbox: {
  51070. type: Boolean,
  51071. default: false
  51072. },
  51073. disabled: {
  51074. type: Boolean,
  51075. default: false
  51076. },
  51077. current: {
  51078. type: Boolean,
  51079. default: false
  51080. },
  51081. hiddenExpandIcon: {
  51082. type: Boolean,
  51083. default: false
  51084. },
  51085. itemSize
  51086. });
  51087. const treeNodeContentProps = buildProps({
  51088. node: {
  51089. type: definePropType(Object),
  51090. required: true
  51091. }
  51092. });
  51093. const NODE_CLICK = "node-click";
  51094. const NODE_EXPAND = "node-expand";
  51095. const NODE_COLLAPSE = "node-collapse";
  51096. const CURRENT_CHANGE = "current-change";
  51097. const NODE_CHECK = "check";
  51098. const NODE_CHECK_CHANGE = "check-change";
  51099. const NODE_CONTEXTMENU = "node-contextmenu";
  51100. const treeEmits = {
  51101. [NODE_CLICK]: (data, node, e) => data && node && e,
  51102. [NODE_EXPAND]: (data, node) => data && node,
  51103. [NODE_COLLAPSE]: (data, node) => data && node,
  51104. [CURRENT_CHANGE]: (data, node) => data && node,
  51105. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  51106. [NODE_CHECK_CHANGE]: (data, checked) => data && typeof checked === "boolean",
  51107. [NODE_CONTEXTMENU]: (event, data, node) => event && data && node
  51108. };
  51109. const treeNodeEmits = {
  51110. click: (node, e) => !!(node && e),
  51111. toggle: (node) => !!node,
  51112. check: (node, checked) => node && typeof checked === "boolean"
  51113. };
  51114. function useCheck(props, tree) {
  51115. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  51116. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  51117. const { emit } = vue.getCurrentInstance();
  51118. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  51119. return vue.nextTick(() => {
  51120. _setCheckedKeys(props.defaultCheckedKeys);
  51121. });
  51122. }, {
  51123. immediate: true
  51124. });
  51125. const updateCheckedKeys = () => {
  51126. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  51127. return;
  51128. }
  51129. const { levelTreeNodeMap, maxLevel } = tree.value;
  51130. const checkedKeySet = checkedKeys.value;
  51131. const indeterminateKeySet = /* @__PURE__ */ new Set();
  51132. for (let level = maxLevel - 1; level >= 1; --level) {
  51133. const nodes = levelTreeNodeMap.get(level);
  51134. if (!nodes)
  51135. continue;
  51136. nodes.forEach((node) => {
  51137. const children = node.children;
  51138. if (children) {
  51139. let allChecked = true;
  51140. let hasChecked = false;
  51141. for (const childNode of children) {
  51142. const key = childNode.key;
  51143. if (checkedKeySet.has(key)) {
  51144. hasChecked = true;
  51145. } else if (indeterminateKeySet.has(key)) {
  51146. allChecked = false;
  51147. hasChecked = true;
  51148. break;
  51149. } else {
  51150. allChecked = false;
  51151. }
  51152. }
  51153. if (allChecked) {
  51154. checkedKeySet.add(node.key);
  51155. } else if (hasChecked) {
  51156. indeterminateKeySet.add(node.key);
  51157. checkedKeySet.delete(node.key);
  51158. } else {
  51159. checkedKeySet.delete(node.key);
  51160. indeterminateKeySet.delete(node.key);
  51161. }
  51162. }
  51163. });
  51164. }
  51165. indeterminateKeys.value = indeterminateKeySet;
  51166. };
  51167. const isChecked = (node) => checkedKeys.value.has(node.key);
  51168. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  51169. const toggleCheckbox = (node, isChecked2, nodeClick = true) => {
  51170. const checkedKeySet = checkedKeys.value;
  51171. const toggle = (node2, checked) => {
  51172. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  51173. const children = node2.children;
  51174. if (!props.checkStrictly && children) {
  51175. children.forEach((childNode) => {
  51176. if (!childNode.disabled) {
  51177. toggle(childNode, checked);
  51178. }
  51179. });
  51180. }
  51181. };
  51182. toggle(node, isChecked2);
  51183. updateCheckedKeys();
  51184. if (nodeClick) {
  51185. afterNodeCheck(node, isChecked2);
  51186. }
  51187. };
  51188. const afterNodeCheck = (node, checked) => {
  51189. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  51190. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  51191. emit(NODE_CHECK, node.data, {
  51192. checkedKeys: checkedKeys2,
  51193. checkedNodes,
  51194. halfCheckedKeys,
  51195. halfCheckedNodes
  51196. });
  51197. emit(NODE_CHECK_CHANGE, node.data, checked);
  51198. };
  51199. function getCheckedKeys(leafOnly = false) {
  51200. return getChecked(leafOnly).checkedKeys;
  51201. }
  51202. function getCheckedNodes(leafOnly = false) {
  51203. return getChecked(leafOnly).checkedNodes;
  51204. }
  51205. function getHalfCheckedKeys() {
  51206. return getHalfChecked().halfCheckedKeys;
  51207. }
  51208. function getHalfCheckedNodes() {
  51209. return getHalfChecked().halfCheckedNodes;
  51210. }
  51211. function getChecked(leafOnly = false) {
  51212. const checkedNodes = [];
  51213. const keys = [];
  51214. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  51215. const { treeNodeMap } = tree.value;
  51216. checkedKeys.value.forEach((key) => {
  51217. const node = treeNodeMap.get(key);
  51218. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  51219. keys.push(key);
  51220. checkedNodes.push(node.data);
  51221. }
  51222. });
  51223. }
  51224. return {
  51225. checkedKeys: keys,
  51226. checkedNodes
  51227. };
  51228. }
  51229. function getHalfChecked() {
  51230. const halfCheckedNodes = [];
  51231. const halfCheckedKeys = [];
  51232. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  51233. const { treeNodeMap } = tree.value;
  51234. indeterminateKeys.value.forEach((key) => {
  51235. const node = treeNodeMap.get(key);
  51236. if (node) {
  51237. halfCheckedKeys.push(key);
  51238. halfCheckedNodes.push(node.data);
  51239. }
  51240. });
  51241. }
  51242. return {
  51243. halfCheckedNodes,
  51244. halfCheckedKeys
  51245. };
  51246. }
  51247. function setCheckedKeys(keys) {
  51248. checkedKeys.value.clear();
  51249. indeterminateKeys.value.clear();
  51250. _setCheckedKeys(keys);
  51251. }
  51252. function setChecked(key, isChecked2) {
  51253. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  51254. const node = tree.value.treeNodeMap.get(key);
  51255. if (node) {
  51256. toggleCheckbox(node, isChecked2, false);
  51257. }
  51258. }
  51259. }
  51260. function _setCheckedKeys(keys) {
  51261. if (tree == null ? void 0 : tree.value) {
  51262. const { treeNodeMap } = tree.value;
  51263. if (props.showCheckbox && treeNodeMap && keys) {
  51264. for (const key of keys) {
  51265. const node = treeNodeMap.get(key);
  51266. if (node && !isChecked(node)) {
  51267. toggleCheckbox(node, true, false);
  51268. }
  51269. }
  51270. }
  51271. }
  51272. }
  51273. return {
  51274. updateCheckedKeys,
  51275. toggleCheckbox,
  51276. isChecked,
  51277. isIndeterminate,
  51278. getCheckedKeys,
  51279. getCheckedNodes,
  51280. getHalfCheckedKeys,
  51281. getHalfCheckedNodes,
  51282. setChecked,
  51283. setCheckedKeys
  51284. };
  51285. }
  51286. function useFilter(props, tree) {
  51287. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  51288. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  51289. const filterable = vue.computed(() => {
  51290. return isFunction$1(props.filterMethod);
  51291. });
  51292. function doFilter(query) {
  51293. var _a;
  51294. if (!filterable.value) {
  51295. return;
  51296. }
  51297. const expandKeySet = /* @__PURE__ */ new Set();
  51298. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  51299. const hiddenKeys = hiddenNodeKeySet.value;
  51300. const family = [];
  51301. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  51302. const filter = props.filterMethod;
  51303. hiddenKeys.clear();
  51304. function traverse(nodes2) {
  51305. nodes2.forEach((node) => {
  51306. family.push(node);
  51307. if (filter == null ? void 0 : filter(query, node.data)) {
  51308. family.forEach((member) => {
  51309. expandKeySet.add(member.key);
  51310. });
  51311. } else if (node.isLeaf) {
  51312. hiddenKeys.add(node.key);
  51313. }
  51314. const children = node.children;
  51315. if (children) {
  51316. traverse(children);
  51317. }
  51318. if (!node.isLeaf) {
  51319. if (!expandKeySet.has(node.key)) {
  51320. hiddenKeys.add(node.key);
  51321. } else if (children) {
  51322. let allHidden = true;
  51323. for (const childNode of children) {
  51324. if (!hiddenKeys.has(childNode.key)) {
  51325. allHidden = false;
  51326. break;
  51327. }
  51328. }
  51329. if (allHidden) {
  51330. hiddenExpandIconKeys.add(node.key);
  51331. } else {
  51332. hiddenExpandIconKeys.delete(node.key);
  51333. }
  51334. }
  51335. }
  51336. family.pop();
  51337. });
  51338. }
  51339. traverse(nodes);
  51340. return expandKeySet;
  51341. }
  51342. function isForceHiddenExpandIcon(node) {
  51343. return hiddenExpandIconKeySet.value.has(node.key);
  51344. }
  51345. return {
  51346. hiddenExpandIconKeySet,
  51347. hiddenNodeKeySet,
  51348. doFilter,
  51349. isForceHiddenExpandIcon
  51350. };
  51351. }
  51352. function useTree(props, emit) {
  51353. const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys));
  51354. const currentKey = vue.ref();
  51355. const tree = vue.shallowRef();
  51356. vue.watch(() => props.currentNodeKey, (key) => {
  51357. currentKey.value = key;
  51358. }, {
  51359. immediate: true
  51360. });
  51361. vue.watch(() => props.data, (data) => {
  51362. setData(data);
  51363. }, {
  51364. immediate: true
  51365. });
  51366. const {
  51367. isIndeterminate,
  51368. isChecked,
  51369. toggleCheckbox,
  51370. getCheckedKeys,
  51371. getCheckedNodes,
  51372. getHalfCheckedKeys,
  51373. getHalfCheckedNodes,
  51374. setChecked,
  51375. setCheckedKeys
  51376. } = useCheck(props, tree);
  51377. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  51378. const valueKey = vue.computed(() => {
  51379. var _a;
  51380. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  51381. });
  51382. const childrenKey = vue.computed(() => {
  51383. var _a;
  51384. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  51385. });
  51386. const disabledKey = vue.computed(() => {
  51387. var _a;
  51388. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  51389. });
  51390. const labelKey = vue.computed(() => {
  51391. var _a;
  51392. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  51393. });
  51394. const flattenTree = vue.computed(() => {
  51395. const expandedKeys = expandedKeySet.value;
  51396. const hiddenKeys = hiddenNodeKeySet.value;
  51397. const flattenNodes = [];
  51398. const nodes = tree.value && tree.value.treeNodes || [];
  51399. function traverse() {
  51400. const stack = [];
  51401. for (let i = nodes.length - 1; i >= 0; --i) {
  51402. stack.push(nodes[i]);
  51403. }
  51404. while (stack.length) {
  51405. const node = stack.pop();
  51406. if (!node)
  51407. continue;
  51408. if (!hiddenKeys.has(node.key)) {
  51409. flattenNodes.push(node);
  51410. }
  51411. if (expandedKeys.has(node.key)) {
  51412. const children = node.children;
  51413. if (children) {
  51414. const length = children.length;
  51415. for (let i = length - 1; i >= 0; --i) {
  51416. stack.push(children[i]);
  51417. }
  51418. }
  51419. }
  51420. }
  51421. }
  51422. traverse();
  51423. return flattenNodes;
  51424. });
  51425. const isNotEmpty = vue.computed(() => {
  51426. return flattenTree.value.length > 0;
  51427. });
  51428. function createTree(data) {
  51429. const treeNodeMap = /* @__PURE__ */ new Map();
  51430. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  51431. let maxLevel = 1;
  51432. function traverse(nodes, level = 1, parent = void 0) {
  51433. var _a;
  51434. const siblings = [];
  51435. for (const rawNode of nodes) {
  51436. const value = getKey(rawNode);
  51437. const node = {
  51438. level,
  51439. key: value,
  51440. data: rawNode
  51441. };
  51442. node.label = getLabel(rawNode);
  51443. node.parent = parent;
  51444. const children = getChildren(rawNode);
  51445. node.disabled = getDisabled(rawNode);
  51446. node.isLeaf = !children || children.length === 0;
  51447. if (children && children.length) {
  51448. node.children = traverse(children, level + 1, node);
  51449. }
  51450. siblings.push(node);
  51451. treeNodeMap.set(value, node);
  51452. if (!levelTreeNodeMap.has(level)) {
  51453. levelTreeNodeMap.set(level, []);
  51454. }
  51455. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  51456. }
  51457. if (level > maxLevel) {
  51458. maxLevel = level;
  51459. }
  51460. return siblings;
  51461. }
  51462. const treeNodes = traverse(data);
  51463. return {
  51464. treeNodeMap,
  51465. levelTreeNodeMap,
  51466. maxLevel,
  51467. treeNodes
  51468. };
  51469. }
  51470. function filter(query) {
  51471. const keys = doFilter(query);
  51472. if (keys) {
  51473. expandedKeySet.value = keys;
  51474. }
  51475. }
  51476. function getChildren(node) {
  51477. return node[childrenKey.value];
  51478. }
  51479. function getKey(node) {
  51480. if (!node) {
  51481. return "";
  51482. }
  51483. return node[valueKey.value];
  51484. }
  51485. function getDisabled(node) {
  51486. return node[disabledKey.value];
  51487. }
  51488. function getLabel(node) {
  51489. return node[labelKey.value];
  51490. }
  51491. function toggleExpand(node) {
  51492. const expandedKeys = expandedKeySet.value;
  51493. if (expandedKeys.has(node.key)) {
  51494. collapseNode(node);
  51495. } else {
  51496. expandNode(node);
  51497. }
  51498. }
  51499. function setExpandedKeys(keys) {
  51500. expandedKeySet.value = new Set(keys);
  51501. }
  51502. function handleNodeClick(node, e) {
  51503. emit(NODE_CLICK, node.data, node, e);
  51504. handleCurrentChange(node);
  51505. if (props.expandOnClickNode) {
  51506. toggleExpand(node);
  51507. }
  51508. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  51509. toggleCheckbox(node, !isChecked(node), true);
  51510. }
  51511. }
  51512. function handleCurrentChange(node) {
  51513. if (!isCurrent(node)) {
  51514. currentKey.value = node.key;
  51515. emit(CURRENT_CHANGE, node.data, node);
  51516. }
  51517. }
  51518. function handleNodeCheck(node, checked) {
  51519. toggleCheckbox(node, checked);
  51520. }
  51521. function expandNode(node) {
  51522. const keySet = expandedKeySet.value;
  51523. if (tree.value && props.accordion) {
  51524. const { treeNodeMap } = tree.value;
  51525. keySet.forEach((key) => {
  51526. const treeNode = treeNodeMap.get(key);
  51527. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  51528. keySet.delete(key);
  51529. }
  51530. });
  51531. }
  51532. keySet.add(node.key);
  51533. emit(NODE_EXPAND, node.data, node);
  51534. }
  51535. function collapseNode(node) {
  51536. expandedKeySet.value.delete(node.key);
  51537. emit(NODE_COLLAPSE, node.data, node);
  51538. }
  51539. function isExpanded(node) {
  51540. return expandedKeySet.value.has(node.key);
  51541. }
  51542. function isDisabled(node) {
  51543. return !!node.disabled;
  51544. }
  51545. function isCurrent(node) {
  51546. const current = currentKey.value;
  51547. return !!current && current === node.key;
  51548. }
  51549. function getCurrentNode() {
  51550. var _a, _b;
  51551. if (!currentKey.value)
  51552. return void 0;
  51553. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  51554. }
  51555. function getCurrentKey() {
  51556. return currentKey.value;
  51557. }
  51558. function setCurrentKey(key) {
  51559. currentKey.value = key;
  51560. }
  51561. function setData(data) {
  51562. vue.nextTick(() => tree.value = createTree(data));
  51563. }
  51564. function getNode(data) {
  51565. var _a;
  51566. const key = isObject$1(data) ? getKey(data) : data;
  51567. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  51568. }
  51569. return {
  51570. tree,
  51571. flattenTree,
  51572. isNotEmpty,
  51573. getKey,
  51574. getChildren,
  51575. toggleExpand,
  51576. toggleCheckbox,
  51577. isExpanded,
  51578. isChecked,
  51579. isIndeterminate,
  51580. isDisabled,
  51581. isCurrent,
  51582. isForceHiddenExpandIcon,
  51583. handleNodeClick,
  51584. handleNodeCheck,
  51585. getCurrentNode,
  51586. getCurrentKey,
  51587. setCurrentKey,
  51588. getCheckedKeys,
  51589. getCheckedNodes,
  51590. getHalfCheckedKeys,
  51591. getHalfCheckedNodes,
  51592. setChecked,
  51593. setCheckedKeys,
  51594. filter,
  51595. setData,
  51596. getNode,
  51597. expandNode,
  51598. collapseNode,
  51599. setExpandedKeys
  51600. };
  51601. }
  51602. var ElNodeContent = vue.defineComponent({
  51603. name: "ElTreeNodeContent",
  51604. props: treeNodeContentProps,
  51605. setup(props) {
  51606. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  51607. const ns = useNamespace("tree");
  51608. return () => {
  51609. const node = props.node;
  51610. const { data } = node;
  51611. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : vue.h("span", { class: ns.be("node", "label") }, [node == null ? void 0 : node.label]);
  51612. };
  51613. }
  51614. });
  51615. const _hoisted_1$6 = ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"];
  51616. const __default__$7 = vue.defineComponent({
  51617. name: "ElTreeNode"
  51618. });
  51619. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  51620. ...__default__$7,
  51621. props: treeNodeProps,
  51622. emits: treeNodeEmits,
  51623. setup(__props, { emit }) {
  51624. const props = __props;
  51625. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  51626. const ns = useNamespace("tree");
  51627. const indent = vue.computed(() => {
  51628. var _a;
  51629. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  51630. });
  51631. const icon = vue.computed(() => {
  51632. var _a;
  51633. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  51634. });
  51635. const handleClick = (e) => {
  51636. emit("click", props.node, e);
  51637. };
  51638. const handleExpandIconClick = () => {
  51639. emit("toggle", props.node);
  51640. };
  51641. const handleCheckChange = (value) => {
  51642. emit("check", props.node, value);
  51643. };
  51644. const handleContextMenu = (event) => {
  51645. var _a, _b, _c, _d;
  51646. 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"]) {
  51647. event.stopPropagation();
  51648. event.preventDefault();
  51649. }
  51650. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  51651. };
  51652. return (_ctx, _cache) => {
  51653. var _a, _b, _c;
  51654. return vue.openBlock(), vue.createElementBlock("div", {
  51655. ref: "node$",
  51656. class: vue.normalizeClass([
  51657. vue.unref(ns).b("node"),
  51658. vue.unref(ns).is("expanded", _ctx.expanded),
  51659. vue.unref(ns).is("current", _ctx.current),
  51660. vue.unref(ns).is("focusable", !_ctx.disabled),
  51661. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked)
  51662. ]),
  51663. role: "treeitem",
  51664. tabindex: "-1",
  51665. "aria-expanded": _ctx.expanded,
  51666. "aria-disabled": _ctx.disabled,
  51667. "aria-checked": _ctx.checked,
  51668. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  51669. onClick: vue.withModifiers(handleClick, ["stop"]),
  51670. onContextmenu: handleContextMenu
  51671. }, [
  51672. vue.createElementVNode("div", {
  51673. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  51674. style: vue.normalizeStyle({
  51675. paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px`,
  51676. height: _ctx.itemSize + "px"
  51677. })
  51678. }, [
  51679. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  51680. key: 0,
  51681. class: vue.normalizeClass([
  51682. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  51683. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  51684. {
  51685. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  51686. },
  51687. vue.unref(ns).be("node", "expand-icon")
  51688. ]),
  51689. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  51690. }, {
  51691. default: vue.withCtx(() => [
  51692. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  51693. ]),
  51694. _: 1
  51695. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  51696. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  51697. key: 1,
  51698. "model-value": _ctx.checked,
  51699. indeterminate: _ctx.indeterminate,
  51700. disabled: _ctx.disabled,
  51701. onChange: handleCheckChange,
  51702. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  51703. }, ["stop"]))
  51704. }, null, 8, ["model-value", "indeterminate", "disabled"])) : vue.createCommentVNode("v-if", true),
  51705. vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  51706. ], 6)
  51707. ], 42, _hoisted_1$6);
  51708. };
  51709. }
  51710. });
  51711. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "tree-node.vue"]]);
  51712. const __default__$6 = vue.defineComponent({
  51713. name: "ElTreeV2"
  51714. });
  51715. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  51716. ...__default__$6,
  51717. props: treeProps,
  51718. emits: treeEmits,
  51719. setup(__props, { expose, emit }) {
  51720. const props = __props;
  51721. const slots = vue.useSlots();
  51722. const treeNodeSize = vue.computed(() => props.itemSize);
  51723. vue.provide(ROOT_TREE_INJECTION_KEY, {
  51724. ctx: {
  51725. emit,
  51726. slots
  51727. },
  51728. props,
  51729. instance: vue.getCurrentInstance()
  51730. });
  51731. vue.provide(formItemContextKey, void 0);
  51732. const { t } = useLocale();
  51733. const ns = useNamespace("tree");
  51734. const {
  51735. flattenTree,
  51736. isNotEmpty,
  51737. toggleExpand,
  51738. isExpanded,
  51739. isIndeterminate,
  51740. isChecked,
  51741. isDisabled,
  51742. isCurrent,
  51743. isForceHiddenExpandIcon,
  51744. handleNodeClick,
  51745. handleNodeCheck,
  51746. toggleCheckbox,
  51747. getCurrentNode,
  51748. getCurrentKey,
  51749. setCurrentKey,
  51750. getCheckedKeys,
  51751. getCheckedNodes,
  51752. getHalfCheckedKeys,
  51753. getHalfCheckedNodes,
  51754. setChecked,
  51755. setCheckedKeys,
  51756. filter,
  51757. setData,
  51758. getNode,
  51759. expandNode,
  51760. collapseNode,
  51761. setExpandedKeys
  51762. } = useTree(props, emit);
  51763. expose({
  51764. toggleCheckbox,
  51765. getCurrentNode,
  51766. getCurrentKey,
  51767. setCurrentKey,
  51768. getCheckedKeys,
  51769. getCheckedNodes,
  51770. getHalfCheckedKeys,
  51771. getHalfCheckedNodes,
  51772. setChecked,
  51773. setCheckedKeys,
  51774. filter,
  51775. setData,
  51776. getNode,
  51777. expandNode,
  51778. collapseNode,
  51779. setExpandedKeys
  51780. });
  51781. return (_ctx, _cache) => {
  51782. var _a;
  51783. return vue.openBlock(), vue.createElementBlock("div", {
  51784. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  51785. role: "tree"
  51786. }, [
  51787. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  51788. key: 0,
  51789. "class-name": vue.unref(ns).b("virtual-list"),
  51790. data: vue.unref(flattenTree),
  51791. total: vue.unref(flattenTree).length,
  51792. height: _ctx.height,
  51793. "item-size": vue.unref(treeNodeSize),
  51794. "perf-mode": _ctx.perfMode
  51795. }, {
  51796. default: vue.withCtx(({ data, index, style }) => [
  51797. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  51798. key: data[index].key,
  51799. style: vue.normalizeStyle(style),
  51800. node: data[index],
  51801. expanded: vue.unref(isExpanded)(data[index]),
  51802. "show-checkbox": _ctx.showCheckbox,
  51803. checked: vue.unref(isChecked)(data[index]),
  51804. indeterminate: vue.unref(isIndeterminate)(data[index]),
  51805. "item-size": vue.unref(treeNodeSize),
  51806. disabled: vue.unref(isDisabled)(data[index]),
  51807. current: vue.unref(isCurrent)(data[index]),
  51808. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  51809. onClick: vue.unref(handleNodeClick),
  51810. onToggle: vue.unref(toggleExpand),
  51811. onCheck: vue.unref(handleNodeCheck)
  51812. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"]))
  51813. ]),
  51814. _: 1
  51815. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", {
  51816. key: 1,
  51817. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  51818. }, [
  51819. vue.createElementVNode("span", {
  51820. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  51821. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  51822. ], 2))
  51823. ], 2);
  51824. };
  51825. }
  51826. });
  51827. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "tree.vue"]]);
  51828. const ElTreeV2 = withInstall(TreeV2);
  51829. const uploadContextKey = Symbol("uploadContextKey");
  51830. const SCOPE$2 = "ElUpload";
  51831. class UploadAjaxError extends Error {
  51832. constructor(message, status, method, url) {
  51833. super(message);
  51834. this.name = "UploadAjaxError";
  51835. this.status = status;
  51836. this.method = method;
  51837. this.url = url;
  51838. }
  51839. }
  51840. function getError(action, option, xhr) {
  51841. let msg;
  51842. if (xhr.response) {
  51843. msg = `${xhr.response.error || xhr.response}`;
  51844. } else if (xhr.responseText) {
  51845. msg = `${xhr.responseText}`;
  51846. } else {
  51847. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  51848. }
  51849. return new UploadAjaxError(msg, xhr.status, option.method, action);
  51850. }
  51851. function getBody(xhr) {
  51852. const text = xhr.responseText || xhr.response;
  51853. if (!text) {
  51854. return text;
  51855. }
  51856. try {
  51857. return JSON.parse(text);
  51858. } catch (e) {
  51859. return text;
  51860. }
  51861. }
  51862. const ajaxUpload = (option) => {
  51863. if (typeof XMLHttpRequest === "undefined")
  51864. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  51865. const xhr = new XMLHttpRequest();
  51866. const action = option.action;
  51867. if (xhr.upload) {
  51868. xhr.upload.addEventListener("progress", (evt) => {
  51869. const progressEvt = evt;
  51870. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  51871. option.onProgress(progressEvt);
  51872. });
  51873. }
  51874. const formData = new FormData();
  51875. if (option.data) {
  51876. for (const [key, value] of Object.entries(option.data)) {
  51877. if (Array.isArray(value))
  51878. formData.append(key, ...value);
  51879. else
  51880. formData.append(key, value);
  51881. }
  51882. }
  51883. formData.append(option.filename, option.file, option.file.name);
  51884. xhr.addEventListener("error", () => {
  51885. option.onError(getError(action, option, xhr));
  51886. });
  51887. xhr.addEventListener("load", () => {
  51888. if (xhr.status < 200 || xhr.status >= 300) {
  51889. return option.onError(getError(action, option, xhr));
  51890. }
  51891. option.onSuccess(getBody(xhr));
  51892. });
  51893. xhr.open(option.method, action, true);
  51894. if (option.withCredentials && "withCredentials" in xhr) {
  51895. xhr.withCredentials = true;
  51896. }
  51897. const headers = option.headers || {};
  51898. if (headers instanceof Headers) {
  51899. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  51900. } else {
  51901. for (const [key, value] of Object.entries(headers)) {
  51902. if (isNil(value))
  51903. continue;
  51904. xhr.setRequestHeader(key, String(value));
  51905. }
  51906. }
  51907. xhr.send(formData);
  51908. return xhr;
  51909. };
  51910. const uploadListTypes = ["text", "picture", "picture-card"];
  51911. let fileId = 1;
  51912. const genFileId = () => Date.now() + fileId++;
  51913. const uploadBaseProps = buildProps({
  51914. action: {
  51915. type: String,
  51916. default: "#"
  51917. },
  51918. headers: {
  51919. type: definePropType(Object)
  51920. },
  51921. method: {
  51922. type: String,
  51923. default: "post"
  51924. },
  51925. data: {
  51926. type: Object,
  51927. default: () => mutable({})
  51928. },
  51929. multiple: {
  51930. type: Boolean,
  51931. default: false
  51932. },
  51933. name: {
  51934. type: String,
  51935. default: "file"
  51936. },
  51937. drag: {
  51938. type: Boolean,
  51939. default: false
  51940. },
  51941. withCredentials: Boolean,
  51942. showFileList: {
  51943. type: Boolean,
  51944. default: true
  51945. },
  51946. accept: {
  51947. type: String,
  51948. default: ""
  51949. },
  51950. type: {
  51951. type: String,
  51952. default: "select"
  51953. },
  51954. fileList: {
  51955. type: definePropType(Array),
  51956. default: () => mutable([])
  51957. },
  51958. autoUpload: {
  51959. type: Boolean,
  51960. default: true
  51961. },
  51962. listType: {
  51963. type: String,
  51964. values: uploadListTypes,
  51965. default: "text"
  51966. },
  51967. httpRequest: {
  51968. type: definePropType(Function),
  51969. default: ajaxUpload
  51970. },
  51971. disabled: Boolean,
  51972. limit: Number
  51973. });
  51974. const uploadProps = buildProps({
  51975. ...uploadBaseProps,
  51976. beforeUpload: {
  51977. type: definePropType(Function),
  51978. default: NOOP
  51979. },
  51980. beforeRemove: {
  51981. type: definePropType(Function)
  51982. },
  51983. onRemove: {
  51984. type: definePropType(Function),
  51985. default: NOOP
  51986. },
  51987. onChange: {
  51988. type: definePropType(Function),
  51989. default: NOOP
  51990. },
  51991. onPreview: {
  51992. type: definePropType(Function),
  51993. default: NOOP
  51994. },
  51995. onSuccess: {
  51996. type: definePropType(Function),
  51997. default: NOOP
  51998. },
  51999. onProgress: {
  52000. type: definePropType(Function),
  52001. default: NOOP
  52002. },
  52003. onError: {
  52004. type: definePropType(Function),
  52005. default: NOOP
  52006. },
  52007. onExceed: {
  52008. type: definePropType(Function),
  52009. default: NOOP
  52010. }
  52011. });
  52012. const uploadListProps = buildProps({
  52013. files: {
  52014. type: definePropType(Array),
  52015. default: () => mutable([])
  52016. },
  52017. disabled: {
  52018. type: Boolean,
  52019. default: false
  52020. },
  52021. handlePreview: {
  52022. type: definePropType(Function),
  52023. default: NOOP
  52024. },
  52025. listType: {
  52026. type: String,
  52027. values: uploadListTypes,
  52028. default: "text"
  52029. }
  52030. });
  52031. const uploadListEmits = {
  52032. remove: (file) => !!file
  52033. };
  52034. const _hoisted_1$5 = ["onKeydown"];
  52035. const _hoisted_2$4 = ["src"];
  52036. const _hoisted_3$2 = ["onClick"];
  52037. const _hoisted_4$1 = ["onClick"];
  52038. const _hoisted_5 = ["onClick"];
  52039. const __default__$5 = vue.defineComponent({
  52040. name: "ElUploadList"
  52041. });
  52042. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  52043. ...__default__$5,
  52044. props: uploadListProps,
  52045. emits: uploadListEmits,
  52046. setup(__props, { emit }) {
  52047. const { t } = useLocale();
  52048. const nsUpload = useNamespace("upload");
  52049. const nsIcon = useNamespace("icon");
  52050. const nsList = useNamespace("list");
  52051. const disabled = useFormDisabled();
  52052. const focusing = vue.ref(false);
  52053. const handleRemove = (file) => {
  52054. emit("remove", file);
  52055. };
  52056. return (_ctx, _cache) => {
  52057. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  52058. tag: "ul",
  52059. class: vue.normalizeClass([
  52060. vue.unref(nsUpload).b("list"),
  52061. vue.unref(nsUpload).bm("list", _ctx.listType),
  52062. vue.unref(nsUpload).is("disabled", vue.unref(disabled))
  52063. ]),
  52064. name: vue.unref(nsList).b()
  52065. }, {
  52066. default: vue.withCtx(() => [
  52067. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file) => {
  52068. return vue.openBlock(), vue.createElementBlock("li", {
  52069. key: file.uid || file.name,
  52070. class: vue.normalizeClass([
  52071. vue.unref(nsUpload).be("list", "item"),
  52072. vue.unref(nsUpload).is(file.status),
  52073. { focusing: focusing.value }
  52074. ]),
  52075. tabindex: "0",
  52076. onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]),
  52077. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  52078. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  52079. onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
  52080. }, [
  52081. vue.renderSlot(_ctx.$slots, "default", { file }, () => [
  52082. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  52083. key: 0,
  52084. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  52085. src: file.url,
  52086. alt: ""
  52087. }, null, 10, _hoisted_2$4)) : vue.createCommentVNode("v-if", true),
  52088. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  52089. key: 1,
  52090. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  52091. }, [
  52092. vue.createElementVNode("a", {
  52093. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  52094. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  52095. }, [
  52096. vue.createVNode(vue.unref(ElIcon), {
  52097. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  52098. }, {
  52099. default: vue.withCtx(() => [
  52100. vue.createVNode(vue.unref(document_default))
  52101. ]),
  52102. _: 1
  52103. }, 8, ["class"]),
  52104. vue.createElementVNode("span", {
  52105. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name"))
  52106. }, vue.toDisplayString(file.name), 3)
  52107. ], 10, _hoisted_3$2),
  52108. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  52109. key: 0,
  52110. type: _ctx.listType === "picture-card" ? "circle" : "line",
  52111. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  52112. percentage: Number(file.percentage),
  52113. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  52114. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  52115. ], 2)) : vue.createCommentVNode("v-if", true),
  52116. vue.createElementVNode("label", {
  52117. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  52118. }, [
  52119. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52120. key: 0,
  52121. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  52122. }, {
  52123. default: vue.withCtx(() => [
  52124. vue.createVNode(vue.unref(circle_check_default))
  52125. ]),
  52126. _: 1
  52127. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52128. key: 1,
  52129. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  52130. }, {
  52131. default: vue.withCtx(() => [
  52132. vue.createVNode(vue.unref(check_default))
  52133. ]),
  52134. _: 1
  52135. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  52136. ], 2),
  52137. !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52138. key: 2,
  52139. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  52140. onClick: ($event) => handleRemove(file)
  52141. }, {
  52142. default: vue.withCtx(() => [
  52143. vue.createVNode(vue.unref(close_default))
  52144. ]),
  52145. _: 2
  52146. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  52147. vue.createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  52148. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  52149. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  52150. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", {
  52151. key: 3,
  52152. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  52153. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  52154. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  52155. key: 4,
  52156. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  52157. }, [
  52158. vue.createElementVNode("span", {
  52159. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  52160. onClick: ($event) => _ctx.handlePreview(file)
  52161. }, [
  52162. vue.createVNode(vue.unref(ElIcon), {
  52163. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  52164. }, {
  52165. default: vue.withCtx(() => [
  52166. vue.createVNode(vue.unref(zoom_in_default))
  52167. ]),
  52168. _: 1
  52169. }, 8, ["class"])
  52170. ], 10, _hoisted_4$1),
  52171. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", {
  52172. key: 0,
  52173. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  52174. onClick: ($event) => handleRemove(file)
  52175. }, [
  52176. vue.createVNode(vue.unref(ElIcon), {
  52177. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  52178. }, {
  52179. default: vue.withCtx(() => [
  52180. vue.createVNode(vue.unref(delete_default))
  52181. ]),
  52182. _: 1
  52183. }, 8, ["class"])
  52184. ], 10, _hoisted_5)) : vue.createCommentVNode("v-if", true)
  52185. ], 2)) : vue.createCommentVNode("v-if", true)
  52186. ])
  52187. ], 42, _hoisted_1$5);
  52188. }), 128)),
  52189. vue.renderSlot(_ctx.$slots, "append")
  52190. ]),
  52191. _: 3
  52192. }, 8, ["class", "name"]);
  52193. };
  52194. }
  52195. });
  52196. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "upload-list.vue"]]);
  52197. const uploadDraggerProps = buildProps({
  52198. disabled: {
  52199. type: Boolean,
  52200. default: false
  52201. }
  52202. });
  52203. const uploadDraggerEmits = {
  52204. file: (file) => isArray$1(file)
  52205. };
  52206. const _hoisted_1$4 = ["onDrop", "onDragover"];
  52207. const COMPONENT_NAME = "ElUploadDrag";
  52208. const __default__$4 = vue.defineComponent({
  52209. name: COMPONENT_NAME
  52210. });
  52211. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  52212. ...__default__$4,
  52213. props: uploadDraggerProps,
  52214. emits: uploadDraggerEmits,
  52215. setup(__props, { emit }) {
  52216. const uploaderContext = vue.inject(uploadContextKey);
  52217. if (!uploaderContext) {
  52218. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  52219. }
  52220. const ns = useNamespace("upload");
  52221. const dragover = vue.ref(false);
  52222. const disabled = useFormDisabled();
  52223. const onDrop = (e) => {
  52224. if (disabled.value)
  52225. return;
  52226. dragover.value = false;
  52227. e.stopPropagation();
  52228. const files = Array.from(e.dataTransfer.files);
  52229. const accept = uploaderContext.accept.value;
  52230. if (!accept) {
  52231. emit("file", files);
  52232. return;
  52233. }
  52234. const filesFiltered = files.filter((file) => {
  52235. const { type, name } = file;
  52236. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  52237. const baseType = type.replace(/\/.*$/, "");
  52238. return accept.split(",").map((type2) => type2.trim()).filter((type2) => type2).some((acceptedType) => {
  52239. if (acceptedType.startsWith(".")) {
  52240. return extension === acceptedType;
  52241. }
  52242. if (/\/\*$/.test(acceptedType)) {
  52243. return baseType === acceptedType.replace(/\/\*$/, "");
  52244. }
  52245. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  52246. return type === acceptedType;
  52247. }
  52248. return false;
  52249. });
  52250. });
  52251. emit("file", filesFiltered);
  52252. };
  52253. const onDragover = () => {
  52254. if (!disabled.value)
  52255. dragover.value = true;
  52256. };
  52257. return (_ctx, _cache) => {
  52258. return vue.openBlock(), vue.createElementBlock("div", {
  52259. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  52260. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  52261. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  52262. onDragleave: _cache[0] || (_cache[0] = vue.withModifiers(($event) => dragover.value = false, ["prevent"]))
  52263. }, [
  52264. vue.renderSlot(_ctx.$slots, "default")
  52265. ], 42, _hoisted_1$4);
  52266. };
  52267. }
  52268. });
  52269. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "upload-dragger.vue"]]);
  52270. const uploadContentProps = buildProps({
  52271. ...uploadBaseProps,
  52272. beforeUpload: {
  52273. type: definePropType(Function),
  52274. default: NOOP
  52275. },
  52276. onRemove: {
  52277. type: definePropType(Function),
  52278. default: NOOP
  52279. },
  52280. onStart: {
  52281. type: definePropType(Function),
  52282. default: NOOP
  52283. },
  52284. onSuccess: {
  52285. type: definePropType(Function),
  52286. default: NOOP
  52287. },
  52288. onProgress: {
  52289. type: definePropType(Function),
  52290. default: NOOP
  52291. },
  52292. onError: {
  52293. type: definePropType(Function),
  52294. default: NOOP
  52295. },
  52296. onExceed: {
  52297. type: definePropType(Function),
  52298. default: NOOP
  52299. }
  52300. });
  52301. const _hoisted_1$3 = ["onKeydown"];
  52302. const _hoisted_2$3 = ["name", "multiple", "accept"];
  52303. const __default__$3 = vue.defineComponent({
  52304. name: "ElUploadContent",
  52305. inheritAttrs: false
  52306. });
  52307. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  52308. ...__default__$3,
  52309. props: uploadContentProps,
  52310. setup(__props, { expose }) {
  52311. const props = __props;
  52312. const ns = useNamespace("upload");
  52313. const disabled = useFormDisabled();
  52314. const requests = vue.shallowRef({});
  52315. const inputRef = vue.shallowRef();
  52316. const uploadFiles = (files) => {
  52317. if (files.length === 0)
  52318. return;
  52319. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  52320. if (limit && fileList.length + files.length > limit) {
  52321. onExceed(files, fileList);
  52322. return;
  52323. }
  52324. if (!multiple) {
  52325. files = files.slice(0, 1);
  52326. }
  52327. for (const file of files) {
  52328. const rawFile = file;
  52329. rawFile.uid = genFileId();
  52330. onStart(rawFile);
  52331. if (autoUpload)
  52332. upload(rawFile);
  52333. }
  52334. };
  52335. const upload = async (rawFile) => {
  52336. inputRef.value.value = "";
  52337. if (!props.beforeUpload) {
  52338. return doUpload(rawFile);
  52339. }
  52340. let hookResult;
  52341. let beforeData = {};
  52342. try {
  52343. const beforeUploadPromise = props.beforeUpload(rawFile);
  52344. beforeData = isObject$1(props.data) ? cloneDeep(props.data) : props.data;
  52345. hookResult = await beforeUploadPromise;
  52346. } catch (e) {
  52347. hookResult = false;
  52348. }
  52349. if (hookResult === false) {
  52350. props.onRemove(rawFile);
  52351. return;
  52352. }
  52353. let file = rawFile;
  52354. if (hookResult instanceof Blob) {
  52355. if (hookResult instanceof File) {
  52356. file = hookResult;
  52357. } else {
  52358. file = new File([hookResult], rawFile.name, {
  52359. type: rawFile.type
  52360. });
  52361. }
  52362. }
  52363. doUpload(Object.assign(file, {
  52364. uid: rawFile.uid
  52365. }), beforeData);
  52366. };
  52367. const doUpload = (rawFile, beforeData) => {
  52368. const {
  52369. headers,
  52370. data,
  52371. method,
  52372. withCredentials,
  52373. name: filename,
  52374. action,
  52375. onProgress,
  52376. onSuccess,
  52377. onError,
  52378. httpRequest
  52379. } = props;
  52380. const { uid } = rawFile;
  52381. const options = {
  52382. headers: headers || {},
  52383. withCredentials,
  52384. file: rawFile,
  52385. data: beforeData != null ? beforeData : data,
  52386. method,
  52387. filename,
  52388. action,
  52389. onProgress: (evt) => {
  52390. onProgress(evt, rawFile);
  52391. },
  52392. onSuccess: (res) => {
  52393. onSuccess(res, rawFile);
  52394. delete requests.value[uid];
  52395. },
  52396. onError: (err) => {
  52397. onError(err, rawFile);
  52398. delete requests.value[uid];
  52399. }
  52400. };
  52401. const request = httpRequest(options);
  52402. requests.value[uid] = request;
  52403. if (request instanceof Promise) {
  52404. request.then(options.onSuccess, options.onError);
  52405. }
  52406. };
  52407. const handleChange = (e) => {
  52408. const files = e.target.files;
  52409. if (!files)
  52410. return;
  52411. uploadFiles(Array.from(files));
  52412. };
  52413. const handleClick = () => {
  52414. if (!disabled.value) {
  52415. inputRef.value.value = "";
  52416. inputRef.value.click();
  52417. }
  52418. };
  52419. const handleKeydown = () => {
  52420. handleClick();
  52421. };
  52422. const abort = (file) => {
  52423. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  52424. _reqs.forEach(([uid, req]) => {
  52425. if (req instanceof XMLHttpRequest)
  52426. req.abort();
  52427. delete requests.value[uid];
  52428. });
  52429. };
  52430. expose({
  52431. abort,
  52432. upload
  52433. });
  52434. return (_ctx, _cache) => {
  52435. return vue.openBlock(), vue.createElementBlock("div", {
  52436. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.listType), vue.unref(ns).is("drag", _ctx.drag)]),
  52437. tabindex: "0",
  52438. onClick: handleClick,
  52439. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  52440. }, [
  52441. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  52442. key: 0,
  52443. disabled: vue.unref(disabled),
  52444. onFile: uploadFiles
  52445. }, {
  52446. default: vue.withCtx(() => [
  52447. vue.renderSlot(_ctx.$slots, "default")
  52448. ]),
  52449. _: 3
  52450. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  52451. vue.createElementVNode("input", {
  52452. ref_key: "inputRef",
  52453. ref: inputRef,
  52454. class: vue.normalizeClass(vue.unref(ns).e("input")),
  52455. name: _ctx.name,
  52456. multiple: _ctx.multiple,
  52457. accept: _ctx.accept,
  52458. type: "file",
  52459. onChange: handleChange,
  52460. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  52461. }, ["stop"]))
  52462. }, null, 42, _hoisted_2$3)
  52463. ], 42, _hoisted_1$3);
  52464. };
  52465. }
  52466. });
  52467. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "upload-content.vue"]]);
  52468. const SCOPE$1 = "ElUpload";
  52469. const revokeObjectURL = (file) => {
  52470. var _a;
  52471. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  52472. URL.revokeObjectURL(file.url);
  52473. }
  52474. };
  52475. const useHandlers = (props, uploadRef) => {
  52476. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  52477. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  52478. function abort(file) {
  52479. var _a;
  52480. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  52481. }
  52482. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  52483. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  52484. }
  52485. const handleError = (err, rawFile) => {
  52486. const file = getFile(rawFile);
  52487. if (!file)
  52488. return;
  52489. console.error(err);
  52490. file.status = "fail";
  52491. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  52492. props.onError(err, file, uploadFiles.value);
  52493. props.onChange(file, uploadFiles.value);
  52494. };
  52495. const handleProgress = (evt, rawFile) => {
  52496. const file = getFile(rawFile);
  52497. if (!file)
  52498. return;
  52499. props.onProgress(evt, file, uploadFiles.value);
  52500. file.status = "uploading";
  52501. file.percentage = Math.round(evt.percent);
  52502. };
  52503. const handleSuccess = (response, rawFile) => {
  52504. const file = getFile(rawFile);
  52505. if (!file)
  52506. return;
  52507. file.status = "success";
  52508. file.response = response;
  52509. props.onSuccess(response, file, uploadFiles.value);
  52510. props.onChange(file, uploadFiles.value);
  52511. };
  52512. const handleStart = (file) => {
  52513. if (isNil(file.uid))
  52514. file.uid = genFileId();
  52515. const uploadFile = {
  52516. name: file.name,
  52517. percentage: 0,
  52518. status: "ready",
  52519. size: file.size,
  52520. raw: file,
  52521. uid: file.uid
  52522. };
  52523. if (props.listType === "picture-card" || props.listType === "picture") {
  52524. try {
  52525. uploadFile.url = URL.createObjectURL(file);
  52526. } catch (err) {
  52527. debugWarn(SCOPE$1, err.message);
  52528. props.onError(err, uploadFile, uploadFiles.value);
  52529. }
  52530. }
  52531. uploadFiles.value = [...uploadFiles.value, uploadFile];
  52532. props.onChange(uploadFile, uploadFiles.value);
  52533. };
  52534. const handleRemove = async (file) => {
  52535. const uploadFile = file instanceof File ? getFile(file) : file;
  52536. if (!uploadFile)
  52537. throwError(SCOPE$1, "file to be removed not found");
  52538. const doRemove = (file2) => {
  52539. abort(file2);
  52540. const fileList = uploadFiles.value;
  52541. fileList.splice(fileList.indexOf(file2), 1);
  52542. props.onRemove(file2, fileList);
  52543. revokeObjectURL(file2);
  52544. };
  52545. if (props.beforeRemove) {
  52546. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  52547. if (before !== false)
  52548. doRemove(uploadFile);
  52549. } else {
  52550. doRemove(uploadFile);
  52551. }
  52552. };
  52553. function submit() {
  52554. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  52555. var _a;
  52556. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  52557. });
  52558. }
  52559. vue.watch(() => props.listType, (val) => {
  52560. if (val !== "picture-card" && val !== "picture") {
  52561. return;
  52562. }
  52563. uploadFiles.value = uploadFiles.value.map((file) => {
  52564. const { raw, url } = file;
  52565. if (!url && raw) {
  52566. try {
  52567. file.url = URL.createObjectURL(raw);
  52568. } catch (err) {
  52569. props.onError(err, file, uploadFiles.value);
  52570. }
  52571. }
  52572. return file;
  52573. });
  52574. });
  52575. vue.watch(uploadFiles, (files) => {
  52576. for (const file of files) {
  52577. file.uid || (file.uid = genFileId());
  52578. file.status || (file.status = "success");
  52579. }
  52580. }, { immediate: true, deep: true });
  52581. return {
  52582. uploadFiles,
  52583. abort,
  52584. clearFiles,
  52585. handleError,
  52586. handleProgress,
  52587. handleStart,
  52588. handleSuccess,
  52589. handleRemove,
  52590. submit
  52591. };
  52592. };
  52593. const __default__$2 = vue.defineComponent({
  52594. name: "ElUpload"
  52595. });
  52596. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  52597. ...__default__$2,
  52598. props: uploadProps,
  52599. setup(__props, { expose }) {
  52600. const props = __props;
  52601. const slots = vue.useSlots();
  52602. const disabled = useFormDisabled();
  52603. const uploadRef = vue.shallowRef();
  52604. const {
  52605. abort,
  52606. submit,
  52607. clearFiles,
  52608. uploadFiles,
  52609. handleStart,
  52610. handleError,
  52611. handleRemove,
  52612. handleSuccess,
  52613. handleProgress
  52614. } = useHandlers(props, uploadRef);
  52615. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  52616. const uploadContentProps = vue.computed(() => ({
  52617. ...props,
  52618. fileList: uploadFiles.value,
  52619. onStart: handleStart,
  52620. onProgress: handleProgress,
  52621. onSuccess: handleSuccess,
  52622. onError: handleError,
  52623. onRemove: handleRemove
  52624. }));
  52625. vue.onBeforeUnmount(() => {
  52626. uploadFiles.value.forEach(({ url }) => {
  52627. if (url == null ? void 0 : url.startsWith("blob:"))
  52628. URL.revokeObjectURL(url);
  52629. });
  52630. });
  52631. vue.provide(uploadContextKey, {
  52632. accept: vue.toRef(props, "accept")
  52633. });
  52634. expose({
  52635. abort,
  52636. submit,
  52637. clearFiles,
  52638. handleStart,
  52639. handleRemove
  52640. });
  52641. return (_ctx, _cache) => {
  52642. return vue.openBlock(), vue.createElementBlock("div", null, [
  52643. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  52644. key: 0,
  52645. disabled: vue.unref(disabled),
  52646. "list-type": _ctx.listType,
  52647. files: vue.unref(uploadFiles),
  52648. "handle-preview": _ctx.onPreview,
  52649. onRemove: vue.unref(handleRemove)
  52650. }, vue.createSlots({
  52651. append: vue.withCtx(() => [
  52652. vue.createVNode(UploadContent, vue.mergeProps({
  52653. ref_key: "uploadRef",
  52654. ref: uploadRef
  52655. }, vue.unref(uploadContentProps)), {
  52656. default: vue.withCtx(() => [
  52657. vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  52658. !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  52659. ]),
  52660. _: 3
  52661. }, 16)
  52662. ]),
  52663. _: 2
  52664. }, [
  52665. _ctx.$slots.file ? {
  52666. name: "default",
  52667. fn: vue.withCtx(({ file }) => [
  52668. vue.renderSlot(_ctx.$slots, "file", { file })
  52669. ])
  52670. } : void 0
  52671. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  52672. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  52673. key: 1,
  52674. ref_key: "uploadRef",
  52675. ref: uploadRef
  52676. }, vue.unref(uploadContentProps)), {
  52677. default: vue.withCtx(() => [
  52678. vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  52679. !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  52680. ]),
  52681. _: 3
  52682. }, 16)) : vue.createCommentVNode("v-if", true),
  52683. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  52684. vue.renderSlot(_ctx.$slots, "tip"),
  52685. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  52686. key: 3,
  52687. disabled: vue.unref(disabled),
  52688. "list-type": _ctx.listType,
  52689. files: vue.unref(uploadFiles),
  52690. "handle-preview": _ctx.onPreview,
  52691. onRemove: vue.unref(handleRemove)
  52692. }, vue.createSlots({ _: 2 }, [
  52693. _ctx.$slots.file ? {
  52694. name: "default",
  52695. fn: vue.withCtx(({ file }) => [
  52696. vue.renderSlot(_ctx.$slots, "file", { file })
  52697. ])
  52698. } : void 0
  52699. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  52700. ]);
  52701. };
  52702. }
  52703. });
  52704. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "upload.vue"]]);
  52705. const ElUpload = withInstall(Upload);
  52706. var Components = [
  52707. ElAffix,
  52708. ElAlert,
  52709. ElAutocomplete,
  52710. ElAutoResizer,
  52711. ElAvatar,
  52712. ElBacktop,
  52713. ElBadge,
  52714. ElBreadcrumb,
  52715. ElBreadcrumbItem,
  52716. ElButton,
  52717. ElButtonGroup$1,
  52718. ElCalendar,
  52719. ElCard,
  52720. ElCarousel,
  52721. ElCarouselItem,
  52722. ElCascader,
  52723. ElCascaderPanel,
  52724. ElCheckTag,
  52725. ElCheckbox,
  52726. ElCheckboxButton,
  52727. ElCheckboxGroup$1,
  52728. ElCol,
  52729. ElCollapse,
  52730. ElCollapseItem,
  52731. ElCollapseTransition,
  52732. ElColorPicker,
  52733. ElConfigProvider,
  52734. ElContainer,
  52735. ElAside,
  52736. ElFooter,
  52737. ElHeader,
  52738. ElMain,
  52739. ElDatePicker,
  52740. ElDescriptions,
  52741. ElDescriptionsItem,
  52742. ElDialog,
  52743. ElDivider,
  52744. ElDrawer,
  52745. ElDropdown,
  52746. ElDropdownItem,
  52747. ElDropdownMenu,
  52748. ElEmpty,
  52749. ElForm,
  52750. ElFormItem,
  52751. ElIcon,
  52752. ElImage,
  52753. ElImageViewer,
  52754. ElInput,
  52755. ElInputNumber,
  52756. ElLink,
  52757. ElMenu,
  52758. ElMenuItem,
  52759. ElMenuItemGroup,
  52760. ElSubMenu,
  52761. ElPageHeader,
  52762. ElPagination,
  52763. ElPopconfirm,
  52764. ElPopover,
  52765. ElPopper,
  52766. ElProgress,
  52767. ElRadio,
  52768. ElRadioButton,
  52769. ElRadioGroup,
  52770. ElRate,
  52771. ElResult,
  52772. ElRow,
  52773. ElScrollbar,
  52774. ElSelect,
  52775. ElOption,
  52776. ElOptionGroup,
  52777. ElSelectV2,
  52778. ElSkeleton,
  52779. ElSkeletonItem,
  52780. ElSlider,
  52781. ElSpace,
  52782. ElStatistic,
  52783. ElCountdown,
  52784. ElSteps,
  52785. ElStep,
  52786. ElSwitch,
  52787. ElTable,
  52788. ElTableColumn,
  52789. ElTableV2,
  52790. ElTabs,
  52791. ElTabPane,
  52792. ElTag,
  52793. ElText,
  52794. ElTimePicker,
  52795. ElTimeSelect,
  52796. ElTimeline,
  52797. ElTimelineItem,
  52798. ElTooltip,
  52799. ElTooltipV2,
  52800. ElTransfer,
  52801. ElTree,
  52802. ElTreeSelect,
  52803. ElTreeV2,
  52804. ElUpload
  52805. ];
  52806. const SCOPE = "ElInfiniteScroll";
  52807. const CHECK_INTERVAL = 50;
  52808. const DEFAULT_DELAY = 200;
  52809. const DEFAULT_DISTANCE = 0;
  52810. const attributes = {
  52811. delay: {
  52812. type: Number,
  52813. default: DEFAULT_DELAY
  52814. },
  52815. distance: {
  52816. type: Number,
  52817. default: DEFAULT_DISTANCE
  52818. },
  52819. disabled: {
  52820. type: Boolean,
  52821. default: false
  52822. },
  52823. immediate: {
  52824. type: Boolean,
  52825. default: true
  52826. }
  52827. };
  52828. const getScrollOptions = (el, instance) => {
  52829. return Object.entries(attributes).reduce((acm, [name, option]) => {
  52830. var _a, _b;
  52831. const { type, default: defaultValue } = option;
  52832. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  52833. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  52834. value = value === "false" ? false : value;
  52835. value = type(value);
  52836. acm[name] = Number.isNaN(value) ? defaultValue : value;
  52837. return acm;
  52838. }, {});
  52839. };
  52840. const destroyObserver = (el) => {
  52841. const { observer } = el[SCOPE];
  52842. if (observer) {
  52843. observer.disconnect();
  52844. delete el[SCOPE].observer;
  52845. }
  52846. };
  52847. const handleScroll = (el, cb) => {
  52848. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  52849. const { disabled, distance } = getScrollOptions(el, instance);
  52850. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  52851. const delta = scrollTop - lastScrollTop;
  52852. el[SCOPE].lastScrollTop = scrollTop;
  52853. if (observer || disabled || delta < 0)
  52854. return;
  52855. let shouldTrigger = false;
  52856. if (container === el) {
  52857. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  52858. } else {
  52859. const { clientTop, scrollHeight: height } = el;
  52860. const offsetTop = getOffsetTopDistance(el, containerEl);
  52861. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  52862. }
  52863. if (shouldTrigger) {
  52864. cb.call(instance);
  52865. }
  52866. };
  52867. function checkFull(el, cb) {
  52868. const { containerEl, instance } = el[SCOPE];
  52869. const { disabled } = getScrollOptions(el, instance);
  52870. if (disabled || containerEl.clientHeight === 0)
  52871. return;
  52872. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  52873. cb.call(instance);
  52874. } else {
  52875. destroyObserver(el);
  52876. }
  52877. }
  52878. const InfiniteScroll = {
  52879. async mounted(el, binding) {
  52880. const { instance, value: cb } = binding;
  52881. if (!isFunction$1(cb)) {
  52882. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  52883. }
  52884. await vue.nextTick();
  52885. const { delay, immediate } = getScrollOptions(el, instance);
  52886. const container = getScrollContainer(el, true);
  52887. const containerEl = container === window ? document.documentElement : container;
  52888. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  52889. if (!container)
  52890. return;
  52891. el[SCOPE] = {
  52892. instance,
  52893. container,
  52894. containerEl,
  52895. delay,
  52896. cb,
  52897. onScroll,
  52898. lastScrollTop: containerEl.scrollTop
  52899. };
  52900. if (immediate) {
  52901. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  52902. el[SCOPE].observer = observer;
  52903. observer.observe(el, { childList: true, subtree: true });
  52904. checkFull(el, cb);
  52905. }
  52906. container.addEventListener("scroll", onScroll);
  52907. },
  52908. unmounted(el) {
  52909. const { container, onScroll } = el[SCOPE];
  52910. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  52911. destroyObserver(el);
  52912. },
  52913. async updated(el) {
  52914. if (!el[SCOPE]) {
  52915. await vue.nextTick();
  52916. } else {
  52917. const { containerEl, cb, observer } = el[SCOPE];
  52918. if (containerEl.clientHeight && observer) {
  52919. checkFull(el, cb);
  52920. }
  52921. }
  52922. }
  52923. };
  52924. var InfiniteScroll$1 = InfiniteScroll;
  52925. const _InfiniteScroll = InfiniteScroll$1;
  52926. _InfiniteScroll.install = (app) => {
  52927. app.directive("InfiniteScroll", _InfiniteScroll);
  52928. };
  52929. const ElInfiniteScroll = _InfiniteScroll;
  52930. function createLoadingComponent(options) {
  52931. let afterLeaveTimer;
  52932. const afterLeaveFlag = vue.ref(false);
  52933. const data = vue.reactive({
  52934. ...options,
  52935. originalPosition: "",
  52936. originalOverflow: "",
  52937. visible: false
  52938. });
  52939. function setText(text) {
  52940. data.text = text;
  52941. }
  52942. function destroySelf() {
  52943. const target = data.parent;
  52944. const ns = vm.ns;
  52945. if (!target.vLoadingAddClassList) {
  52946. let loadingNumber = target.getAttribute("loading-number");
  52947. loadingNumber = Number.parseInt(loadingNumber) - 1;
  52948. if (!loadingNumber) {
  52949. removeClass(target, ns.bm("parent", "relative"));
  52950. target.removeAttribute("loading-number");
  52951. } else {
  52952. target.setAttribute("loading-number", loadingNumber.toString());
  52953. }
  52954. removeClass(target, ns.bm("parent", "hidden"));
  52955. }
  52956. removeElLoadingChild();
  52957. loadingInstance.unmount();
  52958. }
  52959. function removeElLoadingChild() {
  52960. var _a, _b;
  52961. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  52962. }
  52963. function close() {
  52964. var _a;
  52965. if (options.beforeClose && !options.beforeClose())
  52966. return;
  52967. afterLeaveFlag.value = true;
  52968. clearTimeout(afterLeaveTimer);
  52969. afterLeaveTimer = window.setTimeout(handleAfterLeave, 400);
  52970. data.visible = false;
  52971. (_a = options.closed) == null ? void 0 : _a.call(options);
  52972. }
  52973. function handleAfterLeave() {
  52974. if (!afterLeaveFlag.value)
  52975. return;
  52976. const target = data.parent;
  52977. afterLeaveFlag.value = false;
  52978. target.vLoadingAddClassList = void 0;
  52979. destroySelf();
  52980. }
  52981. const elLoadingComponent = vue.defineComponent({
  52982. name: "ElLoading",
  52983. setup(_, { expose }) {
  52984. const { ns } = useGlobalComponentSettings("loading");
  52985. const zIndex = useZIndex();
  52986. expose({
  52987. ns,
  52988. zIndex
  52989. });
  52990. return () => {
  52991. const svg = data.spinner || data.svg;
  52992. const spinner = vue.h("svg", {
  52993. class: "circular",
  52994. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  52995. ...svg ? { innerHTML: svg } : {}
  52996. }, [
  52997. vue.h("circle", {
  52998. class: "path",
  52999. cx: "25",
  53000. cy: "25",
  53001. r: "20",
  53002. fill: "none"
  53003. })
  53004. ]);
  53005. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  53006. return vue.h(vue.Transition, {
  53007. name: ns.b("fade"),
  53008. onAfterLeave: handleAfterLeave
  53009. }, {
  53010. default: vue.withCtx(() => [
  53011. vue.withDirectives(vue.createVNode("div", {
  53012. style: {
  53013. backgroundColor: data.background || ""
  53014. },
  53015. class: [
  53016. ns.b("mask"),
  53017. data.customClass,
  53018. data.fullscreen ? "is-fullscreen" : ""
  53019. ]
  53020. }, [
  53021. vue.h("div", {
  53022. class: ns.b("spinner")
  53023. }, [spinner, spinnerText])
  53024. ]), [[vue.vShow, data.visible]])
  53025. ])
  53026. });
  53027. };
  53028. }
  53029. });
  53030. const loadingInstance = vue.createApp(elLoadingComponent);
  53031. const vm = loadingInstance.mount(document.createElement("div"));
  53032. return {
  53033. ...vue.toRefs(data),
  53034. setText,
  53035. removeElLoadingChild,
  53036. close,
  53037. handleAfterLeave,
  53038. vm,
  53039. get $el() {
  53040. return vm.$el;
  53041. }
  53042. };
  53043. }
  53044. let fullscreenInstance = void 0;
  53045. const Loading = function(options = {}) {
  53046. if (!isClient)
  53047. return void 0;
  53048. const resolved = resolveOptions(options);
  53049. if (resolved.fullscreen && fullscreenInstance) {
  53050. return fullscreenInstance;
  53051. }
  53052. const instance = createLoadingComponent({
  53053. ...resolved,
  53054. closed: () => {
  53055. var _a;
  53056. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  53057. if (resolved.fullscreen)
  53058. fullscreenInstance = void 0;
  53059. }
  53060. });
  53061. addStyle(resolved, resolved.parent, instance);
  53062. addClassList(resolved, resolved.parent, instance);
  53063. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  53064. let loadingNumber = resolved.parent.getAttribute("loading-number");
  53065. if (!loadingNumber) {
  53066. loadingNumber = "1";
  53067. } else {
  53068. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  53069. }
  53070. resolved.parent.setAttribute("loading-number", loadingNumber);
  53071. resolved.parent.appendChild(instance.$el);
  53072. vue.nextTick(() => instance.visible.value = resolved.visible);
  53073. if (resolved.fullscreen) {
  53074. fullscreenInstance = instance;
  53075. }
  53076. return instance;
  53077. };
  53078. const resolveOptions = (options) => {
  53079. var _a, _b, _c, _d;
  53080. let target;
  53081. if (isString$1(options.target)) {
  53082. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  53083. } else {
  53084. target = options.target || document.body;
  53085. }
  53086. return {
  53087. parent: target === document.body || options.body ? document.body : target,
  53088. background: options.background || "",
  53089. svg: options.svg || "",
  53090. svgViewBox: options.svgViewBox || "",
  53091. spinner: options.spinner || false,
  53092. text: options.text || "",
  53093. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  53094. lock: (_c = options.lock) != null ? _c : false,
  53095. customClass: options.customClass || "",
  53096. visible: (_d = options.visible) != null ? _d : true,
  53097. target
  53098. };
  53099. };
  53100. const addStyle = async (options, parent, instance) => {
  53101. const { nextZIndex } = instance.vm.zIndex;
  53102. const maskStyle = {};
  53103. if (options.fullscreen) {
  53104. instance.originalPosition.value = getStyle(document.body, "position");
  53105. instance.originalOverflow.value = getStyle(document.body, "overflow");
  53106. maskStyle.zIndex = nextZIndex();
  53107. } else if (options.parent === document.body) {
  53108. instance.originalPosition.value = getStyle(document.body, "position");
  53109. await vue.nextTick();
  53110. for (const property of ["top", "left"]) {
  53111. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  53112. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  53113. }
  53114. for (const property of ["height", "width"]) {
  53115. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  53116. }
  53117. } else {
  53118. instance.originalPosition.value = getStyle(parent, "position");
  53119. }
  53120. for (const [key, value] of Object.entries(maskStyle)) {
  53121. instance.$el.style[key] = value;
  53122. }
  53123. };
  53124. const addClassList = (options, parent, instance) => {
  53125. const ns = instance.vm.ns;
  53126. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  53127. addClass(parent, ns.bm("parent", "relative"));
  53128. } else {
  53129. removeClass(parent, ns.bm("parent", "relative"));
  53130. }
  53131. if (options.fullscreen && options.lock) {
  53132. addClass(parent, ns.bm("parent", "hidden"));
  53133. } else {
  53134. removeClass(parent, ns.bm("parent", "hidden"));
  53135. }
  53136. };
  53137. const INSTANCE_KEY = Symbol("ElLoading");
  53138. const createInstance = (el, binding) => {
  53139. var _a, _b, _c, _d;
  53140. const vm = binding.instance;
  53141. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  53142. const resolveExpression = (key) => {
  53143. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  53144. if (data)
  53145. return vue.ref(data);
  53146. else
  53147. return data;
  53148. };
  53149. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  53150. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  53151. const options = {
  53152. text: getProp("text"),
  53153. svg: getProp("svg"),
  53154. svgViewBox: getProp("svgViewBox"),
  53155. spinner: getProp("spinner"),
  53156. background: getProp("background"),
  53157. customClass: getProp("customClass"),
  53158. fullscreen,
  53159. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  53160. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  53161. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  53162. };
  53163. el[INSTANCE_KEY] = {
  53164. options,
  53165. instance: Loading(options)
  53166. };
  53167. };
  53168. const updateOptions = (newOptions, originalOptions) => {
  53169. for (const key of Object.keys(originalOptions)) {
  53170. if (vue.isRef(originalOptions[key]))
  53171. originalOptions[key].value = newOptions[key];
  53172. }
  53173. };
  53174. const vLoading = {
  53175. mounted(el, binding) {
  53176. if (binding.value) {
  53177. createInstance(el, binding);
  53178. }
  53179. },
  53180. updated(el, binding) {
  53181. const instance = el[INSTANCE_KEY];
  53182. if (binding.oldValue !== binding.value) {
  53183. if (binding.value && !binding.oldValue) {
  53184. createInstance(el, binding);
  53185. } else if (binding.value && binding.oldValue) {
  53186. if (isObject$1(binding.value))
  53187. updateOptions(binding.value, instance.options);
  53188. } else {
  53189. instance == null ? void 0 : instance.instance.close();
  53190. }
  53191. }
  53192. },
  53193. unmounted(el) {
  53194. var _a;
  53195. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  53196. }
  53197. };
  53198. const ElLoading = {
  53199. install(app) {
  53200. app.directive("loading", vLoading);
  53201. app.config.globalProperties.$loading = Loading;
  53202. },
  53203. directive: vLoading,
  53204. service: Loading
  53205. };
  53206. const messageTypes = ["success", "info", "warning", "error"];
  53207. const messageDefaults = mutable({
  53208. customClass: "",
  53209. center: false,
  53210. dangerouslyUseHTMLString: false,
  53211. duration: 3e3,
  53212. icon: void 0,
  53213. id: "",
  53214. message: "",
  53215. onClose: void 0,
  53216. showClose: false,
  53217. type: "info",
  53218. offset: 16,
  53219. zIndex: 0,
  53220. grouping: false,
  53221. repeatNum: 1,
  53222. appendTo: isClient ? document.body : void 0
  53223. });
  53224. const messageProps = buildProps({
  53225. customClass: {
  53226. type: String,
  53227. default: messageDefaults.customClass
  53228. },
  53229. center: {
  53230. type: Boolean,
  53231. default: messageDefaults.center
  53232. },
  53233. dangerouslyUseHTMLString: {
  53234. type: Boolean,
  53235. default: messageDefaults.dangerouslyUseHTMLString
  53236. },
  53237. duration: {
  53238. type: Number,
  53239. default: messageDefaults.duration
  53240. },
  53241. icon: {
  53242. type: iconPropType,
  53243. default: messageDefaults.icon
  53244. },
  53245. id: {
  53246. type: String,
  53247. default: messageDefaults.id
  53248. },
  53249. message: {
  53250. type: definePropType([
  53251. String,
  53252. Object,
  53253. Function
  53254. ]),
  53255. default: messageDefaults.message
  53256. },
  53257. onClose: {
  53258. type: definePropType(Function),
  53259. required: false
  53260. },
  53261. showClose: {
  53262. type: Boolean,
  53263. default: messageDefaults.showClose
  53264. },
  53265. type: {
  53266. type: String,
  53267. values: messageTypes,
  53268. default: messageDefaults.type
  53269. },
  53270. offset: {
  53271. type: Number,
  53272. default: messageDefaults.offset
  53273. },
  53274. zIndex: {
  53275. type: Number,
  53276. default: messageDefaults.zIndex
  53277. },
  53278. grouping: {
  53279. type: Boolean,
  53280. default: messageDefaults.grouping
  53281. },
  53282. repeatNum: {
  53283. type: Number,
  53284. default: messageDefaults.repeatNum
  53285. }
  53286. });
  53287. const messageEmits = {
  53288. destroy: () => true
  53289. };
  53290. const instances = vue.shallowReactive([]);
  53291. const getInstance = (id) => {
  53292. const idx = instances.findIndex((instance) => instance.id === id);
  53293. const current = instances[idx];
  53294. let prev;
  53295. if (idx > 0) {
  53296. prev = instances[idx - 1];
  53297. }
  53298. return { current, prev };
  53299. };
  53300. const getLastOffset = (id) => {
  53301. const { prev } = getInstance(id);
  53302. if (!prev)
  53303. return 0;
  53304. return prev.vm.exposed.bottom.value;
  53305. };
  53306. const getOffsetOrSpace = (id, offset) => {
  53307. const idx = instances.findIndex((instance) => instance.id === id);
  53308. return idx > 0 ? 20 : offset;
  53309. };
  53310. const _hoisted_1$2 = ["id"];
  53311. const _hoisted_2$2 = ["innerHTML"];
  53312. const __default__$1 = vue.defineComponent({
  53313. name: "ElMessage"
  53314. });
  53315. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  53316. ...__default__$1,
  53317. props: messageProps,
  53318. emits: messageEmits,
  53319. setup(__props, { expose }) {
  53320. const props = __props;
  53321. const { Close } = TypeComponents;
  53322. const { ns, zIndex } = useGlobalComponentSettings("message");
  53323. const { currentZIndex, nextZIndex } = zIndex;
  53324. const messageRef = vue.ref();
  53325. const visible = vue.ref(false);
  53326. const height = vue.ref(0);
  53327. let stopTimer = void 0;
  53328. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  53329. const typeClass = vue.computed(() => {
  53330. const type = props.type;
  53331. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  53332. });
  53333. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  53334. const lastOffset = vue.computed(() => getLastOffset(props.id));
  53335. const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  53336. const bottom = vue.computed(() => height.value + offset.value);
  53337. const customStyle = vue.computed(() => ({
  53338. top: `${offset.value}px`,
  53339. zIndex: currentZIndex.value
  53340. }));
  53341. function startTimer() {
  53342. if (props.duration === 0)
  53343. return;
  53344. ({ stop: stopTimer } = useTimeoutFn(() => {
  53345. close();
  53346. }, props.duration));
  53347. }
  53348. function clearTimer() {
  53349. stopTimer == null ? void 0 : stopTimer();
  53350. }
  53351. function close() {
  53352. visible.value = false;
  53353. }
  53354. function keydown({ code }) {
  53355. if (code === EVENT_CODE.esc) {
  53356. close();
  53357. }
  53358. }
  53359. vue.onMounted(() => {
  53360. startTimer();
  53361. nextZIndex();
  53362. visible.value = true;
  53363. });
  53364. vue.watch(() => props.repeatNum, () => {
  53365. clearTimer();
  53366. startTimer();
  53367. });
  53368. useEventListener(document, "keydown", keydown);
  53369. useResizeObserver(messageRef, () => {
  53370. height.value = messageRef.value.getBoundingClientRect().height;
  53371. });
  53372. expose({
  53373. visible,
  53374. bottom,
  53375. close
  53376. });
  53377. return (_ctx, _cache) => {
  53378. return vue.openBlock(), vue.createBlock(vue.Transition, {
  53379. name: vue.unref(ns).b("fade"),
  53380. onBeforeLeave: _ctx.onClose,
  53381. onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")),
  53382. persisted: ""
  53383. }, {
  53384. default: vue.withCtx(() => [
  53385. vue.withDirectives(vue.createElementVNode("div", {
  53386. id: _ctx.id,
  53387. ref_key: "messageRef",
  53388. ref: messageRef,
  53389. class: vue.normalizeClass([
  53390. vue.unref(ns).b(),
  53391. { [vue.unref(ns).m(_ctx.type)]: _ctx.type && !_ctx.icon },
  53392. vue.unref(ns).is("center", _ctx.center),
  53393. vue.unref(ns).is("closable", _ctx.showClose),
  53394. _ctx.customClass
  53395. ]),
  53396. style: vue.normalizeStyle(vue.unref(customStyle)),
  53397. role: "alert",
  53398. onMouseenter: clearTimer,
  53399. onMouseleave: startTimer
  53400. }, [
  53401. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  53402. key: 0,
  53403. value: _ctx.repeatNum,
  53404. type: vue.unref(badgeType),
  53405. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  53406. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  53407. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53408. key: 1,
  53409. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  53410. }, {
  53411. default: vue.withCtx(() => [
  53412. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  53413. ]),
  53414. _: 1
  53415. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  53416. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  53417. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  53418. key: 0,
  53419. class: vue.normalizeClass(vue.unref(ns).e("content"))
  53420. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  53421. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  53422. vue.createElementVNode("p", {
  53423. class: vue.normalizeClass(vue.unref(ns).e("content")),
  53424. innerHTML: _ctx.message
  53425. }, null, 10, _hoisted_2$2)
  53426. ], 2112))
  53427. ]),
  53428. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53429. key: 2,
  53430. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  53431. onClick: vue.withModifiers(close, ["stop"])
  53432. }, {
  53433. default: vue.withCtx(() => [
  53434. vue.createVNode(vue.unref(Close))
  53435. ]),
  53436. _: 1
  53437. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  53438. ], 46, _hoisted_1$2), [
  53439. [vue.vShow, visible.value]
  53440. ])
  53441. ]),
  53442. _: 3
  53443. }, 8, ["name", "onBeforeLeave"]);
  53444. };
  53445. }
  53446. });
  53447. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  53448. let seed$1 = 1;
  53449. const normalizeOptions = (params) => {
  53450. const options = !params || isString$1(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
  53451. const normalized = {
  53452. ...messageDefaults,
  53453. ...options
  53454. };
  53455. if (!normalized.appendTo) {
  53456. normalized.appendTo = document.body;
  53457. } else if (isString$1(normalized.appendTo)) {
  53458. let appendTo = document.querySelector(normalized.appendTo);
  53459. if (!isElement$1(appendTo)) {
  53460. appendTo = document.body;
  53461. }
  53462. normalized.appendTo = appendTo;
  53463. }
  53464. return normalized;
  53465. };
  53466. const closeMessage = (instance) => {
  53467. const idx = instances.indexOf(instance);
  53468. if (idx === -1)
  53469. return;
  53470. instances.splice(idx, 1);
  53471. const { handler } = instance;
  53472. handler.close();
  53473. };
  53474. const createMessage = ({ appendTo, ...options }, context) => {
  53475. const id = `message_${seed$1++}`;
  53476. const userOnClose = options.onClose;
  53477. const container = document.createElement("div");
  53478. const props = {
  53479. ...options,
  53480. id,
  53481. onClose: () => {
  53482. userOnClose == null ? void 0 : userOnClose();
  53483. closeMessage(instance);
  53484. },
  53485. onDestroy: () => {
  53486. vue.render(null, container);
  53487. }
  53488. };
  53489. const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  53490. default: isFunction$1(props.message) ? props.message : () => props.message
  53491. } : null);
  53492. vnode.appContext = context || message._context;
  53493. vue.render(vnode, container);
  53494. appendTo.appendChild(container.firstElementChild);
  53495. const vm = vnode.component;
  53496. const handler = {
  53497. close: () => {
  53498. vm.exposed.visible.value = false;
  53499. }
  53500. };
  53501. const instance = {
  53502. id,
  53503. vnode,
  53504. vm,
  53505. handler,
  53506. props: vnode.component.props
  53507. };
  53508. return instance;
  53509. };
  53510. const message = (options = {}, context) => {
  53511. if (!isClient)
  53512. return { close: () => void 0 };
  53513. if (isNumber$1(messageConfig.max) && instances.length >= messageConfig.max) {
  53514. return { close: () => void 0 };
  53515. }
  53516. const normalized = normalizeOptions(options);
  53517. if (normalized.grouping && instances.length) {
  53518. const instance2 = instances.find(({ vnode: vm }) => {
  53519. var _a;
  53520. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  53521. });
  53522. if (instance2) {
  53523. instance2.props.repeatNum += 1;
  53524. instance2.props.type = normalized.type;
  53525. return instance2.handler;
  53526. }
  53527. }
  53528. const instance = createMessage(normalized, context);
  53529. instances.push(instance);
  53530. return instance.handler;
  53531. };
  53532. messageTypes.forEach((type) => {
  53533. message[type] = (options = {}, appContext) => {
  53534. const normalized = normalizeOptions(options);
  53535. return message({ ...normalized, type }, appContext);
  53536. };
  53537. });
  53538. function closeAll$1(type) {
  53539. for (const instance of instances) {
  53540. if (!type || type === instance.props.type) {
  53541. instance.handler.close();
  53542. }
  53543. }
  53544. }
  53545. message.closeAll = closeAll$1;
  53546. message._context = null;
  53547. var Message = message;
  53548. const ElMessage = withInstallFunction(Message, "$message");
  53549. const _sfc_main$1 = vue.defineComponent({
  53550. name: "ElMessageBox",
  53551. directives: {
  53552. TrapFocus
  53553. },
  53554. components: {
  53555. ElButton,
  53556. ElFocusTrap,
  53557. ElInput,
  53558. ElOverlay,
  53559. ElIcon,
  53560. ...TypeComponents
  53561. },
  53562. inheritAttrs: false,
  53563. props: {
  53564. buttonSize: {
  53565. type: String,
  53566. validator: isValidComponentSize
  53567. },
  53568. modal: {
  53569. type: Boolean,
  53570. default: true
  53571. },
  53572. lockScroll: {
  53573. type: Boolean,
  53574. default: true
  53575. },
  53576. showClose: {
  53577. type: Boolean,
  53578. default: true
  53579. },
  53580. closeOnClickModal: {
  53581. type: Boolean,
  53582. default: true
  53583. },
  53584. closeOnPressEscape: {
  53585. type: Boolean,
  53586. default: true
  53587. },
  53588. closeOnHashChange: {
  53589. type: Boolean,
  53590. default: true
  53591. },
  53592. center: Boolean,
  53593. draggable: Boolean,
  53594. roundButton: {
  53595. default: false,
  53596. type: Boolean
  53597. },
  53598. container: {
  53599. type: String,
  53600. default: "body"
  53601. },
  53602. boxType: {
  53603. type: String,
  53604. default: ""
  53605. }
  53606. },
  53607. emits: ["vanish", "action"],
  53608. setup(props, { emit }) {
  53609. const {
  53610. locale,
  53611. zIndex,
  53612. ns,
  53613. size: btnSize
  53614. } = useGlobalComponentSettings("message-box", vue.computed(() => props.buttonSize));
  53615. const { t } = locale;
  53616. const { nextZIndex } = zIndex;
  53617. const visible = vue.ref(false);
  53618. const state = vue.reactive({
  53619. autofocus: true,
  53620. beforeClose: null,
  53621. callback: null,
  53622. cancelButtonText: "",
  53623. cancelButtonClass: "",
  53624. confirmButtonText: "",
  53625. confirmButtonClass: "",
  53626. customClass: "",
  53627. customStyle: {},
  53628. dangerouslyUseHTMLString: false,
  53629. distinguishCancelAndClose: false,
  53630. icon: "",
  53631. inputPattern: null,
  53632. inputPlaceholder: "",
  53633. inputType: "text",
  53634. inputValue: null,
  53635. inputValidator: null,
  53636. inputErrorMessage: "",
  53637. message: null,
  53638. modalFade: true,
  53639. modalClass: "",
  53640. showCancelButton: false,
  53641. showConfirmButton: true,
  53642. type: "",
  53643. title: void 0,
  53644. showInput: false,
  53645. action: "",
  53646. confirmButtonLoading: false,
  53647. cancelButtonLoading: false,
  53648. confirmButtonDisabled: false,
  53649. editorErrorMessage: "",
  53650. validateError: false,
  53651. zIndex: nextZIndex()
  53652. });
  53653. const typeClass = vue.computed(() => {
  53654. const type = state.type;
  53655. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  53656. });
  53657. const contentId = useId();
  53658. const inputId = useId();
  53659. const iconComponent = vue.computed(() => state.icon || TypeComponentsMap[state.type] || "");
  53660. const hasMessage = vue.computed(() => !!state.message);
  53661. const rootRef = vue.ref();
  53662. const headerRef = vue.ref();
  53663. const focusStartRef = vue.ref();
  53664. const inputRef = vue.ref();
  53665. const confirmRef = vue.ref();
  53666. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  53667. vue.watch(() => state.inputValue, async (val) => {
  53668. await vue.nextTick();
  53669. if (props.boxType === "prompt" && val !== null) {
  53670. validate();
  53671. }
  53672. }, { immediate: true });
  53673. vue.watch(() => visible.value, (val) => {
  53674. var _a, _b;
  53675. if (val) {
  53676. if (props.boxType !== "prompt") {
  53677. if (state.autofocus) {
  53678. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  53679. } else {
  53680. focusStartRef.value = rootRef.value;
  53681. }
  53682. }
  53683. state.zIndex = nextZIndex();
  53684. }
  53685. if (props.boxType !== "prompt")
  53686. return;
  53687. if (val) {
  53688. vue.nextTick().then(() => {
  53689. var _a2;
  53690. if (inputRef.value && inputRef.value.$el) {
  53691. if (state.autofocus) {
  53692. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  53693. } else {
  53694. focusStartRef.value = rootRef.value;
  53695. }
  53696. }
  53697. });
  53698. } else {
  53699. state.editorErrorMessage = "";
  53700. state.validateError = false;
  53701. }
  53702. });
  53703. const draggable = vue.computed(() => props.draggable);
  53704. useDraggable(rootRef, headerRef, draggable);
  53705. vue.onMounted(async () => {
  53706. await vue.nextTick();
  53707. if (props.closeOnHashChange) {
  53708. window.addEventListener("hashchange", doClose);
  53709. }
  53710. });
  53711. vue.onBeforeUnmount(() => {
  53712. if (props.closeOnHashChange) {
  53713. window.removeEventListener("hashchange", doClose);
  53714. }
  53715. });
  53716. function doClose() {
  53717. if (!visible.value)
  53718. return;
  53719. visible.value = false;
  53720. vue.nextTick(() => {
  53721. if (state.action)
  53722. emit("action", state.action);
  53723. });
  53724. }
  53725. const handleWrapperClick = () => {
  53726. if (props.closeOnClickModal) {
  53727. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  53728. }
  53729. };
  53730. const overlayEvent = useSameTarget(handleWrapperClick);
  53731. const handleInputEnter = (e) => {
  53732. if (state.inputType !== "textarea") {
  53733. e.preventDefault();
  53734. return handleAction("confirm");
  53735. }
  53736. };
  53737. const handleAction = (action) => {
  53738. var _a;
  53739. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  53740. return;
  53741. }
  53742. state.action = action;
  53743. if (state.beforeClose) {
  53744. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  53745. } else {
  53746. doClose();
  53747. }
  53748. };
  53749. const validate = () => {
  53750. if (props.boxType === "prompt") {
  53751. const inputPattern = state.inputPattern;
  53752. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  53753. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  53754. state.validateError = true;
  53755. return false;
  53756. }
  53757. const inputValidator = state.inputValidator;
  53758. if (typeof inputValidator === "function") {
  53759. const validateResult = inputValidator(state.inputValue);
  53760. if (validateResult === false) {
  53761. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  53762. state.validateError = true;
  53763. return false;
  53764. }
  53765. if (typeof validateResult === "string") {
  53766. state.editorErrorMessage = validateResult;
  53767. state.validateError = true;
  53768. return false;
  53769. }
  53770. }
  53771. }
  53772. state.editorErrorMessage = "";
  53773. state.validateError = false;
  53774. return true;
  53775. };
  53776. const getInputElement = () => {
  53777. const inputRefs = inputRef.value.$refs;
  53778. return inputRefs.input || inputRefs.textarea;
  53779. };
  53780. const handleClose = () => {
  53781. handleAction("close");
  53782. };
  53783. const onCloseRequested = () => {
  53784. if (props.closeOnPressEscape) {
  53785. handleClose();
  53786. }
  53787. };
  53788. if (props.lockScroll) {
  53789. useLockscreen(visible);
  53790. }
  53791. useRestoreActive(visible);
  53792. return {
  53793. ...vue.toRefs(state),
  53794. ns,
  53795. overlayEvent,
  53796. visible,
  53797. hasMessage,
  53798. typeClass,
  53799. contentId,
  53800. inputId,
  53801. btnSize,
  53802. iconComponent,
  53803. confirmButtonClasses,
  53804. rootRef,
  53805. focusStartRef,
  53806. headerRef,
  53807. inputRef,
  53808. confirmRef,
  53809. doClose,
  53810. handleClose,
  53811. onCloseRequested,
  53812. handleWrapperClick,
  53813. handleInputEnter,
  53814. handleAction,
  53815. t
  53816. };
  53817. }
  53818. });
  53819. const _hoisted_1$1 = ["aria-label", "aria-describedby"];
  53820. const _hoisted_2$1 = ["aria-label"];
  53821. const _hoisted_3$1 = ["id"];
  53822. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  53823. const _component_el_icon = vue.resolveComponent("el-icon");
  53824. const _component_close = vue.resolveComponent("close");
  53825. const _component_el_input = vue.resolveComponent("el-input");
  53826. const _component_el_button = vue.resolveComponent("el-button");
  53827. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  53828. const _component_el_overlay = vue.resolveComponent("el-overlay");
  53829. return vue.openBlock(), vue.createBlock(vue.Transition, {
  53830. name: "fade-in-linear",
  53831. onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")),
  53832. persisted: ""
  53833. }, {
  53834. default: vue.withCtx(() => [
  53835. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  53836. "z-index": _ctx.zIndex,
  53837. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  53838. mask: _ctx.modal
  53839. }, {
  53840. default: vue.withCtx(() => [
  53841. vue.createElementVNode("div", {
  53842. role: "dialog",
  53843. "aria-label": _ctx.title,
  53844. "aria-modal": "true",
  53845. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  53846. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  53847. onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
  53848. onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
  53849. onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
  53850. }, [
  53851. vue.createVNode(_component_el_focus_trap, {
  53852. loop: "",
  53853. trapped: _ctx.visible,
  53854. "focus-trap-el": _ctx.rootRef,
  53855. "focus-start-el": _ctx.focusStartRef,
  53856. onReleaseRequested: _ctx.onCloseRequested
  53857. }, {
  53858. default: vue.withCtx(() => [
  53859. vue.createElementVNode("div", {
  53860. ref: "rootRef",
  53861. class: vue.normalizeClass([
  53862. _ctx.ns.b(),
  53863. _ctx.customClass,
  53864. _ctx.ns.is("draggable", _ctx.draggable),
  53865. { [_ctx.ns.m("center")]: _ctx.center }
  53866. ]),
  53867. style: vue.normalizeStyle(_ctx.customStyle),
  53868. tabindex: "-1",
  53869. onClick: _cache[7] || (_cache[7] = vue.withModifiers(() => {
  53870. }, ["stop"]))
  53871. }, [
  53872. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  53873. key: 0,
  53874. ref: "headerRef",
  53875. class: vue.normalizeClass(_ctx.ns.e("header"))
  53876. }, [
  53877. vue.createElementVNode("div", {
  53878. class: vue.normalizeClass(_ctx.ns.e("title"))
  53879. }, [
  53880. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  53881. key: 0,
  53882. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  53883. }, {
  53884. default: vue.withCtx(() => [
  53885. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  53886. ]),
  53887. _: 1
  53888. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  53889. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  53890. ], 2),
  53891. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  53892. key: 0,
  53893. type: "button",
  53894. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  53895. "aria-label": _ctx.t("el.messagebox.close"),
  53896. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
  53897. onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
  53898. }, [
  53899. vue.createVNode(_component_el_icon, {
  53900. class: vue.normalizeClass(_ctx.ns.e("close"))
  53901. }, {
  53902. default: vue.withCtx(() => [
  53903. vue.createVNode(_component_close)
  53904. ]),
  53905. _: 1
  53906. }, 8, ["class"])
  53907. ], 42, _hoisted_2$1)) : vue.createCommentVNode("v-if", true)
  53908. ], 2)) : vue.createCommentVNode("v-if", true),
  53909. vue.createElementVNode("div", {
  53910. id: _ctx.contentId,
  53911. class: vue.normalizeClass(_ctx.ns.e("content"))
  53912. }, [
  53913. vue.createElementVNode("div", {
  53914. class: vue.normalizeClass(_ctx.ns.e("container"))
  53915. }, [
  53916. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  53917. key: 0,
  53918. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  53919. }, {
  53920. default: vue.withCtx(() => [
  53921. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  53922. ]),
  53923. _: 1
  53924. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  53925. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  53926. key: 1,
  53927. class: vue.normalizeClass(_ctx.ns.e("message"))
  53928. }, [
  53929. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  53930. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  53931. key: 0,
  53932. for: _ctx.showInput ? _ctx.inputId : void 0
  53933. }, {
  53934. default: vue.withCtx(() => [
  53935. vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  53936. ]),
  53937. _: 1
  53938. }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  53939. key: 1,
  53940. for: _ctx.showInput ? _ctx.inputId : void 0,
  53941. innerHTML: _ctx.message
  53942. }, null, 8, ["for", "innerHTML"]))
  53943. ])
  53944. ], 2)) : vue.createCommentVNode("v-if", true)
  53945. ], 2),
  53946. vue.withDirectives(vue.createElementVNode("div", {
  53947. class: vue.normalizeClass(_ctx.ns.e("input"))
  53948. }, [
  53949. vue.createVNode(_component_el_input, {
  53950. id: _ctx.inputId,
  53951. ref: "inputRef",
  53952. modelValue: _ctx.inputValue,
  53953. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
  53954. type: _ctx.inputType,
  53955. placeholder: _ctx.inputPlaceholder,
  53956. "aria-invalid": _ctx.validateError,
  53957. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  53958. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  53959. }, null, 8, ["id", "modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  53960. vue.createElementVNode("div", {
  53961. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  53962. style: vue.normalizeStyle({
  53963. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  53964. })
  53965. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  53966. ], 2), [
  53967. [vue.vShow, _ctx.showInput]
  53968. ])
  53969. ], 10, _hoisted_3$1),
  53970. vue.createElementVNode("div", {
  53971. class: vue.normalizeClass(_ctx.ns.e("btns"))
  53972. }, [
  53973. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  53974. key: 0,
  53975. loading: _ctx.cancelButtonLoading,
  53976. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  53977. round: _ctx.roundButton,
  53978. size: _ctx.btnSize,
  53979. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
  53980. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
  53981. }, {
  53982. default: vue.withCtx(() => [
  53983. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  53984. ]),
  53985. _: 1
  53986. }, 8, ["loading", "class", "round", "size"])) : vue.createCommentVNode("v-if", true),
  53987. vue.withDirectives(vue.createVNode(_component_el_button, {
  53988. ref: "confirmRef",
  53989. type: "primary",
  53990. loading: _ctx.confirmButtonLoading,
  53991. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  53992. round: _ctx.roundButton,
  53993. disabled: _ctx.confirmButtonDisabled,
  53994. size: _ctx.btnSize,
  53995. onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
  53996. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
  53997. }, {
  53998. default: vue.withCtx(() => [
  53999. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  54000. ]),
  54001. _: 1
  54002. }, 8, ["loading", "class", "round", "disabled", "size"]), [
  54003. [vue.vShow, _ctx.showConfirmButton]
  54004. ])
  54005. ], 2)
  54006. ], 6)
  54007. ]),
  54008. _: 3
  54009. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  54010. ], 42, _hoisted_1$1)
  54011. ]),
  54012. _: 3
  54013. }, 8, ["z-index", "overlay-class", "mask"]), [
  54014. [vue.vShow, _ctx.visible]
  54015. ])
  54016. ]),
  54017. _: 3
  54018. });
  54019. }
  54020. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  54021. const messageInstance = /* @__PURE__ */ new Map();
  54022. const getAppendToElement = (props) => {
  54023. let appendTo = document.body;
  54024. if (props.appendTo) {
  54025. if (isString$1(props.appendTo)) {
  54026. appendTo = document.querySelector(props.appendTo);
  54027. }
  54028. if (isElement$1(props.appendTo)) {
  54029. appendTo = props.appendTo;
  54030. }
  54031. if (!isElement$1(appendTo)) {
  54032. appendTo = document.body;
  54033. }
  54034. }
  54035. return appendTo;
  54036. };
  54037. const initInstance = (props, container, appContext = null) => {
  54038. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  54039. default: isFunction$1(props.message) ? props.message : () => props.message
  54040. } : null);
  54041. vnode.appContext = appContext;
  54042. vue.render(vnode, container);
  54043. getAppendToElement(props).appendChild(container.firstElementChild);
  54044. return vnode.component;
  54045. };
  54046. const genContainer = () => {
  54047. return document.createElement("div");
  54048. };
  54049. const showMessage = (options, appContext) => {
  54050. const container = genContainer();
  54051. options.onVanish = () => {
  54052. vue.render(null, container);
  54053. messageInstance.delete(vm);
  54054. };
  54055. options.onAction = (action) => {
  54056. const currentMsg = messageInstance.get(vm);
  54057. let resolve;
  54058. if (options.showInput) {
  54059. resolve = { value: vm.inputValue, action };
  54060. } else {
  54061. resolve = action;
  54062. }
  54063. if (options.callback) {
  54064. options.callback(resolve, instance.proxy);
  54065. } else {
  54066. if (action === "cancel" || action === "close") {
  54067. if (options.distinguishCancelAndClose && action !== "cancel") {
  54068. currentMsg.reject("close");
  54069. } else {
  54070. currentMsg.reject("cancel");
  54071. }
  54072. } else {
  54073. currentMsg.resolve(resolve);
  54074. }
  54075. }
  54076. };
  54077. const instance = initInstance(options, container, appContext);
  54078. const vm = instance.proxy;
  54079. for (const prop in options) {
  54080. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  54081. vm[prop] = options[prop];
  54082. }
  54083. }
  54084. vm.visible = true;
  54085. return vm;
  54086. };
  54087. function MessageBox(options, appContext = null) {
  54088. if (!isClient)
  54089. return Promise.reject();
  54090. let callback;
  54091. if (isString$1(options) || vue.isVNode(options)) {
  54092. options = {
  54093. message: options
  54094. };
  54095. } else {
  54096. callback = options.callback;
  54097. }
  54098. return new Promise((resolve, reject) => {
  54099. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  54100. messageInstance.set(vm, {
  54101. options,
  54102. callback,
  54103. resolve,
  54104. reject
  54105. });
  54106. });
  54107. }
  54108. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  54109. const MESSAGE_BOX_DEFAULT_OPTS = {
  54110. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  54111. confirm: { showCancelButton: true },
  54112. prompt: { showCancelButton: true, showInput: true }
  54113. };
  54114. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  54115. MessageBox[boxType] = messageBoxFactory(boxType);
  54116. });
  54117. function messageBoxFactory(boxType) {
  54118. return (message, title, options, appContext) => {
  54119. let titleOrOpts = "";
  54120. if (isObject$1(title)) {
  54121. options = title;
  54122. titleOrOpts = "";
  54123. } else if (isUndefined(title)) {
  54124. titleOrOpts = "";
  54125. } else {
  54126. titleOrOpts = title;
  54127. }
  54128. return MessageBox(Object.assign({
  54129. title: titleOrOpts,
  54130. message,
  54131. type: "",
  54132. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  54133. }, options, {
  54134. boxType
  54135. }), appContext);
  54136. };
  54137. }
  54138. MessageBox.close = () => {
  54139. messageInstance.forEach((_, vm) => {
  54140. vm.doClose();
  54141. });
  54142. messageInstance.clear();
  54143. };
  54144. MessageBox._context = null;
  54145. const _MessageBox = MessageBox;
  54146. _MessageBox.install = (app) => {
  54147. _MessageBox._context = app._context;
  54148. app.config.globalProperties.$msgbox = _MessageBox;
  54149. app.config.globalProperties.$messageBox = _MessageBox;
  54150. app.config.globalProperties.$alert = _MessageBox.alert;
  54151. app.config.globalProperties.$confirm = _MessageBox.confirm;
  54152. app.config.globalProperties.$prompt = _MessageBox.prompt;
  54153. };
  54154. const ElMessageBox = _MessageBox;
  54155. const notificationTypes = [
  54156. "success",
  54157. "info",
  54158. "warning",
  54159. "error"
  54160. ];
  54161. const notificationProps = buildProps({
  54162. customClass: {
  54163. type: String,
  54164. default: ""
  54165. },
  54166. dangerouslyUseHTMLString: {
  54167. type: Boolean,
  54168. default: false
  54169. },
  54170. duration: {
  54171. type: Number,
  54172. default: 4500
  54173. },
  54174. icon: {
  54175. type: iconPropType
  54176. },
  54177. id: {
  54178. type: String,
  54179. default: ""
  54180. },
  54181. message: {
  54182. type: definePropType([String, Object]),
  54183. default: ""
  54184. },
  54185. offset: {
  54186. type: Number,
  54187. default: 0
  54188. },
  54189. onClick: {
  54190. type: definePropType(Function),
  54191. default: () => void 0
  54192. },
  54193. onClose: {
  54194. type: definePropType(Function),
  54195. required: true
  54196. },
  54197. position: {
  54198. type: String,
  54199. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  54200. default: "top-right"
  54201. },
  54202. showClose: {
  54203. type: Boolean,
  54204. default: true
  54205. },
  54206. title: {
  54207. type: String,
  54208. default: ""
  54209. },
  54210. type: {
  54211. type: String,
  54212. values: [...notificationTypes, ""],
  54213. default: ""
  54214. },
  54215. zIndex: {
  54216. type: Number,
  54217. default: 0
  54218. }
  54219. });
  54220. const notificationEmits = {
  54221. destroy: () => true
  54222. };
  54223. const _hoisted_1 = ["id"];
  54224. const _hoisted_2 = ["textContent"];
  54225. const _hoisted_3 = { key: 0 };
  54226. const _hoisted_4 = ["innerHTML"];
  54227. const __default__ = vue.defineComponent({
  54228. name: "ElNotification"
  54229. });
  54230. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  54231. ...__default__,
  54232. props: notificationProps,
  54233. emits: notificationEmits,
  54234. setup(__props, { expose }) {
  54235. const props = __props;
  54236. const { ns, zIndex } = useGlobalComponentSettings("notification");
  54237. const { nextZIndex, currentZIndex } = zIndex;
  54238. const { Close } = CloseComponents;
  54239. const visible = vue.ref(false);
  54240. let timer = void 0;
  54241. const typeClass = vue.computed(() => {
  54242. const type = props.type;
  54243. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  54244. });
  54245. const iconComponent = vue.computed(() => {
  54246. if (!props.type)
  54247. return props.icon;
  54248. return TypeComponentsMap[props.type] || props.icon;
  54249. });
  54250. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  54251. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  54252. const positionStyle = vue.computed(() => {
  54253. return {
  54254. [verticalProperty.value]: `${props.offset}px`,
  54255. zIndex: currentZIndex.value
  54256. };
  54257. });
  54258. function startTimer() {
  54259. if (props.duration > 0) {
  54260. ({ stop: timer } = useTimeoutFn(() => {
  54261. if (visible.value)
  54262. close();
  54263. }, props.duration));
  54264. }
  54265. }
  54266. function clearTimer() {
  54267. timer == null ? void 0 : timer();
  54268. }
  54269. function close() {
  54270. visible.value = false;
  54271. }
  54272. function onKeydown({ code }) {
  54273. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  54274. clearTimer();
  54275. } else if (code === EVENT_CODE.esc) {
  54276. if (visible.value) {
  54277. close();
  54278. }
  54279. } else {
  54280. startTimer();
  54281. }
  54282. }
  54283. vue.onMounted(() => {
  54284. startTimer();
  54285. nextZIndex();
  54286. visible.value = true;
  54287. });
  54288. useEventListener(document, "keydown", onKeydown);
  54289. expose({
  54290. visible,
  54291. close
  54292. });
  54293. return (_ctx, _cache) => {
  54294. return vue.openBlock(), vue.createBlock(vue.Transition, {
  54295. name: vue.unref(ns).b("fade"),
  54296. onBeforeLeave: _ctx.onClose,
  54297. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  54298. persisted: ""
  54299. }, {
  54300. default: vue.withCtx(() => [
  54301. vue.withDirectives(vue.createElementVNode("div", {
  54302. id: _ctx.id,
  54303. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  54304. style: vue.normalizeStyle(vue.unref(positionStyle)),
  54305. role: "alert",
  54306. onMouseenter: clearTimer,
  54307. onMouseleave: startTimer,
  54308. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
  54309. }, [
  54310. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54311. key: 0,
  54312. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  54313. }, {
  54314. default: vue.withCtx(() => [
  54315. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  54316. ]),
  54317. _: 1
  54318. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  54319. vue.createElementVNode("div", {
  54320. class: vue.normalizeClass(vue.unref(ns).e("group"))
  54321. }, [
  54322. vue.createElementVNode("h2", {
  54323. class: vue.normalizeClass(vue.unref(ns).e("title")),
  54324. textContent: vue.toDisplayString(_ctx.title)
  54325. }, null, 10, _hoisted_2),
  54326. vue.withDirectives(vue.createElementVNode("div", {
  54327. class: vue.normalizeClass(vue.unref(ns).e("content")),
  54328. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  54329. }, [
  54330. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  54331. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  54332. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  54333. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, _hoisted_4)
  54334. ], 2112))
  54335. ])
  54336. ], 6), [
  54337. [vue.vShow, _ctx.message]
  54338. ]),
  54339. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54340. key: 0,
  54341. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  54342. onClick: vue.withModifiers(close, ["stop"])
  54343. }, {
  54344. default: vue.withCtx(() => [
  54345. vue.createVNode(vue.unref(Close))
  54346. ]),
  54347. _: 1
  54348. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  54349. ], 2)
  54350. ], 46, _hoisted_1), [
  54351. [vue.vShow, visible.value]
  54352. ])
  54353. ]),
  54354. _: 3
  54355. }, 8, ["name", "onBeforeLeave"]);
  54356. };
  54357. }
  54358. });
  54359. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  54360. const notifications = {
  54361. "top-left": [],
  54362. "top-right": [],
  54363. "bottom-left": [],
  54364. "bottom-right": []
  54365. };
  54366. const GAP_SIZE = 16;
  54367. let seed = 1;
  54368. const notify = function(options = {}, context = null) {
  54369. if (!isClient)
  54370. return { close: () => void 0 };
  54371. if (typeof options === "string" || vue.isVNode(options)) {
  54372. options = { message: options };
  54373. }
  54374. const position = options.position || "top-right";
  54375. let verticalOffset = options.offset || 0;
  54376. notifications[position].forEach(({ vm: vm2 }) => {
  54377. var _a;
  54378. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  54379. });
  54380. verticalOffset += GAP_SIZE;
  54381. const id = `notification_${seed++}`;
  54382. const userOnClose = options.onClose;
  54383. const props = {
  54384. ...options,
  54385. offset: verticalOffset,
  54386. id,
  54387. onClose: () => {
  54388. close(id, position, userOnClose);
  54389. }
  54390. };
  54391. let appendTo = document.body;
  54392. if (isElement$1(options.appendTo)) {
  54393. appendTo = options.appendTo;
  54394. } else if (isString$1(options.appendTo)) {
  54395. appendTo = document.querySelector(options.appendTo);
  54396. }
  54397. if (!isElement$1(appendTo)) {
  54398. appendTo = document.body;
  54399. }
  54400. const container = document.createElement("div");
  54401. const vm = vue.createVNode(NotificationConstructor, props, vue.isVNode(props.message) ? {
  54402. default: () => props.message
  54403. } : null);
  54404. vm.appContext = context != null ? context : notify._context;
  54405. vm.props.onDestroy = () => {
  54406. vue.render(null, container);
  54407. };
  54408. vue.render(vm, container);
  54409. notifications[position].push({ vm });
  54410. appendTo.appendChild(container.firstElementChild);
  54411. return {
  54412. close: () => {
  54413. vm.component.exposed.visible.value = false;
  54414. }
  54415. };
  54416. };
  54417. notificationTypes.forEach((type) => {
  54418. notify[type] = (options = {}) => {
  54419. if (typeof options === "string" || vue.isVNode(options)) {
  54420. options = {
  54421. message: options
  54422. };
  54423. }
  54424. return notify({
  54425. ...options,
  54426. type
  54427. });
  54428. };
  54429. });
  54430. function close(id, position, userOnClose) {
  54431. const orientedNotifications = notifications[position];
  54432. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  54433. var _a;
  54434. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  54435. });
  54436. if (idx === -1)
  54437. return;
  54438. const { vm } = orientedNotifications[idx];
  54439. if (!vm)
  54440. return;
  54441. userOnClose == null ? void 0 : userOnClose(vm);
  54442. const removedHeight = vm.el.offsetHeight;
  54443. const verticalPos = position.split("-")[0];
  54444. orientedNotifications.splice(idx, 1);
  54445. const len = orientedNotifications.length;
  54446. if (len < 1)
  54447. return;
  54448. for (let i = idx; i < len; i++) {
  54449. const { el, component } = orientedNotifications[i].vm;
  54450. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  54451. component.props.offset = pos;
  54452. }
  54453. }
  54454. function closeAll() {
  54455. for (const orientedNotifications of Object.values(notifications)) {
  54456. orientedNotifications.forEach(({ vm }) => {
  54457. vm.component.exposed.visible.value = false;
  54458. });
  54459. }
  54460. }
  54461. notify.closeAll = closeAll;
  54462. notify._context = null;
  54463. var Notify = notify;
  54464. const ElNotification = withInstallFunction(Notify, "$notify");
  54465. var Plugins = [
  54466. ElInfiniteScroll,
  54467. ElLoading,
  54468. ElMessage,
  54469. ElMessageBox,
  54470. ElNotification,
  54471. ElPopoverDirective
  54472. ];
  54473. var installer = makeInstaller([...Components, ...Plugins]);
  54474. const install = installer.install;
  54475. const version = installer.version;
  54476. exports.BAR_MAP = BAR_MAP;
  54477. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  54478. exports.CHANGE_EVENT = CHANGE_EVENT;
  54479. exports.ClickOutside = ClickOutside;
  54480. exports.CommonPicker = CommonPicker;
  54481. exports.CommonProps = CommonProps;
  54482. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  54483. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  54484. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  54485. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  54486. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  54487. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  54488. exports.DefaultProps = DefaultProps;
  54489. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  54490. exports.DynamicSizeList = DynamicSizeList$1;
  54491. exports.EVENT_CODE = EVENT_CODE;
  54492. exports.Effect = Effect;
  54493. exports.ElAffix = ElAffix;
  54494. exports.ElAlert = ElAlert;
  54495. exports.ElAside = ElAside;
  54496. exports.ElAutoResizer = ElAutoResizer;
  54497. exports.ElAutocomplete = ElAutocomplete;
  54498. exports.ElAvatar = ElAvatar;
  54499. exports.ElBacktop = ElBacktop;
  54500. exports.ElBadge = ElBadge;
  54501. exports.ElBreadcrumb = ElBreadcrumb;
  54502. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  54503. exports.ElButton = ElButton;
  54504. exports.ElButtonGroup = ElButtonGroup$1;
  54505. exports.ElCalendar = ElCalendar;
  54506. exports.ElCard = ElCard;
  54507. exports.ElCarousel = ElCarousel;
  54508. exports.ElCarouselItem = ElCarouselItem;
  54509. exports.ElCascader = ElCascader;
  54510. exports.ElCascaderPanel = ElCascaderPanel;
  54511. exports.ElCheckTag = ElCheckTag;
  54512. exports.ElCheckbox = ElCheckbox;
  54513. exports.ElCheckboxButton = ElCheckboxButton;
  54514. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  54515. exports.ElCol = ElCol;
  54516. exports.ElCollapse = ElCollapse;
  54517. exports.ElCollapseItem = ElCollapseItem;
  54518. exports.ElCollapseTransition = ElCollapseTransition;
  54519. exports.ElCollection = ElCollection;
  54520. exports.ElCollectionItem = ElCollectionItem;
  54521. exports.ElColorPicker = ElColorPicker;
  54522. exports.ElConfigProvider = ElConfigProvider;
  54523. exports.ElContainer = ElContainer;
  54524. exports.ElCountdown = ElCountdown;
  54525. exports.ElDatePicker = ElDatePicker;
  54526. exports.ElDescriptions = ElDescriptions;
  54527. exports.ElDescriptionsItem = ElDescriptionsItem;
  54528. exports.ElDialog = ElDialog;
  54529. exports.ElDivider = ElDivider;
  54530. exports.ElDrawer = ElDrawer;
  54531. exports.ElDropdown = ElDropdown;
  54532. exports.ElDropdownItem = ElDropdownItem;
  54533. exports.ElDropdownMenu = ElDropdownMenu;
  54534. exports.ElEmpty = ElEmpty;
  54535. exports.ElFooter = ElFooter;
  54536. exports.ElForm = ElForm;
  54537. exports.ElFormItem = ElFormItem;
  54538. exports.ElHeader = ElHeader;
  54539. exports.ElIcon = ElIcon;
  54540. exports.ElImage = ElImage;
  54541. exports.ElImageViewer = ElImageViewer;
  54542. exports.ElInfiniteScroll = ElInfiniteScroll;
  54543. exports.ElInput = ElInput;
  54544. exports.ElInputNumber = ElInputNumber;
  54545. exports.ElLink = ElLink;
  54546. exports.ElLoading = ElLoading;
  54547. exports.ElLoadingDirective = vLoading;
  54548. exports.ElLoadingService = Loading;
  54549. exports.ElMain = ElMain;
  54550. exports.ElMenu = ElMenu;
  54551. exports.ElMenuItem = ElMenuItem;
  54552. exports.ElMenuItemGroup = ElMenuItemGroup;
  54553. exports.ElMessage = ElMessage;
  54554. exports.ElMessageBox = ElMessageBox;
  54555. exports.ElNotification = ElNotification;
  54556. exports.ElOption = ElOption;
  54557. exports.ElOptionGroup = ElOptionGroup;
  54558. exports.ElOverlay = ElOverlay;
  54559. exports.ElPageHeader = ElPageHeader;
  54560. exports.ElPagination = ElPagination;
  54561. exports.ElPopconfirm = ElPopconfirm;
  54562. exports.ElPopover = ElPopover;
  54563. exports.ElPopoverDirective = ElPopoverDirective;
  54564. exports.ElPopper = ElPopper;
  54565. exports.ElPopperArrow = ElPopperArrow;
  54566. exports.ElPopperContent = ElPopperContent;
  54567. exports.ElPopperTrigger = ElPopperTrigger;
  54568. exports.ElProgress = ElProgress;
  54569. exports.ElRadio = ElRadio;
  54570. exports.ElRadioButton = ElRadioButton;
  54571. exports.ElRadioGroup = ElRadioGroup;
  54572. exports.ElRate = ElRate;
  54573. exports.ElResult = ElResult;
  54574. exports.ElRow = ElRow;
  54575. exports.ElScrollbar = ElScrollbar;
  54576. exports.ElSelect = ElSelect;
  54577. exports.ElSelectV2 = ElSelectV2;
  54578. exports.ElSkeleton = ElSkeleton;
  54579. exports.ElSkeletonItem = ElSkeletonItem;
  54580. exports.ElSlider = ElSlider;
  54581. exports.ElSpace = ElSpace;
  54582. exports.ElStatistic = ElStatistic;
  54583. exports.ElStep = ElStep;
  54584. exports.ElSteps = ElSteps;
  54585. exports.ElSubMenu = ElSubMenu;
  54586. exports.ElSwitch = ElSwitch;
  54587. exports.ElTabPane = ElTabPane;
  54588. exports.ElTable = ElTable;
  54589. exports.ElTableColumn = ElTableColumn;
  54590. exports.ElTableV2 = ElTableV2;
  54591. exports.ElTabs = ElTabs;
  54592. exports.ElTag = ElTag;
  54593. exports.ElText = ElText;
  54594. exports.ElTimePicker = ElTimePicker;
  54595. exports.ElTimeSelect = ElTimeSelect;
  54596. exports.ElTimeline = ElTimeline;
  54597. exports.ElTimelineItem = ElTimelineItem;
  54598. exports.ElTooltip = ElTooltip;
  54599. exports.ElTransfer = ElTransfer;
  54600. exports.ElTree = ElTree;
  54601. exports.ElTreeSelect = ElTreeSelect;
  54602. exports.ElTreeV2 = ElTreeV2;
  54603. exports.ElUpload = ElUpload;
  54604. exports.FIRST_KEYS = FIRST_KEYS;
  54605. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  54606. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  54607. exports.FixedSizeGrid = FixedSizeGrid$1;
  54608. exports.FixedSizeList = FixedSizeList$1;
  54609. exports.GAP = GAP;
  54610. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  54611. exports.INPUT_EVENT = INPUT_EVENT;
  54612. exports.INSTALLED_KEY = INSTALLED_KEY;
  54613. exports.IconComponentMap = IconComponentMap;
  54614. exports.IconMap = IconMap;
  54615. exports.LAST_KEYS = LAST_KEYS;
  54616. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  54617. exports.Mousewheel = Mousewheel;
  54618. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  54619. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  54620. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  54621. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  54622. exports.RowAlign = RowAlign;
  54623. exports.RowJustify = RowJustify;
  54624. exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY;
  54625. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  54626. exports.TableV2 = TableV2$1;
  54627. exports.TableV2Alignment = Alignment;
  54628. exports.TableV2FixedDir = FixedDir;
  54629. exports.TableV2Placeholder = placeholderSign;
  54630. exports.TableV2SortOrder = SortOrder;
  54631. exports.TimePickPanel = TimePickPanel;
  54632. exports.TrapFocus = TrapFocus;
  54633. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  54634. exports.WEEK_DAYS = WEEK_DAYS;
  54635. exports.affixEmits = affixEmits;
  54636. exports.affixProps = affixProps;
  54637. exports.alertEffects = alertEffects;
  54638. exports.alertEmits = alertEmits;
  54639. exports.alertProps = alertProps;
  54640. exports.arrowMiddleware = arrowMiddleware;
  54641. exports.autoResizerProps = autoResizerProps;
  54642. exports.autocompleteEmits = autocompleteEmits;
  54643. exports.autocompleteProps = autocompleteProps;
  54644. exports.avatarEmits = avatarEmits;
  54645. exports.avatarProps = avatarProps;
  54646. exports.backtopEmits = backtopEmits;
  54647. exports.backtopProps = backtopProps;
  54648. exports.badgeProps = badgeProps;
  54649. exports.breadcrumbItemProps = breadcrumbItemProps;
  54650. exports.breadcrumbKey = breadcrumbKey;
  54651. exports.breadcrumbProps = breadcrumbProps;
  54652. exports.buildLocaleContext = buildLocaleContext;
  54653. exports.buildTimeList = buildTimeList;
  54654. exports.buildTranslator = buildTranslator;
  54655. exports.buttonEmits = buttonEmits;
  54656. exports.buttonGroupContextKey = buttonGroupContextKey;
  54657. exports.buttonNativeTypes = buttonNativeTypes;
  54658. exports.buttonProps = buttonProps;
  54659. exports.buttonTypes = buttonTypes;
  54660. exports.calendarEmits = calendarEmits;
  54661. exports.calendarProps = calendarProps;
  54662. exports.cardProps = cardProps;
  54663. exports.carouselContextKey = carouselContextKey;
  54664. exports.carouselEmits = carouselEmits;
  54665. exports.carouselItemProps = carouselItemProps;
  54666. exports.carouselProps = carouselProps;
  54667. exports.cascaderEmits = cascaderEmits;
  54668. exports.cascaderProps = cascaderProps;
  54669. exports.checkTagEmits = checkTagEmits;
  54670. exports.checkTagProps = checkTagProps;
  54671. exports.checkboxEmits = checkboxEmits;
  54672. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  54673. exports.checkboxGroupEmits = checkboxGroupEmits;
  54674. exports.checkboxGroupProps = checkboxGroupProps;
  54675. exports.checkboxProps = checkboxProps;
  54676. exports.colProps = colProps;
  54677. exports.collapseContextKey = collapseContextKey;
  54678. exports.collapseEmits = collapseEmits;
  54679. exports.collapseItemProps = collapseItemProps;
  54680. exports.collapseProps = collapseProps;
  54681. exports.colorPickerContextKey = colorPickerContextKey;
  54682. exports.colorPickerEmits = colorPickerEmits;
  54683. exports.colorPickerProps = colorPickerProps;
  54684. exports.componentSizeMap = componentSizeMap;
  54685. exports.componentSizes = componentSizes;
  54686. exports.configProviderContextKey = configProviderContextKey;
  54687. exports.configProviderProps = configProviderProps;
  54688. exports.countdownEmits = countdownEmits;
  54689. exports.countdownProps = countdownProps;
  54690. exports.createModelToggleComposable = createModelToggleComposable;
  54691. exports.dateEquals = dateEquals;
  54692. exports.datePickTypes = datePickTypes;
  54693. exports.dayjs = dayjs;
  54694. exports["default"] = installer;
  54695. exports.defaultInitialZIndex = defaultInitialZIndex;
  54696. exports.defaultNamespace = defaultNamespace;
  54697. exports.descriptionProps = descriptionProps;
  54698. exports.dialogEmits = dialogEmits;
  54699. exports.dialogInjectionKey = dialogInjectionKey;
  54700. exports.dialogProps = dialogProps;
  54701. exports.dividerProps = dividerProps;
  54702. exports.drawerEmits = drawerEmits;
  54703. exports.drawerProps = drawerProps;
  54704. exports.dropdownItemProps = dropdownItemProps;
  54705. exports.dropdownMenuProps = dropdownMenuProps;
  54706. exports.dropdownProps = dropdownProps;
  54707. exports.elPaginationKey = elPaginationKey;
  54708. exports.emitChangeFn = emitChangeFn;
  54709. exports.emptyProps = emptyProps;
  54710. exports.extractDateFormat = extractDateFormat;
  54711. exports.extractTimeFormat = extractTimeFormat;
  54712. exports.formContextKey = formContextKey;
  54713. exports.formEmits = formEmits;
  54714. exports.formItemContextKey = formItemContextKey;
  54715. exports.formItemProps = formItemProps;
  54716. exports.formItemValidateStates = formItemValidateStates;
  54717. exports.formProps = formProps;
  54718. exports.formatter = formatter;
  54719. exports.genFileId = genFileId;
  54720. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  54721. exports.iconProps = iconProps;
  54722. exports.imageEmits = imageEmits;
  54723. exports.imageProps = imageProps;
  54724. exports.imageViewerEmits = imageViewerEmits;
  54725. exports.imageViewerProps = imageViewerProps;
  54726. exports.inputEmits = inputEmits;
  54727. exports.inputNumberEmits = inputNumberEmits;
  54728. exports.inputNumberProps = inputNumberProps;
  54729. exports.inputProps = inputProps;
  54730. exports.install = install;
  54731. exports.linkEmits = linkEmits;
  54732. exports.linkProps = linkProps;
  54733. exports.localeContextKey = localeContextKey;
  54734. exports.makeInstaller = makeInstaller;
  54735. exports.makeList = makeList;
  54736. exports.menuEmits = menuEmits;
  54737. exports.menuItemEmits = menuItemEmits;
  54738. exports.menuItemGroupProps = menuItemGroupProps;
  54739. exports.menuItemProps = menuItemProps;
  54740. exports.menuProps = menuProps;
  54741. exports.messageConfig = messageConfig;
  54742. exports.messageDefaults = messageDefaults;
  54743. exports.messageEmits = messageEmits;
  54744. exports.messageProps = messageProps;
  54745. exports.messageTypes = messageTypes;
  54746. exports.namespaceContextKey = namespaceContextKey;
  54747. exports.notificationEmits = notificationEmits;
  54748. exports.notificationProps = notificationProps;
  54749. exports.notificationTypes = notificationTypes;
  54750. exports.overlayEmits = overlayEmits;
  54751. exports.overlayProps = overlayProps;
  54752. exports.pageHeaderEmits = pageHeaderEmits;
  54753. exports.pageHeaderProps = pageHeaderProps;
  54754. exports.paginationEmits = paginationEmits;
  54755. exports.paginationProps = paginationProps;
  54756. exports.parseDate = parseDate;
  54757. exports.popconfirmEmits = popconfirmEmits;
  54758. exports.popconfirmProps = popconfirmProps;
  54759. exports.popoverEmits = popoverEmits;
  54760. exports.popoverProps = popoverProps;
  54761. exports.popperArrowProps = popperArrowProps;
  54762. exports.popperContentEmits = popperContentEmits;
  54763. exports.popperContentProps = popperContentProps;
  54764. exports.popperCoreConfigProps = popperCoreConfigProps;
  54765. exports.popperProps = popperProps;
  54766. exports.popperTriggerProps = popperTriggerProps;
  54767. exports.progressProps = progressProps;
  54768. exports.provideGlobalConfig = provideGlobalConfig;
  54769. exports.radioButtonProps = radioButtonProps;
  54770. exports.radioEmits = radioEmits;
  54771. exports.radioGroupEmits = radioGroupEmits;
  54772. exports.radioGroupKey = radioGroupKey;
  54773. exports.radioGroupProps = radioGroupProps;
  54774. exports.radioProps = radioProps;
  54775. exports.radioPropsBase = radioPropsBase;
  54776. exports.rangeArr = rangeArr;
  54777. exports.rateEmits = rateEmits;
  54778. exports.rateProps = rateProps;
  54779. exports.renderThumbStyle = renderThumbStyle$1;
  54780. exports.resultProps = resultProps;
  54781. exports.roleTypes = roleTypes;
  54782. exports.rowContextKey = rowContextKey;
  54783. exports.rowProps = rowProps;
  54784. exports.scrollbarContextKey = scrollbarContextKey;
  54785. exports.scrollbarEmits = scrollbarEmits;
  54786. exports.scrollbarProps = scrollbarProps;
  54787. exports.selectGroupKey = selectGroupKey;
  54788. exports.selectKey = selectKey;
  54789. exports.selectV2InjectionKey = selectV2InjectionKey;
  54790. exports.skeletonItemProps = skeletonItemProps;
  54791. exports.skeletonProps = skeletonProps;
  54792. exports.sliderContextKey = sliderContextKey;
  54793. exports.sliderEmits = sliderEmits;
  54794. exports.sliderProps = sliderProps;
  54795. exports.spaceProps = spaceProps;
  54796. exports.statisticProps = statisticProps;
  54797. exports.stepProps = stepProps;
  54798. exports.stepsEmits = stepsEmits;
  54799. exports.stepsProps = stepsProps;
  54800. exports.subMenuProps = subMenuProps;
  54801. exports.switchEmits = switchEmits;
  54802. exports.switchProps = switchProps;
  54803. exports.tabBarProps = tabBarProps;
  54804. exports.tabNavEmits = tabNavEmits;
  54805. exports.tabNavProps = tabNavProps;
  54806. exports.tabPaneProps = tabPaneProps;
  54807. exports.tableV2Props = tableV2Props;
  54808. exports.tableV2RowProps = tableV2RowProps;
  54809. exports.tabsEmits = tabsEmits;
  54810. exports.tabsProps = tabsProps;
  54811. exports.tabsRootContextKey = tabsRootContextKey;
  54812. exports.tagEmits = tagEmits;
  54813. exports.tagProps = tagProps;
  54814. exports.textProps = textProps;
  54815. exports.thumbProps = thumbProps;
  54816. exports.timePickerDefaultProps = timePickerDefaultProps;
  54817. exports.timeUnits = timeUnits$1;
  54818. exports.timelineItemProps = timelineItemProps;
  54819. exports.tooltipEmits = tooltipEmits;
  54820. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  54821. exports.transferEmits = transferEmits;
  54822. exports.transferProps = transferProps;
  54823. exports.translate = translate;
  54824. exports.uploadBaseProps = uploadBaseProps;
  54825. exports.uploadContentProps = uploadContentProps;
  54826. exports.uploadContextKey = uploadContextKey;
  54827. exports.uploadDraggerEmits = uploadDraggerEmits;
  54828. exports.uploadDraggerProps = uploadDraggerProps;
  54829. exports.uploadListEmits = uploadListEmits;
  54830. exports.uploadListProps = uploadListProps;
  54831. exports.uploadListTypes = uploadListTypes;
  54832. exports.uploadProps = uploadProps;
  54833. exports.useAttrs = useAttrs;
  54834. exports.useCascaderConfig = useCascaderConfig;
  54835. exports.useCursor = useCursor;
  54836. exports.useDelayedRender = useDelayedRender;
  54837. exports.useDelayedToggle = useDelayedToggle;
  54838. exports.useDelayedToggleProps = useDelayedToggleProps;
  54839. exports.useDeprecated = useDeprecated;
  54840. exports.useDialog = useDialog;
  54841. exports.useDisabled = useDisabled;
  54842. exports.useDraggable = useDraggable;
  54843. exports.useEscapeKeydown = useEscapeKeydown;
  54844. exports.useFloating = useFloating;
  54845. exports.useFloatingProps = useFloatingProps;
  54846. exports.useFocus = useFocus;
  54847. exports.useFormDisabled = useFormDisabled;
  54848. exports.useFormItem = useFormItem;
  54849. exports.useFormItemInputId = useFormItemInputId;
  54850. exports.useFormSize = useFormSize;
  54851. exports.useForwardRef = useForwardRef;
  54852. exports.useForwardRefDirective = useForwardRefDirective;
  54853. exports.useGetDerivedNamespace = useGetDerivedNamespace;
  54854. exports.useGlobalComponentSettings = useGlobalComponentSettings;
  54855. exports.useGlobalConfig = useGlobalConfig;
  54856. exports.useGlobalSize = useGlobalSize;
  54857. exports.useId = useId;
  54858. exports.useIdInjection = useIdInjection;
  54859. exports.useLocale = useLocale;
  54860. exports.useLockscreen = useLockscreen;
  54861. exports.useModal = useModal;
  54862. exports.useModelToggle = useModelToggle;
  54863. exports.useModelToggleEmits = useModelToggleEmits;
  54864. exports.useModelToggleProps = useModelToggleProps;
  54865. exports.useNamespace = useNamespace;
  54866. exports.useOrderedChildren = useOrderedChildren;
  54867. exports.usePopper = usePopper;
  54868. exports.usePopperArrowProps = usePopperArrowProps;
  54869. exports.usePopperContainer = usePopperContainer;
  54870. exports.usePopperContainerId = usePopperContainerId;
  54871. exports.usePopperContentEmits = usePopperContentEmits;
  54872. exports.usePopperContentProps = usePopperContentProps;
  54873. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  54874. exports.usePopperProps = usePopperProps;
  54875. exports.usePopperTriggerProps = usePopperTriggerProps;
  54876. exports.usePreventGlobal = usePreventGlobal;
  54877. exports.useProp = useProp;
  54878. exports.useRestoreActive = useRestoreActive;
  54879. exports.useSameTarget = useSameTarget;
  54880. exports.useSize = useSize;
  54881. exports.useSizeProp = useSizeProp;
  54882. exports.useSizeProps = useSizeProps;
  54883. exports.useSpace = useSpace;
  54884. exports.useTeleport = useTeleport;
  54885. exports.useThrottleRender = useThrottleRender;
  54886. exports.useTimeout = useTimeout;
  54887. exports.useTooltipContentProps = useTooltipContentProps;
  54888. exports.useTooltipModelToggle = useTooltipModelToggle;
  54889. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  54890. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  54891. exports.useTooltipProps = useTooltipProps;
  54892. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  54893. exports.useTransitionFallthrough = useTransitionFallthrough;
  54894. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  54895. exports.useZIndex = useZIndex;
  54896. exports.vLoading = vLoading;
  54897. exports.vRepeatClick = vRepeatClick;
  54898. exports.valueEquals = valueEquals;
  54899. exports.version = version;
  54900. exports.virtualizedGridProps = virtualizedGridProps;
  54901. exports.virtualizedListProps = virtualizedListProps;
  54902. exports.virtualizedProps = virtualizedProps;
  54903. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  54904. exports.zIndexContextKey = zIndexContextKey;
  54905. Object.defineProperty(exports, '__esModule', { value: true });
  54906. }));