element_plus_2.8.2.js 2.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170
  1. /*! Element Plus v2.8.2 */
  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 isString$2 = (val) => typeof val === "string";
  113. const noop$1 = () => {
  114. };
  115. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  116. function resolveUnref(r) {
  117. return typeof r === "function" ? r() : vue.unref(r);
  118. }
  119. function createFilterWrapper(filter, fn) {
  120. function wrapper(...args) {
  121. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  122. }
  123. return wrapper;
  124. }
  125. function debounceFilter(ms, options = {}) {
  126. let timer;
  127. let maxTimer;
  128. const filter = (invoke) => {
  129. const duration = resolveUnref(ms);
  130. const maxDuration = resolveUnref(options.maxWait);
  131. if (timer)
  132. clearTimeout(timer);
  133. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  134. if (maxTimer) {
  135. clearTimeout(maxTimer);
  136. maxTimer = null;
  137. }
  138. return invoke();
  139. }
  140. if (maxDuration && !maxTimer) {
  141. maxTimer = setTimeout(() => {
  142. if (timer)
  143. clearTimeout(timer);
  144. maxTimer = null;
  145. invoke();
  146. }, maxDuration);
  147. }
  148. timer = setTimeout(() => {
  149. if (maxTimer)
  150. clearTimeout(maxTimer);
  151. maxTimer = null;
  152. invoke();
  153. }, duration);
  154. };
  155. return filter;
  156. }
  157. function throttleFilter(ms, trailing = true, leading = true) {
  158. let lastExec = 0;
  159. let timer;
  160. let isLeading = true;
  161. const clear = () => {
  162. if (timer) {
  163. clearTimeout(timer);
  164. timer = void 0;
  165. }
  166. };
  167. const filter = (invoke) => {
  168. const duration = resolveUnref(ms);
  169. const elapsed = Date.now() - lastExec;
  170. clear();
  171. if (duration <= 0) {
  172. lastExec = Date.now();
  173. return invoke();
  174. }
  175. if (elapsed > duration && (leading || !isLeading)) {
  176. lastExec = Date.now();
  177. invoke();
  178. } else if (trailing) {
  179. timer = setTimeout(() => {
  180. lastExec = Date.now();
  181. isLeading = true;
  182. clear();
  183. invoke();
  184. }, duration);
  185. }
  186. if (!leading && !timer)
  187. timer = setTimeout(() => isLeading = true, duration);
  188. isLeading = false;
  189. };
  190. return filter;
  191. }
  192. function identity$1(arg) {
  193. return arg;
  194. }
  195. function tryOnScopeDispose(fn) {
  196. if (vue.getCurrentScope()) {
  197. vue.onScopeDispose(fn);
  198. return true;
  199. }
  200. return false;
  201. }
  202. function useDebounceFn(fn, ms = 200, options = {}) {
  203. return createFilterWrapper(debounceFilter(ms, options), fn);
  204. }
  205. function refDebounced(value, ms = 200, options = {}) {
  206. if (ms <= 0)
  207. return value;
  208. const debounced = vue.ref(value.value);
  209. const updater = useDebounceFn(() => {
  210. debounced.value = value.value;
  211. }, ms, options);
  212. vue.watch(value, () => updater());
  213. return debounced;
  214. }
  215. function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
  216. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  217. }
  218. function tryOnMounted(fn, sync = true) {
  219. if (vue.getCurrentInstance())
  220. vue.onMounted(fn);
  221. else if (sync)
  222. fn();
  223. else
  224. vue.nextTick(fn);
  225. }
  226. function useTimeoutFn(cb, interval, options = {}) {
  227. const {
  228. immediate = true
  229. } = options;
  230. const isPending = vue.ref(false);
  231. let timer = null;
  232. function clear() {
  233. if (timer) {
  234. clearTimeout(timer);
  235. timer = null;
  236. }
  237. }
  238. function stop() {
  239. isPending.value = false;
  240. clear();
  241. }
  242. function start(...args) {
  243. clear();
  244. isPending.value = true;
  245. timer = setTimeout(() => {
  246. isPending.value = false;
  247. timer = null;
  248. cb(...args);
  249. }, resolveUnref(interval));
  250. }
  251. if (immediate) {
  252. isPending.value = true;
  253. if (isClient)
  254. start();
  255. }
  256. tryOnScopeDispose(stop);
  257. return {
  258. isPending,
  259. start,
  260. stop
  261. };
  262. }
  263. function unrefElement(elRef) {
  264. var _a;
  265. const plain = resolveUnref(elRef);
  266. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  267. }
  268. const defaultWindow = isClient ? window : void 0;
  269. const defaultDocument = isClient ? window.document : void 0;
  270. function useEventListener(...args) {
  271. let target;
  272. let event;
  273. let listener;
  274. let options;
  275. if (isString$2(args[0])) {
  276. [event, listener, options] = args;
  277. target = defaultWindow;
  278. } else {
  279. [target, event, listener, options] = args;
  280. }
  281. if (!target)
  282. return noop$1;
  283. let cleanup = noop$1;
  284. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  285. cleanup();
  286. if (!el)
  287. return;
  288. el.addEventListener(event, listener, options);
  289. cleanup = () => {
  290. el.removeEventListener(event, listener, options);
  291. cleanup = noop$1;
  292. };
  293. }, { immediate: true, flush: "post" });
  294. const stop = () => {
  295. stopWatch();
  296. cleanup();
  297. };
  298. tryOnScopeDispose(stop);
  299. return stop;
  300. }
  301. function onClickOutside(target, handler, options = {}) {
  302. const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options;
  303. if (!window)
  304. return;
  305. const shouldListen = vue.ref(true);
  306. let fallback;
  307. const listener = (event) => {
  308. window.clearTimeout(fallback);
  309. const el = unrefElement(target);
  310. const composedPath = event.composedPath();
  311. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  312. return;
  313. if (ignore && ignore.length > 0) {
  314. if (ignore.some((target2) => {
  315. const el2 = unrefElement(target2);
  316. return el2 && (event.target === el2 || composedPath.includes(el2));
  317. }))
  318. return;
  319. }
  320. handler(event);
  321. };
  322. const cleanup = [
  323. useEventListener(window, "click", listener, { passive: true, capture }),
  324. useEventListener(window, "pointerdown", (e) => {
  325. const el = unrefElement(target);
  326. shouldListen.value = !!el && !e.composedPath().includes(el);
  327. }, { passive: true }),
  328. useEventListener(window, "pointerup", (e) => {
  329. if (e.button === 0) {
  330. const path = e.composedPath();
  331. e.composedPath = () => path;
  332. fallback = window.setTimeout(() => listener(e), 50);
  333. }
  334. }, { passive: true }),
  335. detectIframe && useEventListener(window, "blur", (event) => {
  336. var _a;
  337. const el = unrefElement(target);
  338. if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
  339. handler(event);
  340. })
  341. ].filter(Boolean);
  342. const stop = () => cleanup.forEach((fn) => fn());
  343. return stop;
  344. }
  345. function useActiveElement(options = {}) {
  346. const { window = defaultWindow } = options;
  347. const counter = vue.ref(0);
  348. if (window) {
  349. useEventListener(window, "blur", () => counter.value += 1, true);
  350. useEventListener(window, "focus", () => counter.value += 1, true);
  351. }
  352. return vue.computed(() => {
  353. counter.value;
  354. return window == null ? void 0 : window.document.activeElement;
  355. });
  356. }
  357. function useSupported(callback, sync = false) {
  358. const isSupported = vue.ref();
  359. const update = () => isSupported.value = Boolean(callback());
  360. update();
  361. tryOnMounted(update, sync);
  362. return isSupported;
  363. }
  364. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  365. const globalKey = "__vueuse_ssr_handlers__";
  366. _global[globalKey] = _global[globalKey] || {};
  367. _global[globalKey];
  368. function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
  369. const variable = vue.ref(initialValue);
  370. const elRef = vue.computed(() => {
  371. var _a;
  372. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  373. });
  374. vue.watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  375. var _a;
  376. if (el && window) {
  377. const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim();
  378. variable.value = value || initialValue;
  379. }
  380. }, { immediate: true });
  381. vue.watch(variable, (val) => {
  382. var _a;
  383. if ((_a = elRef.value) == null ? void 0 : _a.style)
  384. elRef.value.style.setProperty(resolveUnref(prop), val);
  385. });
  386. return variable;
  387. }
  388. function useDocumentVisibility({ document = defaultDocument } = {}) {
  389. if (!document)
  390. return vue.ref("visible");
  391. const visibility = vue.ref(document.visibilityState);
  392. useEventListener(document, "visibilitychange", () => {
  393. visibility.value = document.visibilityState;
  394. });
  395. return visibility;
  396. }
  397. var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
  398. var __hasOwnProp$f = Object.prototype.hasOwnProperty;
  399. var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
  400. var __objRest$2 = (source, exclude) => {
  401. var target = {};
  402. for (var prop in source)
  403. if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
  404. target[prop] = source[prop];
  405. if (source != null && __getOwnPropSymbols$f)
  406. for (var prop of __getOwnPropSymbols$f(source)) {
  407. if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
  408. target[prop] = source[prop];
  409. }
  410. return target;
  411. };
  412. function useResizeObserver(target, callback, options = {}) {
  413. const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
  414. let observer;
  415. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  416. const cleanup = () => {
  417. if (observer) {
  418. observer.disconnect();
  419. observer = void 0;
  420. }
  421. };
  422. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  423. cleanup();
  424. if (isSupported.value && window && el) {
  425. observer = new ResizeObserver(callback);
  426. observer.observe(el, observerOptions);
  427. }
  428. }, { immediate: true, flush: "post" });
  429. const stop = () => {
  430. cleanup();
  431. stopWatch();
  432. };
  433. tryOnScopeDispose(stop);
  434. return {
  435. isSupported,
  436. stop
  437. };
  438. }
  439. function useElementBounding(target, options = {}) {
  440. const {
  441. reset = true,
  442. windowResize = true,
  443. windowScroll = true,
  444. immediate = true
  445. } = options;
  446. const height = vue.ref(0);
  447. const bottom = vue.ref(0);
  448. const left = vue.ref(0);
  449. const right = vue.ref(0);
  450. const top = vue.ref(0);
  451. const width = vue.ref(0);
  452. const x = vue.ref(0);
  453. const y = vue.ref(0);
  454. function update() {
  455. const el = unrefElement(target);
  456. if (!el) {
  457. if (reset) {
  458. height.value = 0;
  459. bottom.value = 0;
  460. left.value = 0;
  461. right.value = 0;
  462. top.value = 0;
  463. width.value = 0;
  464. x.value = 0;
  465. y.value = 0;
  466. }
  467. return;
  468. }
  469. const rect = el.getBoundingClientRect();
  470. height.value = rect.height;
  471. bottom.value = rect.bottom;
  472. left.value = rect.left;
  473. right.value = rect.right;
  474. top.value = rect.top;
  475. width.value = rect.width;
  476. x.value = rect.x;
  477. y.value = rect.y;
  478. }
  479. useResizeObserver(target, update);
  480. vue.watch(() => unrefElement(target), (ele) => !ele && update());
  481. if (windowScroll)
  482. useEventListener("scroll", update, { passive: true });
  483. if (windowResize)
  484. useEventListener("resize", update, { passive: true });
  485. tryOnMounted(() => {
  486. if (immediate)
  487. update();
  488. });
  489. return {
  490. height,
  491. bottom,
  492. left,
  493. right,
  494. top,
  495. width,
  496. x,
  497. y,
  498. update
  499. };
  500. }
  501. var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
  502. var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
  503. var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
  504. var __objRest$1 = (source, exclude) => {
  505. var target = {};
  506. for (var prop in source)
  507. if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
  508. target[prop] = source[prop];
  509. if (source != null && __getOwnPropSymbols$7)
  510. for (var prop of __getOwnPropSymbols$7(source)) {
  511. if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
  512. target[prop] = source[prop];
  513. }
  514. return target;
  515. };
  516. function useMutationObserver(target, callback, options = {}) {
  517. const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest$1(_a, ["window"]);
  518. let observer;
  519. const isSupported = useSupported(() => window && "MutationObserver" in window);
  520. const cleanup = () => {
  521. if (observer) {
  522. observer.disconnect();
  523. observer = void 0;
  524. }
  525. };
  526. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  527. cleanup();
  528. if (isSupported.value && window && el) {
  529. observer = new MutationObserver(callback);
  530. observer.observe(el, mutationOptions);
  531. }
  532. }, { immediate: true });
  533. const stop = () => {
  534. cleanup();
  535. stopWatch();
  536. };
  537. tryOnScopeDispose(stop);
  538. return {
  539. isSupported,
  540. stop
  541. };
  542. }
  543. var SwipeDirection;
  544. (function(SwipeDirection2) {
  545. SwipeDirection2["UP"] = "UP";
  546. SwipeDirection2["RIGHT"] = "RIGHT";
  547. SwipeDirection2["DOWN"] = "DOWN";
  548. SwipeDirection2["LEFT"] = "LEFT";
  549. SwipeDirection2["NONE"] = "NONE";
  550. })(SwipeDirection || (SwipeDirection = {}));
  551. var __defProp = Object.defineProperty;
  552. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  553. var __hasOwnProp = Object.prototype.hasOwnProperty;
  554. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  555. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  556. var __spreadValues = (a, b) => {
  557. for (var prop in b || (b = {}))
  558. if (__hasOwnProp.call(b, prop))
  559. __defNormalProp(a, prop, b[prop]);
  560. if (__getOwnPropSymbols)
  561. for (var prop of __getOwnPropSymbols(b)) {
  562. if (__propIsEnum.call(b, prop))
  563. __defNormalProp(a, prop, b[prop]);
  564. }
  565. return a;
  566. };
  567. const _TransitionPresets = {
  568. easeInSine: [0.12, 0, 0.39, 0],
  569. easeOutSine: [0.61, 1, 0.88, 1],
  570. easeInOutSine: [0.37, 0, 0.63, 1],
  571. easeInQuad: [0.11, 0, 0.5, 0],
  572. easeOutQuad: [0.5, 1, 0.89, 1],
  573. easeInOutQuad: [0.45, 0, 0.55, 1],
  574. easeInCubic: [0.32, 0, 0.67, 0],
  575. easeOutCubic: [0.33, 1, 0.68, 1],
  576. easeInOutCubic: [0.65, 0, 0.35, 1],
  577. easeInQuart: [0.5, 0, 0.75, 0],
  578. easeOutQuart: [0.25, 1, 0.5, 1],
  579. easeInOutQuart: [0.76, 0, 0.24, 1],
  580. easeInQuint: [0.64, 0, 0.78, 0],
  581. easeOutQuint: [0.22, 1, 0.36, 1],
  582. easeInOutQuint: [0.83, 0, 0.17, 1],
  583. easeInExpo: [0.7, 0, 0.84, 0],
  584. easeOutExpo: [0.16, 1, 0.3, 1],
  585. easeInOutExpo: [0.87, 0, 0.13, 1],
  586. easeInCirc: [0.55, 0, 1, 0.45],
  587. easeOutCirc: [0, 0.55, 0.45, 1],
  588. easeInOutCirc: [0.85, 0, 0.15, 1],
  589. easeInBack: [0.36, 0, 0.66, -0.56],
  590. easeOutBack: [0.34, 1.56, 0.64, 1],
  591. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  592. };
  593. __spreadValues({
  594. linear: identity$1
  595. }, _TransitionPresets);
  596. function useVModel(props, key, emit, options = {}) {
  597. var _a, _b, _c;
  598. const {
  599. passive = false,
  600. eventName,
  601. deep = false,
  602. defaultValue
  603. } = options;
  604. const vm = vue.getCurrentInstance();
  605. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy));
  606. let event = eventName;
  607. if (!key) {
  608. {
  609. key = "modelValue";
  610. }
  611. }
  612. event = eventName || event || `update:${key.toString()}`;
  613. const getValue = () => isDef(props[key]) ? props[key] : defaultValue;
  614. if (passive) {
  615. const proxy = vue.ref(getValue());
  616. vue.watch(() => props[key], (v) => proxy.value = v);
  617. vue.watch(proxy, (v) => {
  618. if (v !== props[key] || deep)
  619. _emit(event, v);
  620. }, {
  621. deep
  622. });
  623. return proxy;
  624. } else {
  625. return vue.computed({
  626. get() {
  627. return getValue();
  628. },
  629. set(value) {
  630. _emit(event, value);
  631. }
  632. });
  633. }
  634. }
  635. function useWindowFocus({ window = defaultWindow } = {}) {
  636. if (!window)
  637. return vue.ref(false);
  638. const focused = vue.ref(window.document.hasFocus());
  639. useEventListener(window, "blur", () => {
  640. focused.value = false;
  641. });
  642. useEventListener(window, "focus", () => {
  643. focused.value = true;
  644. });
  645. return focused;
  646. }
  647. function useWindowSize(options = {}) {
  648. const {
  649. window = defaultWindow,
  650. initialWidth = Infinity,
  651. initialHeight = Infinity,
  652. listenOrientation = true
  653. } = options;
  654. const width = vue.ref(initialWidth);
  655. const height = vue.ref(initialHeight);
  656. const update = () => {
  657. if (window) {
  658. width.value = window.innerWidth;
  659. height.value = window.innerHeight;
  660. }
  661. };
  662. update();
  663. tryOnMounted(update);
  664. useEventListener("resize", update, { passive: true });
  665. if (listenOrientation)
  666. useEventListener("orientationchange", update, { passive: true });
  667. return { width, height };
  668. }
  669. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  670. const isInContainer = (el, container) => {
  671. if (!isClient || !el || !container)
  672. return false;
  673. const elRect = el.getBoundingClientRect();
  674. let containerRect;
  675. if (container instanceof Element) {
  676. containerRect = container.getBoundingClientRect();
  677. } else {
  678. containerRect = {
  679. top: 0,
  680. right: window.innerWidth,
  681. bottom: window.innerHeight,
  682. left: 0
  683. };
  684. }
  685. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  686. };
  687. const getOffsetTop = (el) => {
  688. let offset = 0;
  689. let parent = el;
  690. while (parent) {
  691. offset += parent.offsetTop;
  692. parent = parent.offsetParent;
  693. }
  694. return offset;
  695. };
  696. const getOffsetTopDistance = (el, containerEl) => {
  697. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  698. };
  699. const getClientXY = (event) => {
  700. let clientX;
  701. let clientY;
  702. if (event.type === "touchend") {
  703. clientY = event.changedTouches[0].clientY;
  704. clientX = event.changedTouches[0].clientX;
  705. } else if (event.type.startsWith("touch")) {
  706. clientY = event.touches[0].clientY;
  707. clientX = event.touches[0].clientX;
  708. } else {
  709. clientY = event.clientY;
  710. clientX = event.clientX;
  711. }
  712. return {
  713. clientX,
  714. clientY
  715. };
  716. };
  717. function easeInOutCubic(t, b, c, d) {
  718. const cc = c - b;
  719. t /= d / 2;
  720. if (t < 1) {
  721. return cc / 2 * t * t * t + b;
  722. }
  723. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  724. }
  725. const NOOP = () => {
  726. };
  727. const hasOwnProperty$p = Object.prototype.hasOwnProperty;
  728. const hasOwn = (val, key) => hasOwnProperty$p.call(val, key);
  729. const isArray$1 = Array.isArray;
  730. const isDate$1 = (val) => toTypeString(val) === "[object Date]";
  731. const isFunction$1 = (val) => typeof val === "function";
  732. const isString$1 = (val) => typeof val === "string";
  733. const isObject$1 = (val) => val !== null && typeof val === "object";
  734. const isPromise = (val) => {
  735. return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch);
  736. };
  737. const objectToString$1 = Object.prototype.toString;
  738. const toTypeString = (value) => objectToString$1.call(value);
  739. const toRawType = (value) => {
  740. return toTypeString(value).slice(8, -1);
  741. };
  742. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  743. const cacheStringFunction = (fn) => {
  744. const cache = /* @__PURE__ */ Object.create(null);
  745. return (str) => {
  746. const hit = cache[str];
  747. return hit || (cache[str] = fn(str));
  748. };
  749. };
  750. const camelizeRE = /-(\w)/g;
  751. const camelize = cacheStringFunction((str) => {
  752. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  753. });
  754. const hyphenateRE = /\B([A-Z])/g;
  755. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  756. const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  757. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  758. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  759. var root = freeGlobal || freeSelf || Function("return this")();
  760. var Symbol$1 = root.Symbol;
  761. var objectProto$s = Object.prototype;
  762. var hasOwnProperty$o = objectProto$s.hasOwnProperty;
  763. var nativeObjectToString$3 = objectProto$s.toString;
  764. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  765. function getRawTag(value) {
  766. var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  767. try {
  768. value[symToStringTag$1] = void 0;
  769. var unmasked = true;
  770. } catch (e) {
  771. }
  772. var result = nativeObjectToString$3.call(value);
  773. if (unmasked) {
  774. if (isOwn) {
  775. value[symToStringTag$1] = tag;
  776. } else {
  777. delete value[symToStringTag$1];
  778. }
  779. }
  780. return result;
  781. }
  782. var objectProto$r = Object.prototype;
  783. var nativeObjectToString$2 = objectProto$r.toString;
  784. function objectToString(value) {
  785. return nativeObjectToString$2.call(value);
  786. }
  787. var nullTag = "[object Null]";
  788. var undefinedTag = "[object Undefined]";
  789. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  790. function baseGetTag(value) {
  791. if (value == null) {
  792. return value === void 0 ? undefinedTag : nullTag;
  793. }
  794. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  795. }
  796. function isObjectLike(value) {
  797. return value != null && typeof value == "object";
  798. }
  799. var symbolTag$3 = "[object Symbol]";
  800. function isSymbol(value) {
  801. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  802. }
  803. var NAN$2 = 0 / 0;
  804. function baseToNumber(value) {
  805. if (typeof value == "number") {
  806. return value;
  807. }
  808. if (isSymbol(value)) {
  809. return NAN$2;
  810. }
  811. return +value;
  812. }
  813. function arrayMap(array, iteratee) {
  814. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  815. while (++index < length) {
  816. result[index] = iteratee(array[index], index, array);
  817. }
  818. return result;
  819. }
  820. var isArray = Array.isArray;
  821. var INFINITY$5 = 1 / 0;
  822. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  823. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  824. function baseToString(value) {
  825. if (typeof value == "string") {
  826. return value;
  827. }
  828. if (isArray(value)) {
  829. return arrayMap(value, baseToString) + "";
  830. }
  831. if (isSymbol(value)) {
  832. return symbolToString ? symbolToString.call(value) : "";
  833. }
  834. var result = value + "";
  835. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  836. }
  837. function createMathOperation(operator, defaultValue) {
  838. return function(value, other) {
  839. var result;
  840. if (value === void 0 && other === void 0) {
  841. return defaultValue;
  842. }
  843. if (value !== void 0) {
  844. result = value;
  845. }
  846. if (other !== void 0) {
  847. if (result === void 0) {
  848. return other;
  849. }
  850. if (typeof value == "string" || typeof other == "string") {
  851. value = baseToString(value);
  852. other = baseToString(other);
  853. } else {
  854. value = baseToNumber(value);
  855. other = baseToNumber(other);
  856. }
  857. result = operator(value, other);
  858. }
  859. return result;
  860. };
  861. }
  862. var add = createMathOperation(function(augend, addend) {
  863. return augend + addend;
  864. }, 0);
  865. var reWhitespace = /\s/;
  866. function trimmedEndIndex(string) {
  867. var index = string.length;
  868. while (index-- && reWhitespace.test(string.charAt(index))) {
  869. }
  870. return index;
  871. }
  872. var reTrimStart$2 = /^\s+/;
  873. function baseTrim(string) {
  874. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  875. }
  876. function isObject(value) {
  877. var type = typeof value;
  878. return value != null && (type == "object" || type == "function");
  879. }
  880. var NAN$1 = 0 / 0;
  881. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  882. var reIsBinary = /^0b[01]+$/i;
  883. var reIsOctal = /^0o[0-7]+$/i;
  884. var freeParseInt = parseInt;
  885. function toNumber(value) {
  886. if (typeof value == "number") {
  887. return value;
  888. }
  889. if (isSymbol(value)) {
  890. return NAN$1;
  891. }
  892. if (isObject(value)) {
  893. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  894. value = isObject(other) ? other + "" : other;
  895. }
  896. if (typeof value != "string") {
  897. return value === 0 ? value : +value;
  898. }
  899. value = baseTrim(value);
  900. var isBinary = reIsBinary.test(value);
  901. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  902. }
  903. var INFINITY$4 = 1 / 0;
  904. var MAX_INTEGER = 17976931348623157e292;
  905. function toFinite(value) {
  906. if (!value) {
  907. return value === 0 ? value : 0;
  908. }
  909. value = toNumber(value);
  910. if (value === INFINITY$4 || value === -INFINITY$4) {
  911. var sign = value < 0 ? -1 : 1;
  912. return sign * MAX_INTEGER;
  913. }
  914. return value === value ? value : 0;
  915. }
  916. function toInteger(value) {
  917. var result = toFinite(value), remainder = result % 1;
  918. return result === result ? remainder ? result - remainder : result : 0;
  919. }
  920. var FUNC_ERROR_TEXT$b = "Expected a function";
  921. function after(n, func) {
  922. if (typeof func != "function") {
  923. throw new TypeError(FUNC_ERROR_TEXT$b);
  924. }
  925. n = toInteger(n);
  926. return function() {
  927. if (--n < 1) {
  928. return func.apply(this, arguments);
  929. }
  930. };
  931. }
  932. function identity(value) {
  933. return value;
  934. }
  935. var asyncTag = "[object AsyncFunction]";
  936. var funcTag$2 = "[object Function]";
  937. var genTag$1 = "[object GeneratorFunction]";
  938. var proxyTag = "[object Proxy]";
  939. function isFunction(value) {
  940. if (!isObject(value)) {
  941. return false;
  942. }
  943. var tag = baseGetTag(value);
  944. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  945. }
  946. var coreJsData = root["__core-js_shared__"];
  947. var maskSrcKey = function() {
  948. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  949. return uid ? "Symbol(src)_1." + uid : "";
  950. }();
  951. function isMasked(func) {
  952. return !!maskSrcKey && maskSrcKey in func;
  953. }
  954. var funcProto$2 = Function.prototype;
  955. var funcToString$2 = funcProto$2.toString;
  956. function toSource(func) {
  957. if (func != null) {
  958. try {
  959. return funcToString$2.call(func);
  960. } catch (e) {
  961. }
  962. try {
  963. return func + "";
  964. } catch (e) {
  965. }
  966. }
  967. return "";
  968. }
  969. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  970. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  971. var funcProto$1 = Function.prototype;
  972. var objectProto$q = Object.prototype;
  973. var funcToString$1 = funcProto$1.toString;
  974. var hasOwnProperty$n = objectProto$q.hasOwnProperty;
  975. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  976. function baseIsNative(value) {
  977. if (!isObject(value) || isMasked(value)) {
  978. return false;
  979. }
  980. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  981. return pattern.test(toSource(value));
  982. }
  983. function getValue$1(object, key) {
  984. return object == null ? void 0 : object[key];
  985. }
  986. function getNative(object, key) {
  987. var value = getValue$1(object, key);
  988. return baseIsNative(value) ? value : void 0;
  989. }
  990. var WeakMap = getNative(root, "WeakMap");
  991. var metaMap = WeakMap && new WeakMap();
  992. var baseSetData = !metaMap ? identity : function(func, data) {
  993. metaMap.set(func, data);
  994. return func;
  995. };
  996. var objectCreate = Object.create;
  997. var baseCreate = function() {
  998. function object() {
  999. }
  1000. return function(proto) {
  1001. if (!isObject(proto)) {
  1002. return {};
  1003. }
  1004. if (objectCreate) {
  1005. return objectCreate(proto);
  1006. }
  1007. object.prototype = proto;
  1008. var result = new object();
  1009. object.prototype = void 0;
  1010. return result;
  1011. };
  1012. }();
  1013. function createCtor(Ctor) {
  1014. return function() {
  1015. var args = arguments;
  1016. switch (args.length) {
  1017. case 0:
  1018. return new Ctor();
  1019. case 1:
  1020. return new Ctor(args[0]);
  1021. case 2:
  1022. return new Ctor(args[0], args[1]);
  1023. case 3:
  1024. return new Ctor(args[0], args[1], args[2]);
  1025. case 4:
  1026. return new Ctor(args[0], args[1], args[2], args[3]);
  1027. case 5:
  1028. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  1029. case 6:
  1030. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  1031. case 7:
  1032. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  1033. }
  1034. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  1035. return isObject(result) ? result : thisBinding;
  1036. };
  1037. }
  1038. var WRAP_BIND_FLAG$8 = 1;
  1039. function createBind(func, bitmask, thisArg) {
  1040. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  1041. function wrapper() {
  1042. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1043. return fn.apply(isBind ? thisArg : this, arguments);
  1044. }
  1045. return wrapper;
  1046. }
  1047. function apply(func, thisArg, args) {
  1048. switch (args.length) {
  1049. case 0:
  1050. return func.call(thisArg);
  1051. case 1:
  1052. return func.call(thisArg, args[0]);
  1053. case 2:
  1054. return func.call(thisArg, args[0], args[1]);
  1055. case 3:
  1056. return func.call(thisArg, args[0], args[1], args[2]);
  1057. }
  1058. return func.apply(thisArg, args);
  1059. }
  1060. var nativeMax$g = Math.max;
  1061. function composeArgs(args, partials, holders, isCurried) {
  1062. 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;
  1063. while (++leftIndex < leftLength) {
  1064. result[leftIndex] = partials[leftIndex];
  1065. }
  1066. while (++argsIndex < holdersLength) {
  1067. if (isUncurried || argsIndex < argsLength) {
  1068. result[holders[argsIndex]] = args[argsIndex];
  1069. }
  1070. }
  1071. while (rangeLength--) {
  1072. result[leftIndex++] = args[argsIndex++];
  1073. }
  1074. return result;
  1075. }
  1076. var nativeMax$f = Math.max;
  1077. function composeArgsRight(args, partials, holders, isCurried) {
  1078. 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;
  1079. while (++argsIndex < rangeLength) {
  1080. result[argsIndex] = args[argsIndex];
  1081. }
  1082. var offset = argsIndex;
  1083. while (++rightIndex < rightLength) {
  1084. result[offset + rightIndex] = partials[rightIndex];
  1085. }
  1086. while (++holdersIndex < holdersLength) {
  1087. if (isUncurried || argsIndex < argsLength) {
  1088. result[offset + holders[holdersIndex]] = args[argsIndex++];
  1089. }
  1090. }
  1091. return result;
  1092. }
  1093. function countHolders(array, placeholder) {
  1094. var length = array.length, result = 0;
  1095. while (length--) {
  1096. if (array[length] === placeholder) {
  1097. ++result;
  1098. }
  1099. }
  1100. return result;
  1101. }
  1102. function baseLodash() {
  1103. }
  1104. var MAX_ARRAY_LENGTH$6 = 4294967295;
  1105. function LazyWrapper(value) {
  1106. this.__wrapped__ = value;
  1107. this.__actions__ = [];
  1108. this.__dir__ = 1;
  1109. this.__filtered__ = false;
  1110. this.__iteratees__ = [];
  1111. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  1112. this.__views__ = [];
  1113. }
  1114. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  1115. LazyWrapper.prototype.constructor = LazyWrapper;
  1116. function noop() {
  1117. }
  1118. var getData = !metaMap ? noop : function(func) {
  1119. return metaMap.get(func);
  1120. };
  1121. var realNames = {};
  1122. var objectProto$p = Object.prototype;
  1123. var hasOwnProperty$m = objectProto$p.hasOwnProperty;
  1124. function getFuncName(func) {
  1125. var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0;
  1126. while (length--) {
  1127. var data = array[length], otherFunc = data.func;
  1128. if (otherFunc == null || otherFunc == func) {
  1129. return data.name;
  1130. }
  1131. }
  1132. return result;
  1133. }
  1134. function LodashWrapper(value, chainAll) {
  1135. this.__wrapped__ = value;
  1136. this.__actions__ = [];
  1137. this.__chain__ = !!chainAll;
  1138. this.__index__ = 0;
  1139. this.__values__ = void 0;
  1140. }
  1141. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  1142. LodashWrapper.prototype.constructor = LodashWrapper;
  1143. function copyArray(source, array) {
  1144. var index = -1, length = source.length;
  1145. array || (array = Array(length));
  1146. while (++index < length) {
  1147. array[index] = source[index];
  1148. }
  1149. return array;
  1150. }
  1151. function wrapperClone(wrapper) {
  1152. if (wrapper instanceof LazyWrapper) {
  1153. return wrapper.clone();
  1154. }
  1155. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  1156. result.__actions__ = copyArray(wrapper.__actions__);
  1157. result.__index__ = wrapper.__index__;
  1158. result.__values__ = wrapper.__values__;
  1159. return result;
  1160. }
  1161. var objectProto$o = Object.prototype;
  1162. var hasOwnProperty$l = objectProto$o.hasOwnProperty;
  1163. function lodash(value) {
  1164. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  1165. if (value instanceof LodashWrapper) {
  1166. return value;
  1167. }
  1168. if (hasOwnProperty$l.call(value, "__wrapped__")) {
  1169. return wrapperClone(value);
  1170. }
  1171. }
  1172. return new LodashWrapper(value);
  1173. }
  1174. lodash.prototype = baseLodash.prototype;
  1175. lodash.prototype.constructor = lodash;
  1176. function isLaziable(func) {
  1177. var funcName = getFuncName(func), other = lodash[funcName];
  1178. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  1179. return false;
  1180. }
  1181. if (func === other) {
  1182. return true;
  1183. }
  1184. var data = getData(other);
  1185. return !!data && func === data[0];
  1186. }
  1187. var HOT_COUNT = 800;
  1188. var HOT_SPAN = 16;
  1189. var nativeNow = Date.now;
  1190. function shortOut(func) {
  1191. var count = 0, lastCalled = 0;
  1192. return function() {
  1193. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1194. lastCalled = stamp;
  1195. if (remaining > 0) {
  1196. if (++count >= HOT_COUNT) {
  1197. return arguments[0];
  1198. }
  1199. } else {
  1200. count = 0;
  1201. }
  1202. return func.apply(void 0, arguments);
  1203. };
  1204. }
  1205. var setData = shortOut(baseSetData);
  1206. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  1207. var reSplitDetails = /,? & /;
  1208. function getWrapDetails(source) {
  1209. var match = source.match(reWrapDetails);
  1210. return match ? match[1].split(reSplitDetails) : [];
  1211. }
  1212. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  1213. function insertWrapDetails(source, details) {
  1214. var length = details.length;
  1215. if (!length) {
  1216. return source;
  1217. }
  1218. var lastIndex = length - 1;
  1219. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  1220. details = details.join(length > 2 ? ", " : " ");
  1221. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  1222. }
  1223. function constant(value) {
  1224. return function() {
  1225. return value;
  1226. };
  1227. }
  1228. var defineProperty = function() {
  1229. try {
  1230. var func = getNative(Object, "defineProperty");
  1231. func({}, "", {});
  1232. return func;
  1233. } catch (e) {
  1234. }
  1235. }();
  1236. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1237. return defineProperty(func, "toString", {
  1238. "configurable": true,
  1239. "enumerable": false,
  1240. "value": constant(string),
  1241. "writable": true
  1242. });
  1243. };
  1244. var setToString = shortOut(baseSetToString);
  1245. function arrayEach(array, iteratee) {
  1246. var index = -1, length = array == null ? 0 : array.length;
  1247. while (++index < length) {
  1248. if (iteratee(array[index], index, array) === false) {
  1249. break;
  1250. }
  1251. }
  1252. return array;
  1253. }
  1254. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1255. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1256. while (fromRight ? index-- : ++index < length) {
  1257. if (predicate(array[index], index, array)) {
  1258. return index;
  1259. }
  1260. }
  1261. return -1;
  1262. }
  1263. function baseIsNaN(value) {
  1264. return value !== value;
  1265. }
  1266. function strictIndexOf(array, value, fromIndex) {
  1267. var index = fromIndex - 1, length = array.length;
  1268. while (++index < length) {
  1269. if (array[index] === value) {
  1270. return index;
  1271. }
  1272. }
  1273. return -1;
  1274. }
  1275. function baseIndexOf(array, value, fromIndex) {
  1276. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1277. }
  1278. function arrayIncludes(array, value) {
  1279. var length = array == null ? 0 : array.length;
  1280. return !!length && baseIndexOf(array, value, 0) > -1;
  1281. }
  1282. var WRAP_BIND_FLAG$7 = 1;
  1283. var WRAP_BIND_KEY_FLAG$6 = 2;
  1284. var WRAP_CURRY_FLAG$6 = 8;
  1285. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  1286. var WRAP_PARTIAL_FLAG$6 = 32;
  1287. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  1288. var WRAP_ARY_FLAG$4 = 128;
  1289. var WRAP_REARG_FLAG$3 = 256;
  1290. var WRAP_FLIP_FLAG$2 = 512;
  1291. var wrapFlags = [
  1292. ["ary", WRAP_ARY_FLAG$4],
  1293. ["bind", WRAP_BIND_FLAG$7],
  1294. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  1295. ["curry", WRAP_CURRY_FLAG$6],
  1296. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  1297. ["flip", WRAP_FLIP_FLAG$2],
  1298. ["partial", WRAP_PARTIAL_FLAG$6],
  1299. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  1300. ["rearg", WRAP_REARG_FLAG$3]
  1301. ];
  1302. function updateWrapDetails(details, bitmask) {
  1303. arrayEach(wrapFlags, function(pair) {
  1304. var value = "_." + pair[0];
  1305. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  1306. details.push(value);
  1307. }
  1308. });
  1309. return details.sort();
  1310. }
  1311. function setWrapToString(wrapper, reference, bitmask) {
  1312. var source = reference + "";
  1313. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  1314. }
  1315. var WRAP_BIND_FLAG$6 = 1;
  1316. var WRAP_BIND_KEY_FLAG$5 = 2;
  1317. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  1318. var WRAP_CURRY_FLAG$5 = 8;
  1319. var WRAP_PARTIAL_FLAG$5 = 32;
  1320. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  1321. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  1322. 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;
  1323. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  1324. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  1325. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  1326. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  1327. }
  1328. var newData = [
  1329. func,
  1330. bitmask,
  1331. thisArg,
  1332. newPartials,
  1333. newHolders,
  1334. newPartialsRight,
  1335. newHoldersRight,
  1336. argPos,
  1337. ary,
  1338. arity
  1339. ];
  1340. var result = wrapFunc.apply(void 0, newData);
  1341. if (isLaziable(func)) {
  1342. setData(result, newData);
  1343. }
  1344. result.placeholder = placeholder;
  1345. return setWrapToString(result, func, bitmask);
  1346. }
  1347. function getHolder(func) {
  1348. var object = func;
  1349. return object.placeholder;
  1350. }
  1351. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  1352. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1353. function isIndex(value, length) {
  1354. var type = typeof value;
  1355. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  1356. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  1357. }
  1358. var nativeMin$e = Math.min;
  1359. function reorder(array, indexes) {
  1360. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  1361. while (length--) {
  1362. var index = indexes[length];
  1363. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  1364. }
  1365. return array;
  1366. }
  1367. var PLACEHOLDER$1 = "__lodash_placeholder__";
  1368. function replaceHolders(array, placeholder) {
  1369. var index = -1, length = array.length, resIndex = 0, result = [];
  1370. while (++index < length) {
  1371. var value = array[index];
  1372. if (value === placeholder || value === PLACEHOLDER$1) {
  1373. array[index] = PLACEHOLDER$1;
  1374. result[resIndex++] = index;
  1375. }
  1376. }
  1377. return result;
  1378. }
  1379. var WRAP_BIND_FLAG$5 = 1;
  1380. var WRAP_BIND_KEY_FLAG$4 = 2;
  1381. var WRAP_CURRY_FLAG$4 = 8;
  1382. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  1383. var WRAP_ARY_FLAG$3 = 128;
  1384. var WRAP_FLIP_FLAG$1 = 512;
  1385. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  1386. 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);
  1387. function wrapper() {
  1388. var length = arguments.length, args = Array(length), index = length;
  1389. while (index--) {
  1390. args[index] = arguments[index];
  1391. }
  1392. if (isCurried) {
  1393. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  1394. }
  1395. if (partials) {
  1396. args = composeArgs(args, partials, holders, isCurried);
  1397. }
  1398. if (partialsRight) {
  1399. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  1400. }
  1401. length -= holdersCount;
  1402. if (isCurried && length < arity) {
  1403. var newHolders = replaceHolders(args, placeholder);
  1404. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  1405. }
  1406. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  1407. length = args.length;
  1408. if (argPos) {
  1409. args = reorder(args, argPos);
  1410. } else if (isFlip && length > 1) {
  1411. args.reverse();
  1412. }
  1413. if (isAry && ary < length) {
  1414. args.length = ary;
  1415. }
  1416. if (this && this !== root && this instanceof wrapper) {
  1417. fn = Ctor || createCtor(fn);
  1418. }
  1419. return fn.apply(thisBinding, args);
  1420. }
  1421. return wrapper;
  1422. }
  1423. function createCurry(func, bitmask, arity) {
  1424. var Ctor = createCtor(func);
  1425. function wrapper() {
  1426. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  1427. while (index--) {
  1428. args[index] = arguments[index];
  1429. }
  1430. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  1431. length -= holders.length;
  1432. if (length < arity) {
  1433. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  1434. }
  1435. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1436. return apply(fn, this, args);
  1437. }
  1438. return wrapper;
  1439. }
  1440. var WRAP_BIND_FLAG$4 = 1;
  1441. function createPartial(func, bitmask, thisArg, partials) {
  1442. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  1443. function wrapper() {
  1444. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1445. while (++leftIndex < leftLength) {
  1446. args[leftIndex] = partials[leftIndex];
  1447. }
  1448. while (argsLength--) {
  1449. args[leftIndex++] = arguments[++argsIndex];
  1450. }
  1451. return apply(fn, isBind ? thisArg : this, args);
  1452. }
  1453. return wrapper;
  1454. }
  1455. var PLACEHOLDER = "__lodash_placeholder__";
  1456. var WRAP_BIND_FLAG$3 = 1;
  1457. var WRAP_BIND_KEY_FLAG$3 = 2;
  1458. var WRAP_CURRY_BOUND_FLAG = 4;
  1459. var WRAP_CURRY_FLAG$3 = 8;
  1460. var WRAP_ARY_FLAG$2 = 128;
  1461. var WRAP_REARG_FLAG$2 = 256;
  1462. var nativeMin$d = Math.min;
  1463. function mergeData(data, source) {
  1464. 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);
  1465. 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;
  1466. if (!(isCommon || isCombo)) {
  1467. return data;
  1468. }
  1469. if (srcBitmask & WRAP_BIND_FLAG$3) {
  1470. data[2] = source[2];
  1471. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  1472. }
  1473. var value = source[3];
  1474. if (value) {
  1475. var partials = data[3];
  1476. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  1477. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  1478. }
  1479. value = source[5];
  1480. if (value) {
  1481. partials = data[5];
  1482. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  1483. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  1484. }
  1485. value = source[7];
  1486. if (value) {
  1487. data[7] = value;
  1488. }
  1489. if (srcBitmask & WRAP_ARY_FLAG$2) {
  1490. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  1491. }
  1492. if (data[9] == null) {
  1493. data[9] = source[9];
  1494. }
  1495. data[0] = source[0];
  1496. data[1] = newBitmask;
  1497. return data;
  1498. }
  1499. var FUNC_ERROR_TEXT$a = "Expected a function";
  1500. var WRAP_BIND_FLAG$2 = 1;
  1501. var WRAP_BIND_KEY_FLAG$2 = 2;
  1502. var WRAP_CURRY_FLAG$2 = 8;
  1503. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  1504. var WRAP_PARTIAL_FLAG$4 = 32;
  1505. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  1506. var nativeMax$e = Math.max;
  1507. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  1508. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  1509. if (!isBindKey && typeof func != "function") {
  1510. throw new TypeError(FUNC_ERROR_TEXT$a);
  1511. }
  1512. var length = partials ? partials.length : 0;
  1513. if (!length) {
  1514. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  1515. partials = holders = void 0;
  1516. }
  1517. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  1518. arity = arity === void 0 ? arity : toInteger(arity);
  1519. length -= holders ? holders.length : 0;
  1520. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  1521. var partialsRight = partials, holdersRight = holders;
  1522. partials = holders = void 0;
  1523. }
  1524. var data = isBindKey ? void 0 : getData(func);
  1525. var newData = [
  1526. func,
  1527. bitmask,
  1528. thisArg,
  1529. partials,
  1530. holders,
  1531. partialsRight,
  1532. holdersRight,
  1533. argPos,
  1534. ary,
  1535. arity
  1536. ];
  1537. if (data) {
  1538. mergeData(newData, data);
  1539. }
  1540. func = newData[0];
  1541. bitmask = newData[1];
  1542. thisArg = newData[2];
  1543. partials = newData[3];
  1544. holders = newData[4];
  1545. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  1546. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  1547. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  1548. }
  1549. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  1550. var result = createBind(func, bitmask, thisArg);
  1551. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  1552. result = createCurry(func, bitmask, arity);
  1553. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  1554. result = createPartial(func, bitmask, thisArg, partials);
  1555. } else {
  1556. result = createHybrid.apply(void 0, newData);
  1557. }
  1558. var setter = data ? baseSetData : setData;
  1559. return setWrapToString(setter(result, newData), func, bitmask);
  1560. }
  1561. var WRAP_ARY_FLAG$1 = 128;
  1562. function ary(func, n, guard) {
  1563. n = guard ? void 0 : n;
  1564. n = func && n == null ? func.length : n;
  1565. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  1566. }
  1567. function baseAssignValue(object, key, value) {
  1568. if (key == "__proto__" && defineProperty) {
  1569. defineProperty(object, key, {
  1570. "configurable": true,
  1571. "enumerable": true,
  1572. "value": value,
  1573. "writable": true
  1574. });
  1575. } else {
  1576. object[key] = value;
  1577. }
  1578. }
  1579. function eq(value, other) {
  1580. return value === other || value !== value && other !== other;
  1581. }
  1582. var objectProto$n = Object.prototype;
  1583. var hasOwnProperty$k = objectProto$n.hasOwnProperty;
  1584. function assignValue(object, key, value) {
  1585. var objValue = object[key];
  1586. if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  1587. baseAssignValue(object, key, value);
  1588. }
  1589. }
  1590. function copyObject(source, props, object, customizer) {
  1591. var isNew = !object;
  1592. object || (object = {});
  1593. var index = -1, length = props.length;
  1594. while (++index < length) {
  1595. var key = props[index];
  1596. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1597. if (newValue === void 0) {
  1598. newValue = source[key];
  1599. }
  1600. if (isNew) {
  1601. baseAssignValue(object, key, newValue);
  1602. } else {
  1603. assignValue(object, key, newValue);
  1604. }
  1605. }
  1606. return object;
  1607. }
  1608. var nativeMax$d = Math.max;
  1609. function overRest(func, start, transform) {
  1610. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  1611. return function() {
  1612. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  1613. while (++index < length) {
  1614. array[index] = args[start + index];
  1615. }
  1616. index = -1;
  1617. var otherArgs = Array(start + 1);
  1618. while (++index < start) {
  1619. otherArgs[index] = args[index];
  1620. }
  1621. otherArgs[start] = transform(array);
  1622. return apply(func, this, otherArgs);
  1623. };
  1624. }
  1625. function baseRest(func, start) {
  1626. return setToString(overRest(func, start, identity), func + "");
  1627. }
  1628. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  1629. function isLength(value) {
  1630. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  1631. }
  1632. function isArrayLike(value) {
  1633. return value != null && isLength(value.length) && !isFunction(value);
  1634. }
  1635. function isIterateeCall(value, index, object) {
  1636. if (!isObject(object)) {
  1637. return false;
  1638. }
  1639. var type = typeof index;
  1640. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  1641. return eq(object[index], value);
  1642. }
  1643. return false;
  1644. }
  1645. function createAssigner(assigner) {
  1646. return baseRest(function(object, sources) {
  1647. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1648. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1649. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1650. customizer = length < 3 ? void 0 : customizer;
  1651. length = 1;
  1652. }
  1653. object = Object(object);
  1654. while (++index < length) {
  1655. var source = sources[index];
  1656. if (source) {
  1657. assigner(object, source, index, customizer);
  1658. }
  1659. }
  1660. return object;
  1661. });
  1662. }
  1663. var objectProto$m = Object.prototype;
  1664. function isPrototype(value) {
  1665. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  1666. return value === proto;
  1667. }
  1668. function baseTimes(n, iteratee) {
  1669. var index = -1, result = Array(n);
  1670. while (++index < n) {
  1671. result[index] = iteratee(index);
  1672. }
  1673. return result;
  1674. }
  1675. var argsTag$3 = "[object Arguments]";
  1676. function baseIsArguments(value) {
  1677. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  1678. }
  1679. var objectProto$l = Object.prototype;
  1680. var hasOwnProperty$j = objectProto$l.hasOwnProperty;
  1681. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  1682. var isArguments = baseIsArguments(function() {
  1683. return arguments;
  1684. }()) ? baseIsArguments : function(value) {
  1685. return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  1686. };
  1687. function stubFalse() {
  1688. return false;
  1689. }
  1690. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1691. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  1692. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  1693. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  1694. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  1695. var isBuffer = nativeIsBuffer || stubFalse;
  1696. var argsTag$2 = "[object Arguments]";
  1697. var arrayTag$2 = "[object Array]";
  1698. var boolTag$4 = "[object Boolean]";
  1699. var dateTag$4 = "[object Date]";
  1700. var errorTag$3 = "[object Error]";
  1701. var funcTag$1 = "[object Function]";
  1702. var mapTag$9 = "[object Map]";
  1703. var numberTag$4 = "[object Number]";
  1704. var objectTag$4 = "[object Object]";
  1705. var regexpTag$4 = "[object RegExp]";
  1706. var setTag$9 = "[object Set]";
  1707. var stringTag$4 = "[object String]";
  1708. var weakMapTag$3 = "[object WeakMap]";
  1709. var arrayBufferTag$4 = "[object ArrayBuffer]";
  1710. var dataViewTag$4 = "[object DataView]";
  1711. var float32Tag$2 = "[object Float32Array]";
  1712. var float64Tag$2 = "[object Float64Array]";
  1713. var int8Tag$2 = "[object Int8Array]";
  1714. var int16Tag$2 = "[object Int16Array]";
  1715. var int32Tag$2 = "[object Int32Array]";
  1716. var uint8Tag$2 = "[object Uint8Array]";
  1717. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  1718. var uint16Tag$2 = "[object Uint16Array]";
  1719. var uint32Tag$2 = "[object Uint32Array]";
  1720. var typedArrayTags = {};
  1721. 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;
  1722. 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;
  1723. function baseIsTypedArray(value) {
  1724. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  1725. }
  1726. function baseUnary(func) {
  1727. return function(value) {
  1728. return func(value);
  1729. };
  1730. }
  1731. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1732. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  1733. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  1734. var freeProcess = moduleExports$1 && freeGlobal.process;
  1735. var nodeUtil = function() {
  1736. try {
  1737. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  1738. if (types) {
  1739. return types;
  1740. }
  1741. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  1742. } catch (e) {
  1743. }
  1744. }();
  1745. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1746. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  1747. var objectProto$k = Object.prototype;
  1748. var hasOwnProperty$i = objectProto$k.hasOwnProperty;
  1749. function arrayLikeKeys(value, inherited) {
  1750. 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;
  1751. for (var key in value) {
  1752. 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)))) {
  1753. result.push(key);
  1754. }
  1755. }
  1756. return result;
  1757. }
  1758. function overArg(func, transform) {
  1759. return function(arg) {
  1760. return func(transform(arg));
  1761. };
  1762. }
  1763. var nativeKeys = overArg(Object.keys, Object);
  1764. var objectProto$j = Object.prototype;
  1765. var hasOwnProperty$h = objectProto$j.hasOwnProperty;
  1766. function baseKeys(object) {
  1767. if (!isPrototype(object)) {
  1768. return nativeKeys(object);
  1769. }
  1770. var result = [];
  1771. for (var key in Object(object)) {
  1772. if (hasOwnProperty$h.call(object, key) && key != "constructor") {
  1773. result.push(key);
  1774. }
  1775. }
  1776. return result;
  1777. }
  1778. function keys(object) {
  1779. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1780. }
  1781. var objectProto$i = Object.prototype;
  1782. var hasOwnProperty$g = objectProto$i.hasOwnProperty;
  1783. var assign = createAssigner(function(object, source) {
  1784. if (isPrototype(source) || isArrayLike(source)) {
  1785. copyObject(source, keys(source), object);
  1786. return;
  1787. }
  1788. for (var key in source) {
  1789. if (hasOwnProperty$g.call(source, key)) {
  1790. assignValue(object, key, source[key]);
  1791. }
  1792. }
  1793. });
  1794. function nativeKeysIn(object) {
  1795. var result = [];
  1796. if (object != null) {
  1797. for (var key in Object(object)) {
  1798. result.push(key);
  1799. }
  1800. }
  1801. return result;
  1802. }
  1803. var objectProto$h = Object.prototype;
  1804. var hasOwnProperty$f = objectProto$h.hasOwnProperty;
  1805. function baseKeysIn(object) {
  1806. if (!isObject(object)) {
  1807. return nativeKeysIn(object);
  1808. }
  1809. var isProto = isPrototype(object), result = [];
  1810. for (var key in object) {
  1811. if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
  1812. result.push(key);
  1813. }
  1814. }
  1815. return result;
  1816. }
  1817. function keysIn(object) {
  1818. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1819. }
  1820. var assignIn = createAssigner(function(object, source) {
  1821. copyObject(source, keysIn(source), object);
  1822. });
  1823. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  1824. copyObject(source, keysIn(source), object, customizer);
  1825. });
  1826. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  1827. copyObject(source, keys(source), object, customizer);
  1828. });
  1829. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  1830. var reIsPlainProp = /^\w*$/;
  1831. function isKey(value, object) {
  1832. if (isArray(value)) {
  1833. return false;
  1834. }
  1835. var type = typeof value;
  1836. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  1837. return true;
  1838. }
  1839. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1840. }
  1841. var nativeCreate = getNative(Object, "create");
  1842. function hashClear() {
  1843. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1844. this.size = 0;
  1845. }
  1846. function hashDelete(key) {
  1847. var result = this.has(key) && delete this.__data__[key];
  1848. this.size -= result ? 1 : 0;
  1849. return result;
  1850. }
  1851. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1852. var objectProto$g = Object.prototype;
  1853. var hasOwnProperty$e = objectProto$g.hasOwnProperty;
  1854. function hashGet(key) {
  1855. var data = this.__data__;
  1856. if (nativeCreate) {
  1857. var result = data[key];
  1858. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1859. }
  1860. return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
  1861. }
  1862. var objectProto$f = Object.prototype;
  1863. var hasOwnProperty$d = objectProto$f.hasOwnProperty;
  1864. function hashHas(key) {
  1865. var data = this.__data__;
  1866. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
  1867. }
  1868. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1869. function hashSet(key, value) {
  1870. var data = this.__data__;
  1871. this.size += this.has(key) ? 0 : 1;
  1872. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1873. return this;
  1874. }
  1875. function Hash(entries) {
  1876. var index = -1, length = entries == null ? 0 : entries.length;
  1877. this.clear();
  1878. while (++index < length) {
  1879. var entry = entries[index];
  1880. this.set(entry[0], entry[1]);
  1881. }
  1882. }
  1883. Hash.prototype.clear = hashClear;
  1884. Hash.prototype["delete"] = hashDelete;
  1885. Hash.prototype.get = hashGet;
  1886. Hash.prototype.has = hashHas;
  1887. Hash.prototype.set = hashSet;
  1888. function listCacheClear() {
  1889. this.__data__ = [];
  1890. this.size = 0;
  1891. }
  1892. function assocIndexOf(array, key) {
  1893. var length = array.length;
  1894. while (length--) {
  1895. if (eq(array[length][0], key)) {
  1896. return length;
  1897. }
  1898. }
  1899. return -1;
  1900. }
  1901. var arrayProto$5 = Array.prototype;
  1902. var splice$2 = arrayProto$5.splice;
  1903. function listCacheDelete(key) {
  1904. var data = this.__data__, index = assocIndexOf(data, key);
  1905. if (index < 0) {
  1906. return false;
  1907. }
  1908. var lastIndex = data.length - 1;
  1909. if (index == lastIndex) {
  1910. data.pop();
  1911. } else {
  1912. splice$2.call(data, index, 1);
  1913. }
  1914. --this.size;
  1915. return true;
  1916. }
  1917. function listCacheGet(key) {
  1918. var data = this.__data__, index = assocIndexOf(data, key);
  1919. return index < 0 ? void 0 : data[index][1];
  1920. }
  1921. function listCacheHas(key) {
  1922. return assocIndexOf(this.__data__, key) > -1;
  1923. }
  1924. function listCacheSet(key, value) {
  1925. var data = this.__data__, index = assocIndexOf(data, key);
  1926. if (index < 0) {
  1927. ++this.size;
  1928. data.push([key, value]);
  1929. } else {
  1930. data[index][1] = value;
  1931. }
  1932. return this;
  1933. }
  1934. function ListCache(entries) {
  1935. var index = -1, length = entries == null ? 0 : entries.length;
  1936. this.clear();
  1937. while (++index < length) {
  1938. var entry = entries[index];
  1939. this.set(entry[0], entry[1]);
  1940. }
  1941. }
  1942. ListCache.prototype.clear = listCacheClear;
  1943. ListCache.prototype["delete"] = listCacheDelete;
  1944. ListCache.prototype.get = listCacheGet;
  1945. ListCache.prototype.has = listCacheHas;
  1946. ListCache.prototype.set = listCacheSet;
  1947. var Map$1 = getNative(root, "Map");
  1948. function mapCacheClear() {
  1949. this.size = 0;
  1950. this.__data__ = {
  1951. "hash": new Hash(),
  1952. "map": new (Map$1 || ListCache)(),
  1953. "string": new Hash()
  1954. };
  1955. }
  1956. function isKeyable(value) {
  1957. var type = typeof value;
  1958. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1959. }
  1960. function getMapData(map, key) {
  1961. var data = map.__data__;
  1962. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1963. }
  1964. function mapCacheDelete(key) {
  1965. var result = getMapData(this, key)["delete"](key);
  1966. this.size -= result ? 1 : 0;
  1967. return result;
  1968. }
  1969. function mapCacheGet(key) {
  1970. return getMapData(this, key).get(key);
  1971. }
  1972. function mapCacheHas(key) {
  1973. return getMapData(this, key).has(key);
  1974. }
  1975. function mapCacheSet(key, value) {
  1976. var data = getMapData(this, key), size = data.size;
  1977. data.set(key, value);
  1978. this.size += data.size == size ? 0 : 1;
  1979. return this;
  1980. }
  1981. function MapCache(entries) {
  1982. var index = -1, length = entries == null ? 0 : entries.length;
  1983. this.clear();
  1984. while (++index < length) {
  1985. var entry = entries[index];
  1986. this.set(entry[0], entry[1]);
  1987. }
  1988. }
  1989. MapCache.prototype.clear = mapCacheClear;
  1990. MapCache.prototype["delete"] = mapCacheDelete;
  1991. MapCache.prototype.get = mapCacheGet;
  1992. MapCache.prototype.has = mapCacheHas;
  1993. MapCache.prototype.set = mapCacheSet;
  1994. var FUNC_ERROR_TEXT$9 = "Expected a function";
  1995. function memoize(func, resolver) {
  1996. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1997. throw new TypeError(FUNC_ERROR_TEXT$9);
  1998. }
  1999. var memoized = function() {
  2000. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  2001. if (cache.has(key)) {
  2002. return cache.get(key);
  2003. }
  2004. var result = func.apply(this, args);
  2005. memoized.cache = cache.set(key, result) || cache;
  2006. return result;
  2007. };
  2008. memoized.cache = new (memoize.Cache || MapCache)();
  2009. return memoized;
  2010. }
  2011. memoize.Cache = MapCache;
  2012. var MAX_MEMOIZE_SIZE = 500;
  2013. function memoizeCapped(func) {
  2014. var result = memoize(func, function(key) {
  2015. if (cache.size === MAX_MEMOIZE_SIZE) {
  2016. cache.clear();
  2017. }
  2018. return key;
  2019. });
  2020. var cache = result.cache;
  2021. return result;
  2022. }
  2023. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2024. var reEscapeChar = /\\(\\)?/g;
  2025. var stringToPath = memoizeCapped(function(string) {
  2026. var result = [];
  2027. if (string.charCodeAt(0) === 46) {
  2028. result.push("");
  2029. }
  2030. string.replace(rePropName, function(match, number, quote, subString) {
  2031. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  2032. });
  2033. return result;
  2034. });
  2035. function toString(value) {
  2036. return value == null ? "" : baseToString(value);
  2037. }
  2038. function castPath(value, object) {
  2039. if (isArray(value)) {
  2040. return value;
  2041. }
  2042. return isKey(value, object) ? [value] : stringToPath(toString(value));
  2043. }
  2044. var INFINITY$3 = 1 / 0;
  2045. function toKey(value) {
  2046. if (typeof value == "string" || isSymbol(value)) {
  2047. return value;
  2048. }
  2049. var result = value + "";
  2050. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  2051. }
  2052. function baseGet(object, path) {
  2053. path = castPath(path, object);
  2054. var index = 0, length = path.length;
  2055. while (object != null && index < length) {
  2056. object = object[toKey(path[index++])];
  2057. }
  2058. return index && index == length ? object : void 0;
  2059. }
  2060. function get(object, path, defaultValue) {
  2061. var result = object == null ? void 0 : baseGet(object, path);
  2062. return result === void 0 ? defaultValue : result;
  2063. }
  2064. function baseAt(object, paths) {
  2065. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  2066. while (++index < length) {
  2067. result[index] = skip ? void 0 : get(object, paths[index]);
  2068. }
  2069. return result;
  2070. }
  2071. function arrayPush(array, values) {
  2072. var index = -1, length = values.length, offset = array.length;
  2073. while (++index < length) {
  2074. array[offset + index] = values[index];
  2075. }
  2076. return array;
  2077. }
  2078. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  2079. function isFlattenable(value) {
  2080. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  2081. }
  2082. function baseFlatten(array, depth, predicate, isStrict, result) {
  2083. var index = -1, length = array.length;
  2084. predicate || (predicate = isFlattenable);
  2085. result || (result = []);
  2086. while (++index < length) {
  2087. var value = array[index];
  2088. if (depth > 0 && predicate(value)) {
  2089. if (depth > 1) {
  2090. baseFlatten(value, depth - 1, predicate, isStrict, result);
  2091. } else {
  2092. arrayPush(result, value);
  2093. }
  2094. } else if (!isStrict) {
  2095. result[result.length] = value;
  2096. }
  2097. }
  2098. return result;
  2099. }
  2100. function flatten(array) {
  2101. var length = array == null ? 0 : array.length;
  2102. return length ? baseFlatten(array, 1) : [];
  2103. }
  2104. function flatRest(func) {
  2105. return setToString(overRest(func, void 0, flatten), func + "");
  2106. }
  2107. var at$1 = flatRest(baseAt);
  2108. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2109. var objectTag$3 = "[object Object]";
  2110. var funcProto = Function.prototype;
  2111. var objectProto$e = Object.prototype;
  2112. var funcToString = funcProto.toString;
  2113. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  2114. var objectCtorString = funcToString.call(Object);
  2115. function isPlainObject(value) {
  2116. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  2117. return false;
  2118. }
  2119. var proto = getPrototype(value);
  2120. if (proto === null) {
  2121. return true;
  2122. }
  2123. var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
  2124. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2125. }
  2126. var domExcTag = "[object DOMException]";
  2127. var errorTag$2 = "[object Error]";
  2128. function isError(value) {
  2129. if (!isObjectLike(value)) {
  2130. return false;
  2131. }
  2132. var tag = baseGetTag(value);
  2133. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  2134. }
  2135. var attempt = baseRest(function(func, args) {
  2136. try {
  2137. return apply(func, void 0, args);
  2138. } catch (e) {
  2139. return isError(e) ? e : new Error(e);
  2140. }
  2141. });
  2142. var FUNC_ERROR_TEXT$8 = "Expected a function";
  2143. function before(n, func) {
  2144. var result;
  2145. if (typeof func != "function") {
  2146. throw new TypeError(FUNC_ERROR_TEXT$8);
  2147. }
  2148. n = toInteger(n);
  2149. return function() {
  2150. if (--n > 0) {
  2151. result = func.apply(this, arguments);
  2152. }
  2153. if (n <= 1) {
  2154. func = void 0;
  2155. }
  2156. return result;
  2157. };
  2158. }
  2159. var WRAP_BIND_FLAG$1 = 1;
  2160. var WRAP_PARTIAL_FLAG$3 = 32;
  2161. var bind = baseRest(function(func, thisArg, partials) {
  2162. var bitmask = WRAP_BIND_FLAG$1;
  2163. if (partials.length) {
  2164. var holders = replaceHolders(partials, getHolder(bind));
  2165. bitmask |= WRAP_PARTIAL_FLAG$3;
  2166. }
  2167. return createWrap(func, bitmask, thisArg, partials, holders);
  2168. });
  2169. bind.placeholder = {};
  2170. var bindAll = flatRest(function(object, methodNames) {
  2171. arrayEach(methodNames, function(key) {
  2172. key = toKey(key);
  2173. baseAssignValue(object, key, bind(object[key], object));
  2174. });
  2175. return object;
  2176. });
  2177. var WRAP_BIND_FLAG = 1;
  2178. var WRAP_BIND_KEY_FLAG$1 = 2;
  2179. var WRAP_PARTIAL_FLAG$2 = 32;
  2180. var bindKey = baseRest(function(object, key, partials) {
  2181. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  2182. if (partials.length) {
  2183. var holders = replaceHolders(partials, getHolder(bindKey));
  2184. bitmask |= WRAP_PARTIAL_FLAG$2;
  2185. }
  2186. return createWrap(key, bitmask, object, partials, holders);
  2187. });
  2188. bindKey.placeholder = {};
  2189. function baseSlice(array, start, end) {
  2190. var index = -1, length = array.length;
  2191. if (start < 0) {
  2192. start = -start > length ? 0 : length + start;
  2193. }
  2194. end = end > length ? length : end;
  2195. if (end < 0) {
  2196. end += length;
  2197. }
  2198. length = start > end ? 0 : end - start >>> 0;
  2199. start >>>= 0;
  2200. var result = Array(length);
  2201. while (++index < length) {
  2202. result[index] = array[index + start];
  2203. }
  2204. return result;
  2205. }
  2206. function castSlice(array, start, end) {
  2207. var length = array.length;
  2208. end = end === void 0 ? length : end;
  2209. return !start && end >= length ? array : baseSlice(array, start, end);
  2210. }
  2211. var rsAstralRange$3 = "\\ud800-\\udfff";
  2212. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  2213. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  2214. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  2215. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  2216. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  2217. var rsZWJ$3 = "\\u200d";
  2218. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  2219. function hasUnicode(string) {
  2220. return reHasUnicode.test(string);
  2221. }
  2222. function asciiToArray(string) {
  2223. return string.split("");
  2224. }
  2225. var rsAstralRange$2 = "\\ud800-\\udfff";
  2226. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  2227. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  2228. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  2229. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  2230. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  2231. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  2232. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  2233. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  2234. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  2235. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  2236. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2237. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2238. var rsZWJ$2 = "\\u200d";
  2239. var reOptMod$2 = rsModifier$2 + "?";
  2240. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  2241. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  2242. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  2243. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  2244. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  2245. function unicodeToArray(string) {
  2246. return string.match(reUnicode$1) || [];
  2247. }
  2248. function stringToArray(string) {
  2249. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  2250. }
  2251. function createCaseFirst(methodName) {
  2252. return function(string) {
  2253. string = toString(string);
  2254. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  2255. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  2256. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  2257. return chr[methodName]() + trailing;
  2258. };
  2259. }
  2260. var upperFirst = createCaseFirst("toUpperCase");
  2261. function capitalize$1(string) {
  2262. return upperFirst(toString(string).toLowerCase());
  2263. }
  2264. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2265. var index = -1, length = array == null ? 0 : array.length;
  2266. if (initAccum && length) {
  2267. accumulator = array[++index];
  2268. }
  2269. while (++index < length) {
  2270. accumulator = iteratee(accumulator, array[index], index, array);
  2271. }
  2272. return accumulator;
  2273. }
  2274. function basePropertyOf(object) {
  2275. return function(key) {
  2276. return object == null ? void 0 : object[key];
  2277. };
  2278. }
  2279. var deburredLetters = {
  2280. "\xC0": "A",
  2281. "\xC1": "A",
  2282. "\xC2": "A",
  2283. "\xC3": "A",
  2284. "\xC4": "A",
  2285. "\xC5": "A",
  2286. "\xE0": "a",
  2287. "\xE1": "a",
  2288. "\xE2": "a",
  2289. "\xE3": "a",
  2290. "\xE4": "a",
  2291. "\xE5": "a",
  2292. "\xC7": "C",
  2293. "\xE7": "c",
  2294. "\xD0": "D",
  2295. "\xF0": "d",
  2296. "\xC8": "E",
  2297. "\xC9": "E",
  2298. "\xCA": "E",
  2299. "\xCB": "E",
  2300. "\xE8": "e",
  2301. "\xE9": "e",
  2302. "\xEA": "e",
  2303. "\xEB": "e",
  2304. "\xCC": "I",
  2305. "\xCD": "I",
  2306. "\xCE": "I",
  2307. "\xCF": "I",
  2308. "\xEC": "i",
  2309. "\xED": "i",
  2310. "\xEE": "i",
  2311. "\xEF": "i",
  2312. "\xD1": "N",
  2313. "\xF1": "n",
  2314. "\xD2": "O",
  2315. "\xD3": "O",
  2316. "\xD4": "O",
  2317. "\xD5": "O",
  2318. "\xD6": "O",
  2319. "\xD8": "O",
  2320. "\xF2": "o",
  2321. "\xF3": "o",
  2322. "\xF4": "o",
  2323. "\xF5": "o",
  2324. "\xF6": "o",
  2325. "\xF8": "o",
  2326. "\xD9": "U",
  2327. "\xDA": "U",
  2328. "\xDB": "U",
  2329. "\xDC": "U",
  2330. "\xF9": "u",
  2331. "\xFA": "u",
  2332. "\xFB": "u",
  2333. "\xFC": "u",
  2334. "\xDD": "Y",
  2335. "\xFD": "y",
  2336. "\xFF": "y",
  2337. "\xC6": "Ae",
  2338. "\xE6": "ae",
  2339. "\xDE": "Th",
  2340. "\xFE": "th",
  2341. "\xDF": "ss",
  2342. "\u0100": "A",
  2343. "\u0102": "A",
  2344. "\u0104": "A",
  2345. "\u0101": "a",
  2346. "\u0103": "a",
  2347. "\u0105": "a",
  2348. "\u0106": "C",
  2349. "\u0108": "C",
  2350. "\u010A": "C",
  2351. "\u010C": "C",
  2352. "\u0107": "c",
  2353. "\u0109": "c",
  2354. "\u010B": "c",
  2355. "\u010D": "c",
  2356. "\u010E": "D",
  2357. "\u0110": "D",
  2358. "\u010F": "d",
  2359. "\u0111": "d",
  2360. "\u0112": "E",
  2361. "\u0114": "E",
  2362. "\u0116": "E",
  2363. "\u0118": "E",
  2364. "\u011A": "E",
  2365. "\u0113": "e",
  2366. "\u0115": "e",
  2367. "\u0117": "e",
  2368. "\u0119": "e",
  2369. "\u011B": "e",
  2370. "\u011C": "G",
  2371. "\u011E": "G",
  2372. "\u0120": "G",
  2373. "\u0122": "G",
  2374. "\u011D": "g",
  2375. "\u011F": "g",
  2376. "\u0121": "g",
  2377. "\u0123": "g",
  2378. "\u0124": "H",
  2379. "\u0126": "H",
  2380. "\u0125": "h",
  2381. "\u0127": "h",
  2382. "\u0128": "I",
  2383. "\u012A": "I",
  2384. "\u012C": "I",
  2385. "\u012E": "I",
  2386. "\u0130": "I",
  2387. "\u0129": "i",
  2388. "\u012B": "i",
  2389. "\u012D": "i",
  2390. "\u012F": "i",
  2391. "\u0131": "i",
  2392. "\u0134": "J",
  2393. "\u0135": "j",
  2394. "\u0136": "K",
  2395. "\u0137": "k",
  2396. "\u0138": "k",
  2397. "\u0139": "L",
  2398. "\u013B": "L",
  2399. "\u013D": "L",
  2400. "\u013F": "L",
  2401. "\u0141": "L",
  2402. "\u013A": "l",
  2403. "\u013C": "l",
  2404. "\u013E": "l",
  2405. "\u0140": "l",
  2406. "\u0142": "l",
  2407. "\u0143": "N",
  2408. "\u0145": "N",
  2409. "\u0147": "N",
  2410. "\u014A": "N",
  2411. "\u0144": "n",
  2412. "\u0146": "n",
  2413. "\u0148": "n",
  2414. "\u014B": "n",
  2415. "\u014C": "O",
  2416. "\u014E": "O",
  2417. "\u0150": "O",
  2418. "\u014D": "o",
  2419. "\u014F": "o",
  2420. "\u0151": "o",
  2421. "\u0154": "R",
  2422. "\u0156": "R",
  2423. "\u0158": "R",
  2424. "\u0155": "r",
  2425. "\u0157": "r",
  2426. "\u0159": "r",
  2427. "\u015A": "S",
  2428. "\u015C": "S",
  2429. "\u015E": "S",
  2430. "\u0160": "S",
  2431. "\u015B": "s",
  2432. "\u015D": "s",
  2433. "\u015F": "s",
  2434. "\u0161": "s",
  2435. "\u0162": "T",
  2436. "\u0164": "T",
  2437. "\u0166": "T",
  2438. "\u0163": "t",
  2439. "\u0165": "t",
  2440. "\u0167": "t",
  2441. "\u0168": "U",
  2442. "\u016A": "U",
  2443. "\u016C": "U",
  2444. "\u016E": "U",
  2445. "\u0170": "U",
  2446. "\u0172": "U",
  2447. "\u0169": "u",
  2448. "\u016B": "u",
  2449. "\u016D": "u",
  2450. "\u016F": "u",
  2451. "\u0171": "u",
  2452. "\u0173": "u",
  2453. "\u0174": "W",
  2454. "\u0175": "w",
  2455. "\u0176": "Y",
  2456. "\u0177": "y",
  2457. "\u0178": "Y",
  2458. "\u0179": "Z",
  2459. "\u017B": "Z",
  2460. "\u017D": "Z",
  2461. "\u017A": "z",
  2462. "\u017C": "z",
  2463. "\u017E": "z",
  2464. "\u0132": "IJ",
  2465. "\u0133": "ij",
  2466. "\u0152": "Oe",
  2467. "\u0153": "oe",
  2468. "\u0149": "'n",
  2469. "\u017F": "s"
  2470. };
  2471. var deburrLetter = basePropertyOf(deburredLetters);
  2472. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  2473. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  2474. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  2475. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  2476. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  2477. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  2478. var reComboMark = RegExp(rsCombo$2, "g");
  2479. function deburr(string) {
  2480. string = toString(string);
  2481. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  2482. }
  2483. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  2484. function asciiWords(string) {
  2485. return string.match(reAsciiWord) || [];
  2486. }
  2487. 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 ]/;
  2488. function hasUnicodeWord(string) {
  2489. return reHasUnicodeWord.test(string);
  2490. }
  2491. var rsAstralRange$1 = "\\ud800-\\udfff";
  2492. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  2493. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  2494. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  2495. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  2496. var rsDingbatRange = "\\u2700-\\u27bf";
  2497. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  2498. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  2499. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  2500. var rsPunctuationRange = "\\u2000-\\u206f";
  2501. 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";
  2502. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  2503. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  2504. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  2505. var rsApos$1 = "['\u2019]";
  2506. var rsBreak = "[" + rsBreakRange + "]";
  2507. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  2508. var rsDigits = "\\d+";
  2509. var rsDingbat = "[" + rsDingbatRange + "]";
  2510. var rsLower = "[" + rsLowerRange + "]";
  2511. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  2512. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  2513. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  2514. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  2515. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2516. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2517. var rsUpper = "[" + rsUpperRange + "]";
  2518. var rsZWJ$1 = "\\u200d";
  2519. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  2520. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  2521. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  2522. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  2523. var reOptMod$1 = rsModifier$1 + "?";
  2524. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  2525. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  2526. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  2527. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  2528. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  2529. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  2530. var reUnicodeWord = RegExp([
  2531. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  2532. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  2533. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  2534. rsUpper + "+" + rsOptContrUpper,
  2535. rsOrdUpper,
  2536. rsOrdLower,
  2537. rsDigits,
  2538. rsEmoji
  2539. ].join("|"), "g");
  2540. function unicodeWords(string) {
  2541. return string.match(reUnicodeWord) || [];
  2542. }
  2543. function words(string, pattern, guard) {
  2544. string = toString(string);
  2545. pattern = guard ? void 0 : pattern;
  2546. if (pattern === void 0) {
  2547. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  2548. }
  2549. return string.match(pattern) || [];
  2550. }
  2551. var rsApos = "['\u2019]";
  2552. var reApos = RegExp(rsApos, "g");
  2553. function createCompounder(callback) {
  2554. return function(string) {
  2555. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  2556. };
  2557. }
  2558. var camelCase = createCompounder(function(result, word, index) {
  2559. word = word.toLowerCase();
  2560. return result + (index ? capitalize$1(word) : word);
  2561. });
  2562. function castArray$1() {
  2563. if (!arguments.length) {
  2564. return [];
  2565. }
  2566. var value = arguments[0];
  2567. return isArray(value) ? value : [value];
  2568. }
  2569. var nativeIsFinite$1 = root.isFinite;
  2570. var nativeMin$c = Math.min;
  2571. function createRound(methodName) {
  2572. var func = Math[methodName];
  2573. return function(number, precision) {
  2574. number = toNumber(number);
  2575. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  2576. if (precision && nativeIsFinite$1(number)) {
  2577. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  2578. pair = (toString(value) + "e").split("e");
  2579. return +(pair[0] + "e" + (+pair[1] - precision));
  2580. }
  2581. return func(number);
  2582. };
  2583. }
  2584. var ceil = createRound("ceil");
  2585. function chain(value) {
  2586. var result = lodash(value);
  2587. result.__chain__ = true;
  2588. return result;
  2589. }
  2590. var nativeCeil$3 = Math.ceil;
  2591. var nativeMax$c = Math.max;
  2592. function chunk(array, size, guard) {
  2593. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  2594. size = 1;
  2595. } else {
  2596. size = nativeMax$c(toInteger(size), 0);
  2597. }
  2598. var length = array == null ? 0 : array.length;
  2599. if (!length || size < 1) {
  2600. return [];
  2601. }
  2602. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  2603. while (index < length) {
  2604. result[resIndex++] = baseSlice(array, index, index += size);
  2605. }
  2606. return result;
  2607. }
  2608. function baseClamp(number, lower, upper) {
  2609. if (number === number) {
  2610. if (upper !== void 0) {
  2611. number = number <= upper ? number : upper;
  2612. }
  2613. if (lower !== void 0) {
  2614. number = number >= lower ? number : lower;
  2615. }
  2616. }
  2617. return number;
  2618. }
  2619. function clamp(number, lower, upper) {
  2620. if (upper === void 0) {
  2621. upper = lower;
  2622. lower = void 0;
  2623. }
  2624. if (upper !== void 0) {
  2625. upper = toNumber(upper);
  2626. upper = upper === upper ? upper : 0;
  2627. }
  2628. if (lower !== void 0) {
  2629. lower = toNumber(lower);
  2630. lower = lower === lower ? lower : 0;
  2631. }
  2632. return baseClamp(toNumber(number), lower, upper);
  2633. }
  2634. function stackClear() {
  2635. this.__data__ = new ListCache();
  2636. this.size = 0;
  2637. }
  2638. function stackDelete(key) {
  2639. var data = this.__data__, result = data["delete"](key);
  2640. this.size = data.size;
  2641. return result;
  2642. }
  2643. function stackGet(key) {
  2644. return this.__data__.get(key);
  2645. }
  2646. function stackHas(key) {
  2647. return this.__data__.has(key);
  2648. }
  2649. var LARGE_ARRAY_SIZE$2 = 200;
  2650. function stackSet(key, value) {
  2651. var data = this.__data__;
  2652. if (data instanceof ListCache) {
  2653. var pairs = data.__data__;
  2654. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  2655. pairs.push([key, value]);
  2656. this.size = ++data.size;
  2657. return this;
  2658. }
  2659. data = this.__data__ = new MapCache(pairs);
  2660. }
  2661. data.set(key, value);
  2662. this.size = data.size;
  2663. return this;
  2664. }
  2665. function Stack(entries) {
  2666. var data = this.__data__ = new ListCache(entries);
  2667. this.size = data.size;
  2668. }
  2669. Stack.prototype.clear = stackClear;
  2670. Stack.prototype["delete"] = stackDelete;
  2671. Stack.prototype.get = stackGet;
  2672. Stack.prototype.has = stackHas;
  2673. Stack.prototype.set = stackSet;
  2674. function baseAssign(object, source) {
  2675. return object && copyObject(source, keys(source), object);
  2676. }
  2677. function baseAssignIn(object, source) {
  2678. return object && copyObject(source, keysIn(source), object);
  2679. }
  2680. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  2681. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  2682. var moduleExports = freeModule && freeModule.exports === freeExports;
  2683. var Buffer = moduleExports ? root.Buffer : void 0;
  2684. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  2685. function cloneBuffer(buffer, isDeep) {
  2686. if (isDeep) {
  2687. return buffer.slice();
  2688. }
  2689. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  2690. buffer.copy(result);
  2691. return result;
  2692. }
  2693. function arrayFilter(array, predicate) {
  2694. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2695. while (++index < length) {
  2696. var value = array[index];
  2697. if (predicate(value, index, array)) {
  2698. result[resIndex++] = value;
  2699. }
  2700. }
  2701. return result;
  2702. }
  2703. function stubArray() {
  2704. return [];
  2705. }
  2706. var objectProto$d = Object.prototype;
  2707. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  2708. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  2709. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  2710. if (object == null) {
  2711. return [];
  2712. }
  2713. object = Object(object);
  2714. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  2715. return propertyIsEnumerable.call(object, symbol);
  2716. });
  2717. };
  2718. function copySymbols(source, object) {
  2719. return copyObject(source, getSymbols(source), object);
  2720. }
  2721. var nativeGetSymbols = Object.getOwnPropertySymbols;
  2722. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  2723. var result = [];
  2724. while (object) {
  2725. arrayPush(result, getSymbols(object));
  2726. object = getPrototype(object);
  2727. }
  2728. return result;
  2729. };
  2730. function copySymbolsIn(source, object) {
  2731. return copyObject(source, getSymbolsIn(source), object);
  2732. }
  2733. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2734. var result = keysFunc(object);
  2735. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2736. }
  2737. function getAllKeys(object) {
  2738. return baseGetAllKeys(object, keys, getSymbols);
  2739. }
  2740. function getAllKeysIn(object) {
  2741. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  2742. }
  2743. var DataView = getNative(root, "DataView");
  2744. var Promise$1 = getNative(root, "Promise");
  2745. var Set$1 = getNative(root, "Set");
  2746. var mapTag$8 = "[object Map]";
  2747. var objectTag$2 = "[object Object]";
  2748. var promiseTag = "[object Promise]";
  2749. var setTag$8 = "[object Set]";
  2750. var weakMapTag$2 = "[object WeakMap]";
  2751. var dataViewTag$3 = "[object DataView]";
  2752. var dataViewCtorString = toSource(DataView);
  2753. var mapCtorString = toSource(Map$1);
  2754. var promiseCtorString = toSource(Promise$1);
  2755. var setCtorString = toSource(Set$1);
  2756. var weakMapCtorString = toSource(WeakMap);
  2757. var getTag = baseGetTag;
  2758. 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) {
  2759. getTag = function(value) {
  2760. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2761. if (ctorString) {
  2762. switch (ctorString) {
  2763. case dataViewCtorString:
  2764. return dataViewTag$3;
  2765. case mapCtorString:
  2766. return mapTag$8;
  2767. case promiseCtorString:
  2768. return promiseTag;
  2769. case setCtorString:
  2770. return setTag$8;
  2771. case weakMapCtorString:
  2772. return weakMapTag$2;
  2773. }
  2774. }
  2775. return result;
  2776. };
  2777. }
  2778. var getTag$1 = getTag;
  2779. var objectProto$c = Object.prototype;
  2780. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  2781. function initCloneArray(array) {
  2782. var length = array.length, result = new array.constructor(length);
  2783. if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) {
  2784. result.index = array.index;
  2785. result.input = array.input;
  2786. }
  2787. return result;
  2788. }
  2789. var Uint8Array = root.Uint8Array;
  2790. function cloneArrayBuffer(arrayBuffer) {
  2791. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2792. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2793. return result;
  2794. }
  2795. function cloneDataView(dataView, isDeep) {
  2796. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2797. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2798. }
  2799. var reFlags$1 = /\w*$/;
  2800. function cloneRegExp(regexp) {
  2801. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  2802. result.lastIndex = regexp.lastIndex;
  2803. return result;
  2804. }
  2805. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  2806. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2807. function cloneSymbol(symbol) {
  2808. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2809. }
  2810. function cloneTypedArray(typedArray, isDeep) {
  2811. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2812. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2813. }
  2814. var boolTag$3 = "[object Boolean]";
  2815. var dateTag$3 = "[object Date]";
  2816. var mapTag$7 = "[object Map]";
  2817. var numberTag$3 = "[object Number]";
  2818. var regexpTag$3 = "[object RegExp]";
  2819. var setTag$7 = "[object Set]";
  2820. var stringTag$3 = "[object String]";
  2821. var symbolTag$2 = "[object Symbol]";
  2822. var arrayBufferTag$3 = "[object ArrayBuffer]";
  2823. var dataViewTag$2 = "[object DataView]";
  2824. var float32Tag$1 = "[object Float32Array]";
  2825. var float64Tag$1 = "[object Float64Array]";
  2826. var int8Tag$1 = "[object Int8Array]";
  2827. var int16Tag$1 = "[object Int16Array]";
  2828. var int32Tag$1 = "[object Int32Array]";
  2829. var uint8Tag$1 = "[object Uint8Array]";
  2830. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  2831. var uint16Tag$1 = "[object Uint16Array]";
  2832. var uint32Tag$1 = "[object Uint32Array]";
  2833. function initCloneByTag(object, tag, isDeep) {
  2834. var Ctor = object.constructor;
  2835. switch (tag) {
  2836. case arrayBufferTag$3:
  2837. return cloneArrayBuffer(object);
  2838. case boolTag$3:
  2839. case dateTag$3:
  2840. return new Ctor(+object);
  2841. case dataViewTag$2:
  2842. return cloneDataView(object, isDeep);
  2843. case float32Tag$1:
  2844. case float64Tag$1:
  2845. case int8Tag$1:
  2846. case int16Tag$1:
  2847. case int32Tag$1:
  2848. case uint8Tag$1:
  2849. case uint8ClampedTag$1:
  2850. case uint16Tag$1:
  2851. case uint32Tag$1:
  2852. return cloneTypedArray(object, isDeep);
  2853. case mapTag$7:
  2854. return new Ctor();
  2855. case numberTag$3:
  2856. case stringTag$3:
  2857. return new Ctor(object);
  2858. case regexpTag$3:
  2859. return cloneRegExp(object);
  2860. case setTag$7:
  2861. return new Ctor();
  2862. case symbolTag$2:
  2863. return cloneSymbol(object);
  2864. }
  2865. }
  2866. function initCloneObject(object) {
  2867. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2868. }
  2869. var mapTag$6 = "[object Map]";
  2870. function baseIsMap(value) {
  2871. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  2872. }
  2873. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2874. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2875. var setTag$6 = "[object Set]";
  2876. function baseIsSet(value) {
  2877. return isObjectLike(value) && getTag$1(value) == setTag$6;
  2878. }
  2879. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2880. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2881. var CLONE_DEEP_FLAG$7 = 1;
  2882. var CLONE_FLAT_FLAG$1 = 2;
  2883. var CLONE_SYMBOLS_FLAG$5 = 4;
  2884. var argsTag$1 = "[object Arguments]";
  2885. var arrayTag$1 = "[object Array]";
  2886. var boolTag$2 = "[object Boolean]";
  2887. var dateTag$2 = "[object Date]";
  2888. var errorTag$1 = "[object Error]";
  2889. var funcTag = "[object Function]";
  2890. var genTag = "[object GeneratorFunction]";
  2891. var mapTag$5 = "[object Map]";
  2892. var numberTag$2 = "[object Number]";
  2893. var objectTag$1 = "[object Object]";
  2894. var regexpTag$2 = "[object RegExp]";
  2895. var setTag$5 = "[object Set]";
  2896. var stringTag$2 = "[object String]";
  2897. var symbolTag$1 = "[object Symbol]";
  2898. var weakMapTag$1 = "[object WeakMap]";
  2899. var arrayBufferTag$2 = "[object ArrayBuffer]";
  2900. var dataViewTag$1 = "[object DataView]";
  2901. var float32Tag = "[object Float32Array]";
  2902. var float64Tag = "[object Float64Array]";
  2903. var int8Tag = "[object Int8Array]";
  2904. var int16Tag = "[object Int16Array]";
  2905. var int32Tag = "[object Int32Array]";
  2906. var uint8Tag = "[object Uint8Array]";
  2907. var uint8ClampedTag = "[object Uint8ClampedArray]";
  2908. var uint16Tag = "[object Uint16Array]";
  2909. var uint32Tag = "[object Uint32Array]";
  2910. var cloneableTags = {};
  2911. 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;
  2912. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  2913. function baseClone(value, bitmask, customizer, key, object, stack) {
  2914. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  2915. if (customizer) {
  2916. result = object ? customizer(value, key, object, stack) : customizer(value);
  2917. }
  2918. if (result !== void 0) {
  2919. return result;
  2920. }
  2921. if (!isObject(value)) {
  2922. return value;
  2923. }
  2924. var isArr = isArray(value);
  2925. if (isArr) {
  2926. result = initCloneArray(value);
  2927. if (!isDeep) {
  2928. return copyArray(value, result);
  2929. }
  2930. } else {
  2931. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  2932. if (isBuffer(value)) {
  2933. return cloneBuffer(value, isDeep);
  2934. }
  2935. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2936. result = isFlat || isFunc ? {} : initCloneObject(value);
  2937. if (!isDeep) {
  2938. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2939. }
  2940. } else {
  2941. if (!cloneableTags[tag]) {
  2942. return object ? value : {};
  2943. }
  2944. result = initCloneByTag(value, tag, isDeep);
  2945. }
  2946. }
  2947. stack || (stack = new Stack());
  2948. var stacked = stack.get(value);
  2949. if (stacked) {
  2950. return stacked;
  2951. }
  2952. stack.set(value, result);
  2953. if (isSet(value)) {
  2954. value.forEach(function(subValue) {
  2955. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2956. });
  2957. } else if (isMap(value)) {
  2958. value.forEach(function(subValue, key2) {
  2959. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2960. });
  2961. }
  2962. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  2963. var props = isArr ? void 0 : keysFunc(value);
  2964. arrayEach(props || value, function(subValue, key2) {
  2965. if (props) {
  2966. key2 = subValue;
  2967. subValue = value[key2];
  2968. }
  2969. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2970. });
  2971. return result;
  2972. }
  2973. var CLONE_SYMBOLS_FLAG$4 = 4;
  2974. function clone(value) {
  2975. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  2976. }
  2977. var CLONE_DEEP_FLAG$6 = 1;
  2978. var CLONE_SYMBOLS_FLAG$3 = 4;
  2979. function cloneDeep(value) {
  2980. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  2981. }
  2982. var CLONE_DEEP_FLAG$5 = 1;
  2983. var CLONE_SYMBOLS_FLAG$2 = 4;
  2984. function cloneDeepWith(value, customizer) {
  2985. customizer = typeof customizer == "function" ? customizer : void 0;
  2986. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  2987. }
  2988. var CLONE_SYMBOLS_FLAG$1 = 4;
  2989. function cloneWith(value, customizer) {
  2990. customizer = typeof customizer == "function" ? customizer : void 0;
  2991. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  2992. }
  2993. function wrapperCommit() {
  2994. return new LodashWrapper(this.value(), this.__chain__);
  2995. }
  2996. function compact(array) {
  2997. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2998. while (++index < length) {
  2999. var value = array[index];
  3000. if (value) {
  3001. result[resIndex++] = value;
  3002. }
  3003. }
  3004. return result;
  3005. }
  3006. function concat() {
  3007. var length = arguments.length;
  3008. if (!length) {
  3009. return [];
  3010. }
  3011. var args = Array(length - 1), array = arguments[0], index = length;
  3012. while (index--) {
  3013. args[index - 1] = arguments[index];
  3014. }
  3015. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  3016. }
  3017. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  3018. function setCacheAdd(value) {
  3019. this.__data__.set(value, HASH_UNDEFINED);
  3020. return this;
  3021. }
  3022. function setCacheHas(value) {
  3023. return this.__data__.has(value);
  3024. }
  3025. function SetCache(values) {
  3026. var index = -1, length = values == null ? 0 : values.length;
  3027. this.__data__ = new MapCache();
  3028. while (++index < length) {
  3029. this.add(values[index]);
  3030. }
  3031. }
  3032. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3033. SetCache.prototype.has = setCacheHas;
  3034. function arraySome(array, predicate) {
  3035. var index = -1, length = array == null ? 0 : array.length;
  3036. while (++index < length) {
  3037. if (predicate(array[index], index, array)) {
  3038. return true;
  3039. }
  3040. }
  3041. return false;
  3042. }
  3043. function cacheHas(cache, key) {
  3044. return cache.has(key);
  3045. }
  3046. var COMPARE_PARTIAL_FLAG$5 = 1;
  3047. var COMPARE_UNORDERED_FLAG$3 = 2;
  3048. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  3049. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  3050. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  3051. return false;
  3052. }
  3053. var arrStacked = stack.get(array);
  3054. var othStacked = stack.get(other);
  3055. if (arrStacked && othStacked) {
  3056. return arrStacked == other && othStacked == array;
  3057. }
  3058. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  3059. stack.set(array, other);
  3060. stack.set(other, array);
  3061. while (++index < arrLength) {
  3062. var arrValue = array[index], othValue = other[index];
  3063. if (customizer) {
  3064. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  3065. }
  3066. if (compared !== void 0) {
  3067. if (compared) {
  3068. continue;
  3069. }
  3070. result = false;
  3071. break;
  3072. }
  3073. if (seen) {
  3074. if (!arraySome(other, function(othValue2, othIndex) {
  3075. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  3076. return seen.push(othIndex);
  3077. }
  3078. })) {
  3079. result = false;
  3080. break;
  3081. }
  3082. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  3083. result = false;
  3084. break;
  3085. }
  3086. }
  3087. stack["delete"](array);
  3088. stack["delete"](other);
  3089. return result;
  3090. }
  3091. function mapToArray(map) {
  3092. var index = -1, result = Array(map.size);
  3093. map.forEach(function(value, key) {
  3094. result[++index] = [key, value];
  3095. });
  3096. return result;
  3097. }
  3098. function setToArray(set) {
  3099. var index = -1, result = Array(set.size);
  3100. set.forEach(function(value) {
  3101. result[++index] = value;
  3102. });
  3103. return result;
  3104. }
  3105. var COMPARE_PARTIAL_FLAG$4 = 1;
  3106. var COMPARE_UNORDERED_FLAG$2 = 2;
  3107. var boolTag$1 = "[object Boolean]";
  3108. var dateTag$1 = "[object Date]";
  3109. var errorTag = "[object Error]";
  3110. var mapTag$4 = "[object Map]";
  3111. var numberTag$1 = "[object Number]";
  3112. var regexpTag$1 = "[object RegExp]";
  3113. var setTag$4 = "[object Set]";
  3114. var stringTag$1 = "[object String]";
  3115. var symbolTag = "[object Symbol]";
  3116. var arrayBufferTag$1 = "[object ArrayBuffer]";
  3117. var dataViewTag = "[object DataView]";
  3118. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  3119. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  3120. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  3121. switch (tag) {
  3122. case dataViewTag:
  3123. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  3124. return false;
  3125. }
  3126. object = object.buffer;
  3127. other = other.buffer;
  3128. case arrayBufferTag$1:
  3129. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  3130. return false;
  3131. }
  3132. return true;
  3133. case boolTag$1:
  3134. case dateTag$1:
  3135. case numberTag$1:
  3136. return eq(+object, +other);
  3137. case errorTag:
  3138. return object.name == other.name && object.message == other.message;
  3139. case regexpTag$1:
  3140. case stringTag$1:
  3141. return object == other + "";
  3142. case mapTag$4:
  3143. var convert = mapToArray;
  3144. case setTag$4:
  3145. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  3146. convert || (convert = setToArray);
  3147. if (object.size != other.size && !isPartial) {
  3148. return false;
  3149. }
  3150. var stacked = stack.get(object);
  3151. if (stacked) {
  3152. return stacked == other;
  3153. }
  3154. bitmask |= COMPARE_UNORDERED_FLAG$2;
  3155. stack.set(object, other);
  3156. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  3157. stack["delete"](object);
  3158. return result;
  3159. case symbolTag:
  3160. if (symbolValueOf) {
  3161. return symbolValueOf.call(object) == symbolValueOf.call(other);
  3162. }
  3163. }
  3164. return false;
  3165. }
  3166. var COMPARE_PARTIAL_FLAG$3 = 1;
  3167. var objectProto$b = Object.prototype;
  3168. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  3169. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  3170. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  3171. if (objLength != othLength && !isPartial) {
  3172. return false;
  3173. }
  3174. var index = objLength;
  3175. while (index--) {
  3176. var key = objProps[index];
  3177. if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
  3178. return false;
  3179. }
  3180. }
  3181. var objStacked = stack.get(object);
  3182. var othStacked = stack.get(other);
  3183. if (objStacked && othStacked) {
  3184. return objStacked == other && othStacked == object;
  3185. }
  3186. var result = true;
  3187. stack.set(object, other);
  3188. stack.set(other, object);
  3189. var skipCtor = isPartial;
  3190. while (++index < objLength) {
  3191. key = objProps[index];
  3192. var objValue = object[key], othValue = other[key];
  3193. if (customizer) {
  3194. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  3195. }
  3196. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  3197. result = false;
  3198. break;
  3199. }
  3200. skipCtor || (skipCtor = key == "constructor");
  3201. }
  3202. if (result && !skipCtor) {
  3203. var objCtor = object.constructor, othCtor = other.constructor;
  3204. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  3205. result = false;
  3206. }
  3207. }
  3208. stack["delete"](object);
  3209. stack["delete"](other);
  3210. return result;
  3211. }
  3212. var COMPARE_PARTIAL_FLAG$2 = 1;
  3213. var argsTag = "[object Arguments]";
  3214. var arrayTag = "[object Array]";
  3215. var objectTag = "[object Object]";
  3216. var objectProto$a = Object.prototype;
  3217. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  3218. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3219. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  3220. objTag = objTag == argsTag ? objectTag : objTag;
  3221. othTag = othTag == argsTag ? objectTag : othTag;
  3222. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  3223. if (isSameTag && isBuffer(object)) {
  3224. if (!isBuffer(other)) {
  3225. return false;
  3226. }
  3227. objIsArr = true;
  3228. objIsObj = false;
  3229. }
  3230. if (isSameTag && !objIsObj) {
  3231. stack || (stack = new Stack());
  3232. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3233. }
  3234. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  3235. var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__");
  3236. if (objIsWrapped || othIsWrapped) {
  3237. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  3238. stack || (stack = new Stack());
  3239. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3240. }
  3241. }
  3242. if (!isSameTag) {
  3243. return false;
  3244. }
  3245. stack || (stack = new Stack());
  3246. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3247. }
  3248. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3249. if (value === other) {
  3250. return true;
  3251. }
  3252. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  3253. return value !== value && other !== other;
  3254. }
  3255. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3256. }
  3257. var COMPARE_PARTIAL_FLAG$1 = 1;
  3258. var COMPARE_UNORDERED_FLAG$1 = 2;
  3259. function baseIsMatch(object, source, matchData, customizer) {
  3260. var index = matchData.length, length = index, noCustomizer = !customizer;
  3261. if (object == null) {
  3262. return !length;
  3263. }
  3264. object = Object(object);
  3265. while (index--) {
  3266. var data = matchData[index];
  3267. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  3268. return false;
  3269. }
  3270. }
  3271. while (++index < length) {
  3272. data = matchData[index];
  3273. var key = data[0], objValue = object[key], srcValue = data[1];
  3274. if (noCustomizer && data[2]) {
  3275. if (objValue === void 0 && !(key in object)) {
  3276. return false;
  3277. }
  3278. } else {
  3279. var stack = new Stack();
  3280. if (customizer) {
  3281. var result = customizer(objValue, srcValue, key, object, source, stack);
  3282. }
  3283. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  3284. return false;
  3285. }
  3286. }
  3287. }
  3288. return true;
  3289. }
  3290. function isStrictComparable(value) {
  3291. return value === value && !isObject(value);
  3292. }
  3293. function getMatchData(object) {
  3294. var result = keys(object), length = result.length;
  3295. while (length--) {
  3296. var key = result[length], value = object[key];
  3297. result[length] = [key, value, isStrictComparable(value)];
  3298. }
  3299. return result;
  3300. }
  3301. function matchesStrictComparable(key, srcValue) {
  3302. return function(object) {
  3303. if (object == null) {
  3304. return false;
  3305. }
  3306. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  3307. };
  3308. }
  3309. function baseMatches(source) {
  3310. var matchData = getMatchData(source);
  3311. if (matchData.length == 1 && matchData[0][2]) {
  3312. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3313. }
  3314. return function(object) {
  3315. return object === source || baseIsMatch(object, source, matchData);
  3316. };
  3317. }
  3318. function baseHasIn(object, key) {
  3319. return object != null && key in Object(object);
  3320. }
  3321. function hasPath(object, path, hasFunc) {
  3322. path = castPath(path, object);
  3323. var index = -1, length = path.length, result = false;
  3324. while (++index < length) {
  3325. var key = toKey(path[index]);
  3326. if (!(result = object != null && hasFunc(object, key))) {
  3327. break;
  3328. }
  3329. object = object[key];
  3330. }
  3331. if (result || ++index != length) {
  3332. return result;
  3333. }
  3334. length = object == null ? 0 : object.length;
  3335. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  3336. }
  3337. function hasIn(object, path) {
  3338. return object != null && hasPath(object, path, baseHasIn);
  3339. }
  3340. var COMPARE_PARTIAL_FLAG = 1;
  3341. var COMPARE_UNORDERED_FLAG = 2;
  3342. function baseMatchesProperty(path, srcValue) {
  3343. if (isKey(path) && isStrictComparable(srcValue)) {
  3344. return matchesStrictComparable(toKey(path), srcValue);
  3345. }
  3346. return function(object) {
  3347. var objValue = get(object, path);
  3348. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3349. };
  3350. }
  3351. function baseProperty(key) {
  3352. return function(object) {
  3353. return object == null ? void 0 : object[key];
  3354. };
  3355. }
  3356. function basePropertyDeep(path) {
  3357. return function(object) {
  3358. return baseGet(object, path);
  3359. };
  3360. }
  3361. function property(path) {
  3362. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3363. }
  3364. function baseIteratee(value) {
  3365. if (typeof value == "function") {
  3366. return value;
  3367. }
  3368. if (value == null) {
  3369. return identity;
  3370. }
  3371. if (typeof value == "object") {
  3372. return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  3373. }
  3374. return property(value);
  3375. }
  3376. var FUNC_ERROR_TEXT$7 = "Expected a function";
  3377. function cond(pairs) {
  3378. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  3379. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  3380. if (typeof pair[1] != "function") {
  3381. throw new TypeError(FUNC_ERROR_TEXT$7);
  3382. }
  3383. return [toIteratee(pair[0]), pair[1]];
  3384. });
  3385. return baseRest(function(args) {
  3386. var index = -1;
  3387. while (++index < length) {
  3388. var pair = pairs[index];
  3389. if (apply(pair[0], this, args)) {
  3390. return apply(pair[1], this, args);
  3391. }
  3392. }
  3393. });
  3394. }
  3395. function baseConformsTo(object, source, props) {
  3396. var length = props.length;
  3397. if (object == null) {
  3398. return !length;
  3399. }
  3400. object = Object(object);
  3401. while (length--) {
  3402. var key = props[length], predicate = source[key], value = object[key];
  3403. if (value === void 0 && !(key in object) || !predicate(value)) {
  3404. return false;
  3405. }
  3406. }
  3407. return true;
  3408. }
  3409. function baseConforms(source) {
  3410. var props = keys(source);
  3411. return function(object) {
  3412. return baseConformsTo(object, source, props);
  3413. };
  3414. }
  3415. var CLONE_DEEP_FLAG$4 = 1;
  3416. function conforms(source) {
  3417. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  3418. }
  3419. function conformsTo(object, source) {
  3420. return source == null || baseConformsTo(object, source, keys(source));
  3421. }
  3422. function arrayAggregator(array, setter, iteratee, accumulator) {
  3423. var index = -1, length = array == null ? 0 : array.length;
  3424. while (++index < length) {
  3425. var value = array[index];
  3426. setter(accumulator, value, iteratee(value), array);
  3427. }
  3428. return accumulator;
  3429. }
  3430. function createBaseFor(fromRight) {
  3431. return function(object, iteratee, keysFunc) {
  3432. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  3433. while (length--) {
  3434. var key = props[fromRight ? length : ++index];
  3435. if (iteratee(iterable[key], key, iterable) === false) {
  3436. break;
  3437. }
  3438. }
  3439. return object;
  3440. };
  3441. }
  3442. var baseFor = createBaseFor();
  3443. function baseForOwn(object, iteratee) {
  3444. return object && baseFor(object, iteratee, keys);
  3445. }
  3446. function createBaseEach(eachFunc, fromRight) {
  3447. return function(collection, iteratee) {
  3448. if (collection == null) {
  3449. return collection;
  3450. }
  3451. if (!isArrayLike(collection)) {
  3452. return eachFunc(collection, iteratee);
  3453. }
  3454. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  3455. while (fromRight ? index-- : ++index < length) {
  3456. if (iteratee(iterable[index], index, iterable) === false) {
  3457. break;
  3458. }
  3459. }
  3460. return collection;
  3461. };
  3462. }
  3463. var baseEach = createBaseEach(baseForOwn);
  3464. function baseAggregator(collection, setter, iteratee, accumulator) {
  3465. baseEach(collection, function(value, key, collection2) {
  3466. setter(accumulator, value, iteratee(value), collection2);
  3467. });
  3468. return accumulator;
  3469. }
  3470. function createAggregator(setter, initializer) {
  3471. return function(collection, iteratee) {
  3472. var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  3473. return func(collection, setter, baseIteratee(iteratee), accumulator);
  3474. };
  3475. }
  3476. var objectProto$9 = Object.prototype;
  3477. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  3478. var countBy = createAggregator(function(result, value, key) {
  3479. if (hasOwnProperty$8.call(result, key)) {
  3480. ++result[key];
  3481. } else {
  3482. baseAssignValue(result, key, 1);
  3483. }
  3484. });
  3485. function create(prototype, properties) {
  3486. var result = baseCreate(prototype);
  3487. return properties == null ? result : baseAssign(result, properties);
  3488. }
  3489. var WRAP_CURRY_FLAG$1 = 8;
  3490. function curry(func, arity, guard) {
  3491. arity = guard ? void 0 : arity;
  3492. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  3493. result.placeholder = curry.placeholder;
  3494. return result;
  3495. }
  3496. curry.placeholder = {};
  3497. var WRAP_CURRY_RIGHT_FLAG = 16;
  3498. function curryRight(func, arity, guard) {
  3499. arity = guard ? void 0 : arity;
  3500. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  3501. result.placeholder = curryRight.placeholder;
  3502. return result;
  3503. }
  3504. curryRight.placeholder = {};
  3505. var now = function() {
  3506. return root.Date.now();
  3507. };
  3508. var FUNC_ERROR_TEXT$6 = "Expected a function";
  3509. var nativeMax$b = Math.max;
  3510. var nativeMin$b = Math.min;
  3511. function debounce(func, wait, options) {
  3512. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  3513. if (typeof func != "function") {
  3514. throw new TypeError(FUNC_ERROR_TEXT$6);
  3515. }
  3516. wait = toNumber(wait) || 0;
  3517. if (isObject(options)) {
  3518. leading = !!options.leading;
  3519. maxing = "maxWait" in options;
  3520. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  3521. trailing = "trailing" in options ? !!options.trailing : trailing;
  3522. }
  3523. function invokeFunc(time) {
  3524. var args = lastArgs, thisArg = lastThis;
  3525. lastArgs = lastThis = void 0;
  3526. lastInvokeTime = time;
  3527. result = func.apply(thisArg, args);
  3528. return result;
  3529. }
  3530. function leadingEdge(time) {
  3531. lastInvokeTime = time;
  3532. timerId = setTimeout(timerExpired, wait);
  3533. return leading ? invokeFunc(time) : result;
  3534. }
  3535. function remainingWait(time) {
  3536. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  3537. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  3538. }
  3539. function shouldInvoke(time) {
  3540. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  3541. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  3542. }
  3543. function timerExpired() {
  3544. var time = now();
  3545. if (shouldInvoke(time)) {
  3546. return trailingEdge(time);
  3547. }
  3548. timerId = setTimeout(timerExpired, remainingWait(time));
  3549. }
  3550. function trailingEdge(time) {
  3551. timerId = void 0;
  3552. if (trailing && lastArgs) {
  3553. return invokeFunc(time);
  3554. }
  3555. lastArgs = lastThis = void 0;
  3556. return result;
  3557. }
  3558. function cancel() {
  3559. if (timerId !== void 0) {
  3560. clearTimeout(timerId);
  3561. }
  3562. lastInvokeTime = 0;
  3563. lastArgs = lastCallTime = lastThis = timerId = void 0;
  3564. }
  3565. function flush() {
  3566. return timerId === void 0 ? result : trailingEdge(now());
  3567. }
  3568. function debounced() {
  3569. var time = now(), isInvoking = shouldInvoke(time);
  3570. lastArgs = arguments;
  3571. lastThis = this;
  3572. lastCallTime = time;
  3573. if (isInvoking) {
  3574. if (timerId === void 0) {
  3575. return leadingEdge(lastCallTime);
  3576. }
  3577. if (maxing) {
  3578. clearTimeout(timerId);
  3579. timerId = setTimeout(timerExpired, wait);
  3580. return invokeFunc(lastCallTime);
  3581. }
  3582. }
  3583. if (timerId === void 0) {
  3584. timerId = setTimeout(timerExpired, wait);
  3585. }
  3586. return result;
  3587. }
  3588. debounced.cancel = cancel;
  3589. debounced.flush = flush;
  3590. return debounced;
  3591. }
  3592. function defaultTo(value, defaultValue) {
  3593. return value == null || value !== value ? defaultValue : value;
  3594. }
  3595. var objectProto$8 = Object.prototype;
  3596. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  3597. var defaults = baseRest(function(object, sources) {
  3598. object = Object(object);
  3599. var index = -1;
  3600. var length = sources.length;
  3601. var guard = length > 2 ? sources[2] : void 0;
  3602. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  3603. length = 1;
  3604. }
  3605. while (++index < length) {
  3606. var source = sources[index];
  3607. var props = keysIn(source);
  3608. var propsIndex = -1;
  3609. var propsLength = props.length;
  3610. while (++propsIndex < propsLength) {
  3611. var key = props[propsIndex];
  3612. var value = object[key];
  3613. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) {
  3614. object[key] = source[key];
  3615. }
  3616. }
  3617. }
  3618. return object;
  3619. });
  3620. function assignMergeValue(object, key, value) {
  3621. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  3622. baseAssignValue(object, key, value);
  3623. }
  3624. }
  3625. function isArrayLikeObject(value) {
  3626. return isObjectLike(value) && isArrayLike(value);
  3627. }
  3628. function safeGet(object, key) {
  3629. if (key === "constructor" && typeof object[key] === "function") {
  3630. return;
  3631. }
  3632. if (key == "__proto__") {
  3633. return;
  3634. }
  3635. return object[key];
  3636. }
  3637. function toPlainObject(value) {
  3638. return copyObject(value, keysIn(value));
  3639. }
  3640. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  3641. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  3642. if (stacked) {
  3643. assignMergeValue(object, key, stacked);
  3644. return;
  3645. }
  3646. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  3647. var isCommon = newValue === void 0;
  3648. if (isCommon) {
  3649. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  3650. newValue = srcValue;
  3651. if (isArr || isBuff || isTyped) {
  3652. if (isArray(objValue)) {
  3653. newValue = objValue;
  3654. } else if (isArrayLikeObject(objValue)) {
  3655. newValue = copyArray(objValue);
  3656. } else if (isBuff) {
  3657. isCommon = false;
  3658. newValue = cloneBuffer(srcValue, true);
  3659. } else if (isTyped) {
  3660. isCommon = false;
  3661. newValue = cloneTypedArray(srcValue, true);
  3662. } else {
  3663. newValue = [];
  3664. }
  3665. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  3666. newValue = objValue;
  3667. if (isArguments(objValue)) {
  3668. newValue = toPlainObject(objValue);
  3669. } else if (!isObject(objValue) || isFunction(objValue)) {
  3670. newValue = initCloneObject(srcValue);
  3671. }
  3672. } else {
  3673. isCommon = false;
  3674. }
  3675. }
  3676. if (isCommon) {
  3677. stack.set(srcValue, newValue);
  3678. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  3679. stack["delete"](srcValue);
  3680. }
  3681. assignMergeValue(object, key, newValue);
  3682. }
  3683. function baseMerge(object, source, srcIndex, customizer, stack) {
  3684. if (object === source) {
  3685. return;
  3686. }
  3687. baseFor(source, function(srcValue, key) {
  3688. stack || (stack = new Stack());
  3689. if (isObject(srcValue)) {
  3690. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  3691. } else {
  3692. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  3693. if (newValue === void 0) {
  3694. newValue = srcValue;
  3695. }
  3696. assignMergeValue(object, key, newValue);
  3697. }
  3698. }, keysIn);
  3699. }
  3700. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  3701. if (isObject(objValue) && isObject(srcValue)) {
  3702. stack.set(srcValue, objValue);
  3703. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  3704. stack["delete"](srcValue);
  3705. }
  3706. return objValue;
  3707. }
  3708. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  3709. baseMerge(object, source, srcIndex, customizer);
  3710. });
  3711. var defaultsDeep = baseRest(function(args) {
  3712. args.push(void 0, customDefaultsMerge);
  3713. return apply(mergeWith, void 0, args);
  3714. });
  3715. var FUNC_ERROR_TEXT$5 = "Expected a function";
  3716. function baseDelay(func, wait, args) {
  3717. if (typeof func != "function") {
  3718. throw new TypeError(FUNC_ERROR_TEXT$5);
  3719. }
  3720. return setTimeout(function() {
  3721. func.apply(void 0, args);
  3722. }, wait);
  3723. }
  3724. var defer = baseRest(function(func, args) {
  3725. return baseDelay(func, 1, args);
  3726. });
  3727. var delay = baseRest(function(func, wait, args) {
  3728. return baseDelay(func, toNumber(wait) || 0, args);
  3729. });
  3730. function arrayIncludesWith(array, value, comparator) {
  3731. var index = -1, length = array == null ? 0 : array.length;
  3732. while (++index < length) {
  3733. if (comparator(value, array[index])) {
  3734. return true;
  3735. }
  3736. }
  3737. return false;
  3738. }
  3739. var LARGE_ARRAY_SIZE$1 = 200;
  3740. function baseDifference(array, values, iteratee, comparator) {
  3741. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  3742. if (!length) {
  3743. return result;
  3744. }
  3745. if (iteratee) {
  3746. values = arrayMap(values, baseUnary(iteratee));
  3747. }
  3748. if (comparator) {
  3749. includes = arrayIncludesWith;
  3750. isCommon = false;
  3751. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  3752. includes = cacheHas;
  3753. isCommon = false;
  3754. values = new SetCache(values);
  3755. }
  3756. outer:
  3757. while (++index < length) {
  3758. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  3759. value = comparator || value !== 0 ? value : 0;
  3760. if (isCommon && computed === computed) {
  3761. var valuesIndex = valuesLength;
  3762. while (valuesIndex--) {
  3763. if (values[valuesIndex] === computed) {
  3764. continue outer;
  3765. }
  3766. }
  3767. result.push(value);
  3768. } else if (!includes(values, computed, comparator)) {
  3769. result.push(value);
  3770. }
  3771. }
  3772. return result;
  3773. }
  3774. var difference = baseRest(function(array, values) {
  3775. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  3776. });
  3777. function last(array) {
  3778. var length = array == null ? 0 : array.length;
  3779. return length ? array[length - 1] : void 0;
  3780. }
  3781. var differenceBy = baseRest(function(array, values) {
  3782. var iteratee = last(values);
  3783. if (isArrayLikeObject(iteratee)) {
  3784. iteratee = void 0;
  3785. }
  3786. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  3787. });
  3788. var differenceWith = baseRest(function(array, values) {
  3789. var comparator = last(values);
  3790. if (isArrayLikeObject(comparator)) {
  3791. comparator = void 0;
  3792. }
  3793. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  3794. });
  3795. var divide = createMathOperation(function(dividend, divisor) {
  3796. return dividend / divisor;
  3797. }, 1);
  3798. function drop(array, n, guard) {
  3799. var length = array == null ? 0 : array.length;
  3800. if (!length) {
  3801. return [];
  3802. }
  3803. n = guard || n === void 0 ? 1 : toInteger(n);
  3804. return baseSlice(array, n < 0 ? 0 : n, length);
  3805. }
  3806. function dropRight(array, n, guard) {
  3807. var length = array == null ? 0 : array.length;
  3808. if (!length) {
  3809. return [];
  3810. }
  3811. n = guard || n === void 0 ? 1 : toInteger(n);
  3812. n = length - n;
  3813. return baseSlice(array, 0, n < 0 ? 0 : n);
  3814. }
  3815. function baseWhile(array, predicate, isDrop, fromRight) {
  3816. var length = array.length, index = fromRight ? length : -1;
  3817. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  3818. }
  3819. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  3820. }
  3821. function dropRightWhile(array, predicate) {
  3822. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  3823. }
  3824. function dropWhile(array, predicate) {
  3825. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  3826. }
  3827. function castFunction(value) {
  3828. return typeof value == "function" ? value : identity;
  3829. }
  3830. function forEach(collection, iteratee) {
  3831. var func = isArray(collection) ? arrayEach : baseEach;
  3832. return func(collection, castFunction(iteratee));
  3833. }
  3834. function arrayEachRight(array, iteratee) {
  3835. var length = array == null ? 0 : array.length;
  3836. while (length--) {
  3837. if (iteratee(array[length], length, array) === false) {
  3838. break;
  3839. }
  3840. }
  3841. return array;
  3842. }
  3843. var baseForRight = createBaseFor(true);
  3844. function baseForOwnRight(object, iteratee) {
  3845. return object && baseForRight(object, iteratee, keys);
  3846. }
  3847. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3848. function forEachRight(collection, iteratee) {
  3849. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  3850. return func(collection, castFunction(iteratee));
  3851. }
  3852. function endsWith(string, target, position) {
  3853. string = toString(string);
  3854. target = baseToString(target);
  3855. var length = string.length;
  3856. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  3857. var end = position;
  3858. position -= target.length;
  3859. return position >= 0 && string.slice(position, end) == target;
  3860. }
  3861. function baseToPairs(object, props) {
  3862. return arrayMap(props, function(key) {
  3863. return [key, object[key]];
  3864. });
  3865. }
  3866. function setToPairs(set) {
  3867. var index = -1, result = Array(set.size);
  3868. set.forEach(function(value) {
  3869. result[++index] = [value, value];
  3870. });
  3871. return result;
  3872. }
  3873. var mapTag$3 = "[object Map]";
  3874. var setTag$3 = "[object Set]";
  3875. function createToPairs(keysFunc) {
  3876. return function(object) {
  3877. var tag = getTag$1(object);
  3878. if (tag == mapTag$3) {
  3879. return mapToArray(object);
  3880. }
  3881. if (tag == setTag$3) {
  3882. return setToPairs(object);
  3883. }
  3884. return baseToPairs(object, keysFunc(object));
  3885. };
  3886. }
  3887. var toPairs = createToPairs(keys);
  3888. var toPairsIn = createToPairs(keysIn);
  3889. var htmlEscapes = {
  3890. "&": "&amp;",
  3891. "<": "&lt;",
  3892. ">": "&gt;",
  3893. '"': "&quot;",
  3894. "'": "&#39;"
  3895. };
  3896. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  3897. var reUnescapedHtml = /[&<>"']/g;
  3898. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  3899. function escape(string) {
  3900. string = toString(string);
  3901. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  3902. }
  3903. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3904. var reHasRegExpChar = RegExp(reRegExpChar.source);
  3905. function escapeRegExp(string) {
  3906. string = toString(string);
  3907. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  3908. }
  3909. function arrayEvery(array, predicate) {
  3910. var index = -1, length = array == null ? 0 : array.length;
  3911. while (++index < length) {
  3912. if (!predicate(array[index], index, array)) {
  3913. return false;
  3914. }
  3915. }
  3916. return true;
  3917. }
  3918. function baseEvery(collection, predicate) {
  3919. var result = true;
  3920. baseEach(collection, function(value, index, collection2) {
  3921. result = !!predicate(value, index, collection2);
  3922. return result;
  3923. });
  3924. return result;
  3925. }
  3926. function every(collection, predicate, guard) {
  3927. var func = isArray(collection) ? arrayEvery : baseEvery;
  3928. if (guard && isIterateeCall(collection, predicate, guard)) {
  3929. predicate = void 0;
  3930. }
  3931. return func(collection, baseIteratee(predicate));
  3932. }
  3933. var MAX_ARRAY_LENGTH$5 = 4294967295;
  3934. function toLength(value) {
  3935. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  3936. }
  3937. function baseFill(array, value, start, end) {
  3938. var length = array.length;
  3939. start = toInteger(start);
  3940. if (start < 0) {
  3941. start = -start > length ? 0 : length + start;
  3942. }
  3943. end = end === void 0 || end > length ? length : toInteger(end);
  3944. if (end < 0) {
  3945. end += length;
  3946. }
  3947. end = start > end ? 0 : toLength(end);
  3948. while (start < end) {
  3949. array[start++] = value;
  3950. }
  3951. return array;
  3952. }
  3953. function fill(array, value, start, end) {
  3954. var length = array == null ? 0 : array.length;
  3955. if (!length) {
  3956. return [];
  3957. }
  3958. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  3959. start = 0;
  3960. end = length;
  3961. }
  3962. return baseFill(array, value, start, end);
  3963. }
  3964. function baseFilter(collection, predicate) {
  3965. var result = [];
  3966. baseEach(collection, function(value, index, collection2) {
  3967. if (predicate(value, index, collection2)) {
  3968. result.push(value);
  3969. }
  3970. });
  3971. return result;
  3972. }
  3973. function filter(collection, predicate) {
  3974. var func = isArray(collection) ? arrayFilter : baseFilter;
  3975. return func(collection, baseIteratee(predicate));
  3976. }
  3977. function createFind(findIndexFunc) {
  3978. return function(collection, predicate, fromIndex) {
  3979. var iterable = Object(collection);
  3980. if (!isArrayLike(collection)) {
  3981. var iteratee = baseIteratee(predicate);
  3982. collection = keys(collection);
  3983. predicate = function(key) {
  3984. return iteratee(iterable[key], key, iterable);
  3985. };
  3986. }
  3987. var index = findIndexFunc(collection, predicate, fromIndex);
  3988. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  3989. };
  3990. }
  3991. var nativeMax$a = Math.max;
  3992. function findIndex(array, predicate, fromIndex) {
  3993. var length = array == null ? 0 : array.length;
  3994. if (!length) {
  3995. return -1;
  3996. }
  3997. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3998. if (index < 0) {
  3999. index = nativeMax$a(length + index, 0);
  4000. }
  4001. return baseFindIndex(array, baseIteratee(predicate), index);
  4002. }
  4003. var find = createFind(findIndex);
  4004. function baseFindKey(collection, predicate, eachFunc) {
  4005. var result;
  4006. eachFunc(collection, function(value, key, collection2) {
  4007. if (predicate(value, key, collection2)) {
  4008. result = key;
  4009. return false;
  4010. }
  4011. });
  4012. return result;
  4013. }
  4014. function findKey(object, predicate) {
  4015. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  4016. }
  4017. var nativeMax$9 = Math.max;
  4018. var nativeMin$a = Math.min;
  4019. function findLastIndex(array, predicate, fromIndex) {
  4020. var length = array == null ? 0 : array.length;
  4021. if (!length) {
  4022. return -1;
  4023. }
  4024. var index = length - 1;
  4025. if (fromIndex !== void 0) {
  4026. index = toInteger(fromIndex);
  4027. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  4028. }
  4029. return baseFindIndex(array, baseIteratee(predicate), index, true);
  4030. }
  4031. var findLast = createFind(findLastIndex);
  4032. function findLastKey(object, predicate) {
  4033. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  4034. }
  4035. function head(array) {
  4036. return array && array.length ? array[0] : void 0;
  4037. }
  4038. function baseMap(collection, iteratee) {
  4039. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  4040. baseEach(collection, function(value, key, collection2) {
  4041. result[++index] = iteratee(value, key, collection2);
  4042. });
  4043. return result;
  4044. }
  4045. function map(collection, iteratee) {
  4046. var func = isArray(collection) ? arrayMap : baseMap;
  4047. return func(collection, baseIteratee(iteratee));
  4048. }
  4049. function flatMap(collection, iteratee) {
  4050. return baseFlatten(map(collection, iteratee), 1);
  4051. }
  4052. var INFINITY$2 = 1 / 0;
  4053. function flatMapDeep(collection, iteratee) {
  4054. return baseFlatten(map(collection, iteratee), INFINITY$2);
  4055. }
  4056. function flatMapDepth(collection, iteratee, depth) {
  4057. depth = depth === void 0 ? 1 : toInteger(depth);
  4058. return baseFlatten(map(collection, iteratee), depth);
  4059. }
  4060. var INFINITY$1 = 1 / 0;
  4061. function flattenDeep(array) {
  4062. var length = array == null ? 0 : array.length;
  4063. return length ? baseFlatten(array, INFINITY$1) : [];
  4064. }
  4065. function flattenDepth(array, depth) {
  4066. var length = array == null ? 0 : array.length;
  4067. if (!length) {
  4068. return [];
  4069. }
  4070. depth = depth === void 0 ? 1 : toInteger(depth);
  4071. return baseFlatten(array, depth);
  4072. }
  4073. var WRAP_FLIP_FLAG = 512;
  4074. function flip$1(func) {
  4075. return createWrap(func, WRAP_FLIP_FLAG);
  4076. }
  4077. var floor$1 = createRound("floor");
  4078. var FUNC_ERROR_TEXT$4 = "Expected a function";
  4079. var WRAP_CURRY_FLAG = 8;
  4080. var WRAP_PARTIAL_FLAG$1 = 32;
  4081. var WRAP_ARY_FLAG = 128;
  4082. var WRAP_REARG_FLAG$1 = 256;
  4083. function createFlow(fromRight) {
  4084. return flatRest(function(funcs) {
  4085. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  4086. if (fromRight) {
  4087. funcs.reverse();
  4088. }
  4089. while (index--) {
  4090. var func = funcs[index];
  4091. if (typeof func != "function") {
  4092. throw new TypeError(FUNC_ERROR_TEXT$4);
  4093. }
  4094. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  4095. var wrapper = new LodashWrapper([], true);
  4096. }
  4097. }
  4098. index = wrapper ? index : length;
  4099. while (++index < length) {
  4100. func = funcs[index];
  4101. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  4102. 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) {
  4103. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  4104. } else {
  4105. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  4106. }
  4107. }
  4108. return function() {
  4109. var args = arguments, value = args[0];
  4110. if (wrapper && args.length == 1 && isArray(value)) {
  4111. return wrapper.plant(value).value();
  4112. }
  4113. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  4114. while (++index2 < length) {
  4115. result = funcs[index2].call(this, result);
  4116. }
  4117. return result;
  4118. };
  4119. });
  4120. }
  4121. var flow = createFlow();
  4122. var flowRight = createFlow(true);
  4123. function forIn(object, iteratee) {
  4124. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  4125. }
  4126. function forInRight(object, iteratee) {
  4127. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  4128. }
  4129. function forOwn(object, iteratee) {
  4130. return object && baseForOwn(object, castFunction(iteratee));
  4131. }
  4132. function forOwnRight(object, iteratee) {
  4133. return object && baseForOwnRight(object, castFunction(iteratee));
  4134. }
  4135. function fromPairs(pairs) {
  4136. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  4137. while (++index < length) {
  4138. var pair = pairs[index];
  4139. result[pair[0]] = pair[1];
  4140. }
  4141. return result;
  4142. }
  4143. function baseFunctions(object, props) {
  4144. return arrayFilter(props, function(key) {
  4145. return isFunction(object[key]);
  4146. });
  4147. }
  4148. function functions(object) {
  4149. return object == null ? [] : baseFunctions(object, keys(object));
  4150. }
  4151. function functionsIn(object) {
  4152. return object == null ? [] : baseFunctions(object, keysIn(object));
  4153. }
  4154. var objectProto$7 = Object.prototype;
  4155. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  4156. var groupBy = createAggregator(function(result, value, key) {
  4157. if (hasOwnProperty$6.call(result, key)) {
  4158. result[key].push(value);
  4159. } else {
  4160. baseAssignValue(result, key, [value]);
  4161. }
  4162. });
  4163. function baseGt(value, other) {
  4164. return value > other;
  4165. }
  4166. function createRelationalOperation(operator) {
  4167. return function(value, other) {
  4168. if (!(typeof value == "string" && typeof other == "string")) {
  4169. value = toNumber(value);
  4170. other = toNumber(other);
  4171. }
  4172. return operator(value, other);
  4173. };
  4174. }
  4175. var gt$1 = createRelationalOperation(baseGt);
  4176. var gte = createRelationalOperation(function(value, other) {
  4177. return value >= other;
  4178. });
  4179. var objectProto$6 = Object.prototype;
  4180. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  4181. function baseHas(object, key) {
  4182. return object != null && hasOwnProperty$5.call(object, key);
  4183. }
  4184. function has(object, path) {
  4185. return object != null && hasPath(object, path, baseHas);
  4186. }
  4187. var nativeMax$8 = Math.max;
  4188. var nativeMin$9 = Math.min;
  4189. function baseInRange(number, start, end) {
  4190. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  4191. }
  4192. function inRange(number, start, end) {
  4193. start = toFinite(start);
  4194. if (end === void 0) {
  4195. end = start;
  4196. start = 0;
  4197. } else {
  4198. end = toFinite(end);
  4199. }
  4200. number = toNumber(number);
  4201. return baseInRange(number, start, end);
  4202. }
  4203. var stringTag = "[object String]";
  4204. function isString(value) {
  4205. return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  4206. }
  4207. function baseValues(object, props) {
  4208. return arrayMap(props, function(key) {
  4209. return object[key];
  4210. });
  4211. }
  4212. function values(object) {
  4213. return object == null ? [] : baseValues(object, keys(object));
  4214. }
  4215. var nativeMax$7 = Math.max;
  4216. function includes(collection, value, fromIndex, guard) {
  4217. collection = isArrayLike(collection) ? collection : values(collection);
  4218. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  4219. var length = collection.length;
  4220. if (fromIndex < 0) {
  4221. fromIndex = nativeMax$7(length + fromIndex, 0);
  4222. }
  4223. return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  4224. }
  4225. var nativeMax$6 = Math.max;
  4226. function indexOf(array, value, fromIndex) {
  4227. var length = array == null ? 0 : array.length;
  4228. if (!length) {
  4229. return -1;
  4230. }
  4231. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4232. if (index < 0) {
  4233. index = nativeMax$6(length + index, 0);
  4234. }
  4235. return baseIndexOf(array, value, index);
  4236. }
  4237. function initial$1(array) {
  4238. var length = array == null ? 0 : array.length;
  4239. return length ? baseSlice(array, 0, -1) : [];
  4240. }
  4241. var nativeMin$8 = Math.min;
  4242. function baseIntersection(arrays, iteratee, comparator) {
  4243. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  4244. while (othIndex--) {
  4245. var array = arrays[othIndex];
  4246. if (othIndex && iteratee) {
  4247. array = arrayMap(array, baseUnary(iteratee));
  4248. }
  4249. maxLength = nativeMin$8(array.length, maxLength);
  4250. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  4251. }
  4252. array = arrays[0];
  4253. var index = -1, seen = caches[0];
  4254. outer:
  4255. while (++index < length && result.length < maxLength) {
  4256. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4257. value = comparator || value !== 0 ? value : 0;
  4258. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  4259. othIndex = othLength;
  4260. while (--othIndex) {
  4261. var cache = caches[othIndex];
  4262. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  4263. continue outer;
  4264. }
  4265. }
  4266. if (seen) {
  4267. seen.push(computed);
  4268. }
  4269. result.push(value);
  4270. }
  4271. }
  4272. return result;
  4273. }
  4274. function castArrayLikeObject(value) {
  4275. return isArrayLikeObject(value) ? value : [];
  4276. }
  4277. var intersection = baseRest(function(arrays) {
  4278. var mapped = arrayMap(arrays, castArrayLikeObject);
  4279. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  4280. });
  4281. var intersectionBy = baseRest(function(arrays) {
  4282. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4283. if (iteratee === last(mapped)) {
  4284. iteratee = void 0;
  4285. } else {
  4286. mapped.pop();
  4287. }
  4288. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  4289. });
  4290. var intersectionWith = baseRest(function(arrays) {
  4291. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4292. comparator = typeof comparator == "function" ? comparator : void 0;
  4293. if (comparator) {
  4294. mapped.pop();
  4295. }
  4296. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  4297. });
  4298. function baseInverter(object, setter, iteratee, accumulator) {
  4299. baseForOwn(object, function(value, key, object2) {
  4300. setter(accumulator, iteratee(value), key, object2);
  4301. });
  4302. return accumulator;
  4303. }
  4304. function createInverter(setter, toIteratee) {
  4305. return function(object, iteratee) {
  4306. return baseInverter(object, setter, toIteratee(iteratee), {});
  4307. };
  4308. }
  4309. var objectProto$5 = Object.prototype;
  4310. var nativeObjectToString$1 = objectProto$5.toString;
  4311. var invert = createInverter(function(result, value, key) {
  4312. if (value != null && typeof value.toString != "function") {
  4313. value = nativeObjectToString$1.call(value);
  4314. }
  4315. result[value] = key;
  4316. }, constant(identity));
  4317. var objectProto$4 = Object.prototype;
  4318. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4319. var nativeObjectToString = objectProto$4.toString;
  4320. var invertBy = createInverter(function(result, value, key) {
  4321. if (value != null && typeof value.toString != "function") {
  4322. value = nativeObjectToString.call(value);
  4323. }
  4324. if (hasOwnProperty$4.call(result, value)) {
  4325. result[value].push(key);
  4326. } else {
  4327. result[value] = [key];
  4328. }
  4329. }, baseIteratee);
  4330. function parent(object, path) {
  4331. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  4332. }
  4333. function baseInvoke(object, path, args) {
  4334. path = castPath(path, object);
  4335. object = parent(object, path);
  4336. var func = object == null ? object : object[toKey(last(path))];
  4337. return func == null ? void 0 : apply(func, object, args);
  4338. }
  4339. var invoke = baseRest(baseInvoke);
  4340. var invokeMap = baseRest(function(collection, path, args) {
  4341. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  4342. baseEach(collection, function(value) {
  4343. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  4344. });
  4345. return result;
  4346. });
  4347. var arrayBufferTag = "[object ArrayBuffer]";
  4348. function baseIsArrayBuffer(value) {
  4349. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4350. }
  4351. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  4352. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  4353. var boolTag = "[object Boolean]";
  4354. function isBoolean$1(value) {
  4355. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  4356. }
  4357. var dateTag = "[object Date]";
  4358. function baseIsDate(value) {
  4359. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4360. }
  4361. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  4362. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  4363. function isElement$2(value) {
  4364. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  4365. }
  4366. var mapTag$2 = "[object Map]";
  4367. var setTag$2 = "[object Set]";
  4368. var objectProto$3 = Object.prototype;
  4369. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4370. function isEmpty$1(value) {
  4371. if (value == null) {
  4372. return true;
  4373. }
  4374. if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  4375. return !value.length;
  4376. }
  4377. var tag = getTag$1(value);
  4378. if (tag == mapTag$2 || tag == setTag$2) {
  4379. return !value.size;
  4380. }
  4381. if (isPrototype(value)) {
  4382. return !baseKeys(value).length;
  4383. }
  4384. for (var key in value) {
  4385. if (hasOwnProperty$3.call(value, key)) {
  4386. return false;
  4387. }
  4388. }
  4389. return true;
  4390. }
  4391. function isEqual$1(value, other) {
  4392. return baseIsEqual(value, other);
  4393. }
  4394. function isEqualWith(value, other, customizer) {
  4395. customizer = typeof customizer == "function" ? customizer : void 0;
  4396. var result = customizer ? customizer(value, other) : void 0;
  4397. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  4398. }
  4399. var nativeIsFinite = root.isFinite;
  4400. function isFinite(value) {
  4401. return typeof value == "number" && nativeIsFinite(value);
  4402. }
  4403. function isInteger(value) {
  4404. return typeof value == "number" && value == toInteger(value);
  4405. }
  4406. function isMatch(object, source) {
  4407. return object === source || baseIsMatch(object, source, getMatchData(source));
  4408. }
  4409. function isMatchWith(object, source, customizer) {
  4410. customizer = typeof customizer == "function" ? customizer : void 0;
  4411. return baseIsMatch(object, source, getMatchData(source), customizer);
  4412. }
  4413. var numberTag = "[object Number]";
  4414. function isNumber$1(value) {
  4415. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  4416. }
  4417. function isNaN$1(value) {
  4418. return isNumber$1(value) && value != +value;
  4419. }
  4420. var isMaskable = coreJsData ? isFunction : stubFalse;
  4421. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  4422. function isNative(value) {
  4423. if (isMaskable(value)) {
  4424. throw new Error(CORE_ERROR_TEXT);
  4425. }
  4426. return baseIsNative(value);
  4427. }
  4428. function isNil(value) {
  4429. return value == null;
  4430. }
  4431. function isNull(value) {
  4432. return value === null;
  4433. }
  4434. var regexpTag = "[object RegExp]";
  4435. function baseIsRegExp(value) {
  4436. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4437. }
  4438. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  4439. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  4440. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  4441. function isSafeInteger(value) {
  4442. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  4443. }
  4444. function isUndefined$1(value) {
  4445. return value === void 0;
  4446. }
  4447. var weakMapTag = "[object WeakMap]";
  4448. function isWeakMap(value) {
  4449. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  4450. }
  4451. var weakSetTag = "[object WeakSet]";
  4452. function isWeakSet(value) {
  4453. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  4454. }
  4455. var CLONE_DEEP_FLAG$3 = 1;
  4456. function iteratee(func) {
  4457. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  4458. }
  4459. var arrayProto$4 = Array.prototype;
  4460. var nativeJoin = arrayProto$4.join;
  4461. function join(array, separator) {
  4462. return array == null ? "" : nativeJoin.call(array, separator);
  4463. }
  4464. var kebabCase = createCompounder(function(result, word, index) {
  4465. return result + (index ? "-" : "") + word.toLowerCase();
  4466. });
  4467. var keyBy = createAggregator(function(result, value, key) {
  4468. baseAssignValue(result, key, value);
  4469. });
  4470. function strictLastIndexOf(array, value, fromIndex) {
  4471. var index = fromIndex + 1;
  4472. while (index--) {
  4473. if (array[index] === value) {
  4474. return index;
  4475. }
  4476. }
  4477. return index;
  4478. }
  4479. var nativeMax$5 = Math.max;
  4480. var nativeMin$7 = Math.min;
  4481. function lastIndexOf(array, value, fromIndex) {
  4482. var length = array == null ? 0 : array.length;
  4483. if (!length) {
  4484. return -1;
  4485. }
  4486. var index = length;
  4487. if (fromIndex !== void 0) {
  4488. index = toInteger(fromIndex);
  4489. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  4490. }
  4491. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  4492. }
  4493. var lowerCase = createCompounder(function(result, word, index) {
  4494. return result + (index ? " " : "") + word.toLowerCase();
  4495. });
  4496. var lowerFirst = createCaseFirst("toLowerCase");
  4497. function baseLt(value, other) {
  4498. return value < other;
  4499. }
  4500. var lt$1 = createRelationalOperation(baseLt);
  4501. var lte = createRelationalOperation(function(value, other) {
  4502. return value <= other;
  4503. });
  4504. function mapKeys(object, iteratee) {
  4505. var result = {};
  4506. iteratee = baseIteratee(iteratee);
  4507. baseForOwn(object, function(value, key, object2) {
  4508. baseAssignValue(result, iteratee(value, key, object2), value);
  4509. });
  4510. return result;
  4511. }
  4512. function mapValues(object, iteratee) {
  4513. var result = {};
  4514. iteratee = baseIteratee(iteratee);
  4515. baseForOwn(object, function(value, key, object2) {
  4516. baseAssignValue(result, key, iteratee(value, key, object2));
  4517. });
  4518. return result;
  4519. }
  4520. var CLONE_DEEP_FLAG$2 = 1;
  4521. function matches(source) {
  4522. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  4523. }
  4524. var CLONE_DEEP_FLAG$1 = 1;
  4525. function matchesProperty(path, srcValue) {
  4526. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  4527. }
  4528. function baseExtremum(array, iteratee, comparator) {
  4529. var index = -1, length = array.length;
  4530. while (++index < length) {
  4531. var value = array[index], current = iteratee(value);
  4532. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  4533. var computed = current, result = value;
  4534. }
  4535. }
  4536. return result;
  4537. }
  4538. function max$3(array) {
  4539. return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
  4540. }
  4541. function maxBy(array, iteratee) {
  4542. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  4543. }
  4544. function baseSum(array, iteratee) {
  4545. var result, index = -1, length = array.length;
  4546. while (++index < length) {
  4547. var current = iteratee(array[index]);
  4548. if (current !== void 0) {
  4549. result = result === void 0 ? current : result + current;
  4550. }
  4551. }
  4552. return result;
  4553. }
  4554. var NAN = 0 / 0;
  4555. function baseMean(array, iteratee) {
  4556. var length = array == null ? 0 : array.length;
  4557. return length ? baseSum(array, iteratee) / length : NAN;
  4558. }
  4559. function mean(array) {
  4560. return baseMean(array, identity);
  4561. }
  4562. function meanBy(array, iteratee) {
  4563. return baseMean(array, baseIteratee(iteratee));
  4564. }
  4565. var merge = createAssigner(function(object, source, srcIndex) {
  4566. baseMerge(object, source, srcIndex);
  4567. });
  4568. var method = baseRest(function(path, args) {
  4569. return function(object) {
  4570. return baseInvoke(object, path, args);
  4571. };
  4572. });
  4573. var methodOf = baseRest(function(object, args) {
  4574. return function(path) {
  4575. return baseInvoke(object, path, args);
  4576. };
  4577. });
  4578. function min$3(array) {
  4579. return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
  4580. }
  4581. function minBy(array, iteratee) {
  4582. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  4583. }
  4584. function mixin$1(object, source, options) {
  4585. var props = keys(source), methodNames = baseFunctions(source, props);
  4586. var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
  4587. arrayEach(methodNames, function(methodName) {
  4588. var func = source[methodName];
  4589. object[methodName] = func;
  4590. if (isFunc) {
  4591. object.prototype[methodName] = function() {
  4592. var chainAll = this.__chain__;
  4593. if (chain || chainAll) {
  4594. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  4595. actions.push({ "func": func, "args": arguments, "thisArg": object });
  4596. result.__chain__ = chainAll;
  4597. return result;
  4598. }
  4599. return func.apply(object, arrayPush([this.value()], arguments));
  4600. };
  4601. }
  4602. });
  4603. return object;
  4604. }
  4605. var multiply = createMathOperation(function(multiplier, multiplicand) {
  4606. return multiplier * multiplicand;
  4607. }, 1);
  4608. var FUNC_ERROR_TEXT$3 = "Expected a function";
  4609. function negate(predicate) {
  4610. if (typeof predicate != "function") {
  4611. throw new TypeError(FUNC_ERROR_TEXT$3);
  4612. }
  4613. return function() {
  4614. var args = arguments;
  4615. switch (args.length) {
  4616. case 0:
  4617. return !predicate.call(this);
  4618. case 1:
  4619. return !predicate.call(this, args[0]);
  4620. case 2:
  4621. return !predicate.call(this, args[0], args[1]);
  4622. case 3:
  4623. return !predicate.call(this, args[0], args[1], args[2]);
  4624. }
  4625. return !predicate.apply(this, args);
  4626. };
  4627. }
  4628. function iteratorToArray(iterator) {
  4629. var data, result = [];
  4630. while (!(data = iterator.next()).done) {
  4631. result.push(data.value);
  4632. }
  4633. return result;
  4634. }
  4635. var mapTag$1 = "[object Map]";
  4636. var setTag$1 = "[object Set]";
  4637. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  4638. function toArray(value) {
  4639. if (!value) {
  4640. return [];
  4641. }
  4642. if (isArrayLike(value)) {
  4643. return isString(value) ? stringToArray(value) : copyArray(value);
  4644. }
  4645. if (symIterator$1 && value[symIterator$1]) {
  4646. return iteratorToArray(value[symIterator$1]());
  4647. }
  4648. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  4649. return func(value);
  4650. }
  4651. function wrapperNext() {
  4652. if (this.__values__ === void 0) {
  4653. this.__values__ = toArray(this.value());
  4654. }
  4655. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  4656. return { "done": done, "value": value };
  4657. }
  4658. function baseNth(array, n) {
  4659. var length = array.length;
  4660. if (!length) {
  4661. return;
  4662. }
  4663. n += n < 0 ? length : 0;
  4664. return isIndex(n, length) ? array[n] : void 0;
  4665. }
  4666. function nth(array, n) {
  4667. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  4668. }
  4669. function nthArg(n) {
  4670. n = toInteger(n);
  4671. return baseRest(function(args) {
  4672. return baseNth(args, n);
  4673. });
  4674. }
  4675. function baseUnset(object, path) {
  4676. path = castPath(path, object);
  4677. object = parent(object, path);
  4678. return object == null || delete object[toKey(last(path))];
  4679. }
  4680. function customOmitClone(value) {
  4681. return isPlainObject(value) ? void 0 : value;
  4682. }
  4683. var CLONE_DEEP_FLAG = 1;
  4684. var CLONE_FLAT_FLAG = 2;
  4685. var CLONE_SYMBOLS_FLAG = 4;
  4686. var omit = flatRest(function(object, paths) {
  4687. var result = {};
  4688. if (object == null) {
  4689. return result;
  4690. }
  4691. var isDeep = false;
  4692. paths = arrayMap(paths, function(path) {
  4693. path = castPath(path, object);
  4694. isDeep || (isDeep = path.length > 1);
  4695. return path;
  4696. });
  4697. copyObject(object, getAllKeysIn(object), result);
  4698. if (isDeep) {
  4699. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  4700. }
  4701. var length = paths.length;
  4702. while (length--) {
  4703. baseUnset(result, paths[length]);
  4704. }
  4705. return result;
  4706. });
  4707. function baseSet(object, path, value, customizer) {
  4708. if (!isObject(object)) {
  4709. return object;
  4710. }
  4711. path = castPath(path, object);
  4712. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  4713. while (nested != null && ++index < length) {
  4714. var key = toKey(path[index]), newValue = value;
  4715. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  4716. return object;
  4717. }
  4718. if (index != lastIndex) {
  4719. var objValue = nested[key];
  4720. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  4721. if (newValue === void 0) {
  4722. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  4723. }
  4724. }
  4725. assignValue(nested, key, newValue);
  4726. nested = nested[key];
  4727. }
  4728. return object;
  4729. }
  4730. function basePickBy(object, paths, predicate) {
  4731. var index = -1, length = paths.length, result = {};
  4732. while (++index < length) {
  4733. var path = paths[index], value = baseGet(object, path);
  4734. if (predicate(value, path)) {
  4735. baseSet(result, castPath(path, object), value);
  4736. }
  4737. }
  4738. return result;
  4739. }
  4740. function pickBy(object, predicate) {
  4741. if (object == null) {
  4742. return {};
  4743. }
  4744. var props = arrayMap(getAllKeysIn(object), function(prop) {
  4745. return [prop];
  4746. });
  4747. predicate = baseIteratee(predicate);
  4748. return basePickBy(object, props, function(value, path) {
  4749. return predicate(value, path[0]);
  4750. });
  4751. }
  4752. function omitBy(object, predicate) {
  4753. return pickBy(object, negate(baseIteratee(predicate)));
  4754. }
  4755. function once(func) {
  4756. return before(2, func);
  4757. }
  4758. function baseSortBy(array, comparer) {
  4759. var length = array.length;
  4760. array.sort(comparer);
  4761. while (length--) {
  4762. array[length] = array[length].value;
  4763. }
  4764. return array;
  4765. }
  4766. function compareAscending(value, other) {
  4767. if (value !== other) {
  4768. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  4769. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  4770. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  4771. return 1;
  4772. }
  4773. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  4774. return -1;
  4775. }
  4776. }
  4777. return 0;
  4778. }
  4779. function compareMultiple(object, other, orders) {
  4780. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  4781. while (++index < length) {
  4782. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4783. if (result) {
  4784. if (index >= ordersLength) {
  4785. return result;
  4786. }
  4787. var order = orders[index];
  4788. return result * (order == "desc" ? -1 : 1);
  4789. }
  4790. }
  4791. return object.index - other.index;
  4792. }
  4793. function baseOrderBy(collection, iteratees, orders) {
  4794. if (iteratees.length) {
  4795. iteratees = arrayMap(iteratees, function(iteratee) {
  4796. if (isArray(iteratee)) {
  4797. return function(value) {
  4798. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4799. };
  4800. }
  4801. return iteratee;
  4802. });
  4803. } else {
  4804. iteratees = [identity];
  4805. }
  4806. var index = -1;
  4807. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4808. var result = baseMap(collection, function(value, key, collection2) {
  4809. var criteria = arrayMap(iteratees, function(iteratee) {
  4810. return iteratee(value);
  4811. });
  4812. return { "criteria": criteria, "index": ++index, "value": value };
  4813. });
  4814. return baseSortBy(result, function(object, other) {
  4815. return compareMultiple(object, other, orders);
  4816. });
  4817. }
  4818. function orderBy$1(collection, iteratees, orders, guard) {
  4819. if (collection == null) {
  4820. return [];
  4821. }
  4822. if (!isArray(iteratees)) {
  4823. iteratees = iteratees == null ? [] : [iteratees];
  4824. }
  4825. orders = guard ? void 0 : orders;
  4826. if (!isArray(orders)) {
  4827. orders = orders == null ? [] : [orders];
  4828. }
  4829. return baseOrderBy(collection, iteratees, orders);
  4830. }
  4831. function createOver(arrayFunc) {
  4832. return flatRest(function(iteratees) {
  4833. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4834. return baseRest(function(args) {
  4835. var thisArg = this;
  4836. return arrayFunc(iteratees, function(iteratee) {
  4837. return apply(iteratee, thisArg, args);
  4838. });
  4839. });
  4840. });
  4841. }
  4842. var over = createOver(arrayMap);
  4843. var castRest = baseRest;
  4844. var nativeMin$6 = Math.min;
  4845. var overArgs = castRest(function(func, transforms) {
  4846. transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  4847. var funcsLength = transforms.length;
  4848. return baseRest(function(args) {
  4849. var index = -1, length = nativeMin$6(args.length, funcsLength);
  4850. while (++index < length) {
  4851. args[index] = transforms[index].call(this, args[index]);
  4852. }
  4853. return apply(func, this, args);
  4854. });
  4855. });
  4856. var overEvery = createOver(arrayEvery);
  4857. var overSome = createOver(arraySome);
  4858. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  4859. var nativeFloor$3 = Math.floor;
  4860. function baseRepeat(string, n) {
  4861. var result = "";
  4862. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  4863. return result;
  4864. }
  4865. do {
  4866. if (n % 2) {
  4867. result += string;
  4868. }
  4869. n = nativeFloor$3(n / 2);
  4870. if (n) {
  4871. string += string;
  4872. }
  4873. } while (n);
  4874. return result;
  4875. }
  4876. var asciiSize = baseProperty("length");
  4877. var rsAstralRange = "\\ud800-\\udfff";
  4878. var rsComboMarksRange = "\\u0300-\\u036f";
  4879. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  4880. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  4881. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  4882. var rsVarRange = "\\ufe0e\\ufe0f";
  4883. var rsAstral = "[" + rsAstralRange + "]";
  4884. var rsCombo = "[" + rsComboRange + "]";
  4885. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  4886. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  4887. var rsNonAstral = "[^" + rsAstralRange + "]";
  4888. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  4889. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  4890. var rsZWJ = "\\u200d";
  4891. var reOptMod = rsModifier + "?";
  4892. var rsOptVar = "[" + rsVarRange + "]?";
  4893. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  4894. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  4895. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  4896. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  4897. function unicodeSize(string) {
  4898. var result = reUnicode.lastIndex = 0;
  4899. while (reUnicode.test(string)) {
  4900. ++result;
  4901. }
  4902. return result;
  4903. }
  4904. function stringSize(string) {
  4905. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  4906. }
  4907. var nativeCeil$2 = Math.ceil;
  4908. function createPadding(length, chars) {
  4909. chars = chars === void 0 ? " " : baseToString(chars);
  4910. var charsLength = chars.length;
  4911. if (charsLength < 2) {
  4912. return charsLength ? baseRepeat(chars, length) : chars;
  4913. }
  4914. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  4915. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  4916. }
  4917. var nativeCeil$1 = Math.ceil;
  4918. var nativeFloor$2 = Math.floor;
  4919. function pad(string, length, chars) {
  4920. string = toString(string);
  4921. length = toInteger(length);
  4922. var strLength = length ? stringSize(string) : 0;
  4923. if (!length || strLength >= length) {
  4924. return string;
  4925. }
  4926. var mid = (length - strLength) / 2;
  4927. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  4928. }
  4929. function padEnd(string, length, chars) {
  4930. string = toString(string);
  4931. length = toInteger(length);
  4932. var strLength = length ? stringSize(string) : 0;
  4933. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  4934. }
  4935. function padStart(string, length, chars) {
  4936. string = toString(string);
  4937. length = toInteger(length);
  4938. var strLength = length ? stringSize(string) : 0;
  4939. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  4940. }
  4941. var reTrimStart$1 = /^\s+/;
  4942. var nativeParseInt = root.parseInt;
  4943. function parseInt$1(string, radix, guard) {
  4944. if (guard || radix == null) {
  4945. radix = 0;
  4946. } else if (radix) {
  4947. radix = +radix;
  4948. }
  4949. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  4950. }
  4951. var WRAP_PARTIAL_FLAG = 32;
  4952. var partial = baseRest(function(func, partials) {
  4953. var holders = replaceHolders(partials, getHolder(partial));
  4954. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  4955. });
  4956. partial.placeholder = {};
  4957. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  4958. var partialRight = baseRest(function(func, partials) {
  4959. var holders = replaceHolders(partials, getHolder(partialRight));
  4960. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  4961. });
  4962. partialRight.placeholder = {};
  4963. var partition = createAggregator(function(result, value, key) {
  4964. result[key ? 0 : 1].push(value);
  4965. }, function() {
  4966. return [[], []];
  4967. });
  4968. function basePick(object, paths) {
  4969. return basePickBy(object, paths, function(value, path) {
  4970. return hasIn(object, path);
  4971. });
  4972. }
  4973. var pick = flatRest(function(object, paths) {
  4974. return object == null ? {} : basePick(object, paths);
  4975. });
  4976. function wrapperPlant(value) {
  4977. var result, parent = this;
  4978. while (parent instanceof baseLodash) {
  4979. var clone = wrapperClone(parent);
  4980. clone.__index__ = 0;
  4981. clone.__values__ = void 0;
  4982. if (result) {
  4983. previous.__wrapped__ = clone;
  4984. } else {
  4985. result = clone;
  4986. }
  4987. var previous = clone;
  4988. parent = parent.__wrapped__;
  4989. }
  4990. previous.__wrapped__ = value;
  4991. return result;
  4992. }
  4993. function propertyOf(object) {
  4994. return function(path) {
  4995. return object == null ? void 0 : baseGet(object, path);
  4996. };
  4997. }
  4998. function baseIndexOfWith(array, value, fromIndex, comparator) {
  4999. var index = fromIndex - 1, length = array.length;
  5000. while (++index < length) {
  5001. if (comparator(array[index], value)) {
  5002. return index;
  5003. }
  5004. }
  5005. return -1;
  5006. }
  5007. var arrayProto$3 = Array.prototype;
  5008. var splice$1 = arrayProto$3.splice;
  5009. function basePullAll(array, values, iteratee, comparator) {
  5010. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  5011. if (array === values) {
  5012. values = copyArray(values);
  5013. }
  5014. if (iteratee) {
  5015. seen = arrayMap(array, baseUnary(iteratee));
  5016. }
  5017. while (++index < length) {
  5018. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  5019. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5020. if (seen !== array) {
  5021. splice$1.call(seen, fromIndex, 1);
  5022. }
  5023. splice$1.call(array, fromIndex, 1);
  5024. }
  5025. }
  5026. return array;
  5027. }
  5028. function pullAll(array, values) {
  5029. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  5030. }
  5031. var pull = baseRest(pullAll);
  5032. function pullAllBy(array, values, iteratee) {
  5033. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  5034. }
  5035. function pullAllWith(array, values, comparator) {
  5036. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  5037. }
  5038. var arrayProto$2 = Array.prototype;
  5039. var splice = arrayProto$2.splice;
  5040. function basePullAt(array, indexes) {
  5041. var length = array ? indexes.length : 0, lastIndex = length - 1;
  5042. while (length--) {
  5043. var index = indexes[length];
  5044. if (length == lastIndex || index !== previous) {
  5045. var previous = index;
  5046. if (isIndex(index)) {
  5047. splice.call(array, index, 1);
  5048. } else {
  5049. baseUnset(array, index);
  5050. }
  5051. }
  5052. }
  5053. return array;
  5054. }
  5055. var pullAt = flatRest(function(array, indexes) {
  5056. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  5057. basePullAt(array, arrayMap(indexes, function(index) {
  5058. return isIndex(index, length) ? +index : index;
  5059. }).sort(compareAscending));
  5060. return result;
  5061. });
  5062. var nativeFloor$1 = Math.floor;
  5063. var nativeRandom$1 = Math.random;
  5064. function baseRandom(lower, upper) {
  5065. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  5066. }
  5067. var freeParseFloat = parseFloat;
  5068. var nativeMin$5 = Math.min;
  5069. var nativeRandom = Math.random;
  5070. function random(lower, upper, floating) {
  5071. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  5072. upper = floating = void 0;
  5073. }
  5074. if (floating === void 0) {
  5075. if (typeof upper == "boolean") {
  5076. floating = upper;
  5077. upper = void 0;
  5078. } else if (typeof lower == "boolean") {
  5079. floating = lower;
  5080. lower = void 0;
  5081. }
  5082. }
  5083. if (lower === void 0 && upper === void 0) {
  5084. lower = 0;
  5085. upper = 1;
  5086. } else {
  5087. lower = toFinite(lower);
  5088. if (upper === void 0) {
  5089. upper = lower;
  5090. lower = 0;
  5091. } else {
  5092. upper = toFinite(upper);
  5093. }
  5094. }
  5095. if (lower > upper) {
  5096. var temp = lower;
  5097. lower = upper;
  5098. upper = temp;
  5099. }
  5100. if (floating || lower % 1 || upper % 1) {
  5101. var rand = nativeRandom();
  5102. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  5103. }
  5104. return baseRandom(lower, upper);
  5105. }
  5106. var nativeCeil = Math.ceil;
  5107. var nativeMax$4 = Math.max;
  5108. function baseRange(start, end, step, fromRight) {
  5109. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  5110. while (length--) {
  5111. result[fromRight ? length : ++index] = start;
  5112. start += step;
  5113. }
  5114. return result;
  5115. }
  5116. function createRange(fromRight) {
  5117. return function(start, end, step) {
  5118. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  5119. end = step = void 0;
  5120. }
  5121. start = toFinite(start);
  5122. if (end === void 0) {
  5123. end = start;
  5124. start = 0;
  5125. } else {
  5126. end = toFinite(end);
  5127. }
  5128. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  5129. return baseRange(start, end, step, fromRight);
  5130. };
  5131. }
  5132. var range$1 = createRange();
  5133. var rangeRight = createRange(true);
  5134. var WRAP_REARG_FLAG = 256;
  5135. var rearg = flatRest(function(func, indexes) {
  5136. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  5137. });
  5138. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  5139. eachFunc(collection, function(value, index, collection2) {
  5140. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  5141. });
  5142. return accumulator;
  5143. }
  5144. function reduce(collection, iteratee, accumulator) {
  5145. var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  5146. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  5147. }
  5148. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  5149. var length = array == null ? 0 : array.length;
  5150. if (initAccum && length) {
  5151. accumulator = array[--length];
  5152. }
  5153. while (length--) {
  5154. accumulator = iteratee(accumulator, array[length], length, array);
  5155. }
  5156. return accumulator;
  5157. }
  5158. function reduceRight(collection, iteratee, accumulator) {
  5159. var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  5160. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  5161. }
  5162. function reject(collection, predicate) {
  5163. var func = isArray(collection) ? arrayFilter : baseFilter;
  5164. return func(collection, negate(baseIteratee(predicate)));
  5165. }
  5166. function remove(array, predicate) {
  5167. var result = [];
  5168. if (!(array && array.length)) {
  5169. return result;
  5170. }
  5171. var index = -1, indexes = [], length = array.length;
  5172. predicate = baseIteratee(predicate);
  5173. while (++index < length) {
  5174. var value = array[index];
  5175. if (predicate(value, index, array)) {
  5176. result.push(value);
  5177. indexes.push(index);
  5178. }
  5179. }
  5180. basePullAt(array, indexes);
  5181. return result;
  5182. }
  5183. function repeat(string, n, guard) {
  5184. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  5185. n = 1;
  5186. } else {
  5187. n = toInteger(n);
  5188. }
  5189. return baseRepeat(toString(string), n);
  5190. }
  5191. function replace() {
  5192. var args = arguments, string = toString(args[0]);
  5193. return args.length < 3 ? string : string.replace(args[1], args[2]);
  5194. }
  5195. var FUNC_ERROR_TEXT$2 = "Expected a function";
  5196. function rest(func, start) {
  5197. if (typeof func != "function") {
  5198. throw new TypeError(FUNC_ERROR_TEXT$2);
  5199. }
  5200. start = start === void 0 ? start : toInteger(start);
  5201. return baseRest(func, start);
  5202. }
  5203. function result(object, path, defaultValue) {
  5204. path = castPath(path, object);
  5205. var index = -1, length = path.length;
  5206. if (!length) {
  5207. length = 1;
  5208. object = void 0;
  5209. }
  5210. while (++index < length) {
  5211. var value = object == null ? void 0 : object[toKey(path[index])];
  5212. if (value === void 0) {
  5213. index = length;
  5214. value = defaultValue;
  5215. }
  5216. object = isFunction(value) ? value.call(object) : value;
  5217. }
  5218. return object;
  5219. }
  5220. var arrayProto$1 = Array.prototype;
  5221. var nativeReverse = arrayProto$1.reverse;
  5222. function reverse(array) {
  5223. return array == null ? array : nativeReverse.call(array);
  5224. }
  5225. var round$1 = createRound("round");
  5226. function arraySample(array) {
  5227. var length = array.length;
  5228. return length ? array[baseRandom(0, length - 1)] : void 0;
  5229. }
  5230. function baseSample(collection) {
  5231. return arraySample(values(collection));
  5232. }
  5233. function sample(collection) {
  5234. var func = isArray(collection) ? arraySample : baseSample;
  5235. return func(collection);
  5236. }
  5237. function shuffleSelf(array, size) {
  5238. var index = -1, length = array.length, lastIndex = length - 1;
  5239. size = size === void 0 ? length : size;
  5240. while (++index < size) {
  5241. var rand = baseRandom(index, lastIndex), value = array[rand];
  5242. array[rand] = array[index];
  5243. array[index] = value;
  5244. }
  5245. array.length = size;
  5246. return array;
  5247. }
  5248. function arraySampleSize(array, n) {
  5249. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  5250. }
  5251. function baseSampleSize(collection, n) {
  5252. var array = values(collection);
  5253. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5254. }
  5255. function sampleSize(collection, n, guard) {
  5256. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  5257. n = 1;
  5258. } else {
  5259. n = toInteger(n);
  5260. }
  5261. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  5262. return func(collection, n);
  5263. }
  5264. function set(object, path, value) {
  5265. return object == null ? object : baseSet(object, path, value);
  5266. }
  5267. function setWith(object, path, value, customizer) {
  5268. customizer = typeof customizer == "function" ? customizer : void 0;
  5269. return object == null ? object : baseSet(object, path, value, customizer);
  5270. }
  5271. function arrayShuffle(array) {
  5272. return shuffleSelf(copyArray(array));
  5273. }
  5274. function baseShuffle(collection) {
  5275. return shuffleSelf(values(collection));
  5276. }
  5277. function shuffle(collection) {
  5278. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  5279. return func(collection);
  5280. }
  5281. var mapTag = "[object Map]";
  5282. var setTag = "[object Set]";
  5283. function size(collection) {
  5284. if (collection == null) {
  5285. return 0;
  5286. }
  5287. if (isArrayLike(collection)) {
  5288. return isString(collection) ? stringSize(collection) : collection.length;
  5289. }
  5290. var tag = getTag$1(collection);
  5291. if (tag == mapTag || tag == setTag) {
  5292. return collection.size;
  5293. }
  5294. return baseKeys(collection).length;
  5295. }
  5296. function slice(array, start, end) {
  5297. var length = array == null ? 0 : array.length;
  5298. if (!length) {
  5299. return [];
  5300. }
  5301. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  5302. start = 0;
  5303. end = length;
  5304. } else {
  5305. start = start == null ? 0 : toInteger(start);
  5306. end = end === void 0 ? length : toInteger(end);
  5307. }
  5308. return baseSlice(array, start, end);
  5309. }
  5310. var snakeCase = createCompounder(function(result, word, index) {
  5311. return result + (index ? "_" : "") + word.toLowerCase();
  5312. });
  5313. function baseSome(collection, predicate) {
  5314. var result;
  5315. baseEach(collection, function(value, index, collection2) {
  5316. result = predicate(value, index, collection2);
  5317. return !result;
  5318. });
  5319. return !!result;
  5320. }
  5321. function some(collection, predicate, guard) {
  5322. var func = isArray(collection) ? arraySome : baseSome;
  5323. if (guard && isIterateeCall(collection, predicate, guard)) {
  5324. predicate = void 0;
  5325. }
  5326. return func(collection, baseIteratee(predicate));
  5327. }
  5328. var sortBy = baseRest(function(collection, iteratees) {
  5329. if (collection == null) {
  5330. return [];
  5331. }
  5332. var length = iteratees.length;
  5333. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  5334. iteratees = [];
  5335. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  5336. iteratees = [iteratees[0]];
  5337. }
  5338. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  5339. });
  5340. var MAX_ARRAY_LENGTH$4 = 4294967295;
  5341. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  5342. var nativeFloor = Math.floor;
  5343. var nativeMin$4 = Math.min;
  5344. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5345. var low = 0, high = array == null ? 0 : array.length;
  5346. if (high === 0) {
  5347. return 0;
  5348. }
  5349. value = iteratee(value);
  5350. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  5351. while (low < high) {
  5352. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  5353. if (valIsNaN) {
  5354. var setLow = retHighest || othIsReflexive;
  5355. } else if (valIsUndefined) {
  5356. setLow = othIsReflexive && (retHighest || othIsDefined);
  5357. } else if (valIsNull) {
  5358. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5359. } else if (valIsSymbol) {
  5360. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5361. } else if (othIsNull || othIsSymbol) {
  5362. setLow = false;
  5363. } else {
  5364. setLow = retHighest ? computed <= value : computed < value;
  5365. }
  5366. if (setLow) {
  5367. low = mid + 1;
  5368. } else {
  5369. high = mid;
  5370. }
  5371. }
  5372. return nativeMin$4(high, MAX_ARRAY_INDEX);
  5373. }
  5374. var MAX_ARRAY_LENGTH$3 = 4294967295;
  5375. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  5376. function baseSortedIndex(array, value, retHighest) {
  5377. var low = 0, high = array == null ? low : array.length;
  5378. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5379. while (low < high) {
  5380. var mid = low + high >>> 1, computed = array[mid];
  5381. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  5382. low = mid + 1;
  5383. } else {
  5384. high = mid;
  5385. }
  5386. }
  5387. return high;
  5388. }
  5389. return baseSortedIndexBy(array, value, identity, retHighest);
  5390. }
  5391. function sortedIndex(array, value) {
  5392. return baseSortedIndex(array, value);
  5393. }
  5394. function sortedIndexBy(array, value, iteratee) {
  5395. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  5396. }
  5397. function sortedIndexOf(array, value) {
  5398. var length = array == null ? 0 : array.length;
  5399. if (length) {
  5400. var index = baseSortedIndex(array, value);
  5401. if (index < length && eq(array[index], value)) {
  5402. return index;
  5403. }
  5404. }
  5405. return -1;
  5406. }
  5407. function sortedLastIndex(array, value) {
  5408. return baseSortedIndex(array, value, true);
  5409. }
  5410. function sortedLastIndexBy(array, value, iteratee) {
  5411. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  5412. }
  5413. function sortedLastIndexOf(array, value) {
  5414. var length = array == null ? 0 : array.length;
  5415. if (length) {
  5416. var index = baseSortedIndex(array, value, true) - 1;
  5417. if (eq(array[index], value)) {
  5418. return index;
  5419. }
  5420. }
  5421. return -1;
  5422. }
  5423. function baseSortedUniq(array, iteratee) {
  5424. var index = -1, length = array.length, resIndex = 0, result = [];
  5425. while (++index < length) {
  5426. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5427. if (!index || !eq(computed, seen)) {
  5428. var seen = computed;
  5429. result[resIndex++] = value === 0 ? 0 : value;
  5430. }
  5431. }
  5432. return result;
  5433. }
  5434. function sortedUniq(array) {
  5435. return array && array.length ? baseSortedUniq(array) : [];
  5436. }
  5437. function sortedUniqBy(array, iteratee) {
  5438. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  5439. }
  5440. var MAX_ARRAY_LENGTH$2 = 4294967295;
  5441. function split(string, separator, limit) {
  5442. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  5443. separator = limit = void 0;
  5444. }
  5445. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  5446. if (!limit) {
  5447. return [];
  5448. }
  5449. string = toString(string);
  5450. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  5451. separator = baseToString(separator);
  5452. if (!separator && hasUnicode(string)) {
  5453. return castSlice(stringToArray(string), 0, limit);
  5454. }
  5455. }
  5456. return string.split(separator, limit);
  5457. }
  5458. var FUNC_ERROR_TEXT$1 = "Expected a function";
  5459. var nativeMax$3 = Math.max;
  5460. function spread(func, start) {
  5461. if (typeof func != "function") {
  5462. throw new TypeError(FUNC_ERROR_TEXT$1);
  5463. }
  5464. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  5465. return baseRest(function(args) {
  5466. var array = args[start], otherArgs = castSlice(args, 0, start);
  5467. if (array) {
  5468. arrayPush(otherArgs, array);
  5469. }
  5470. return apply(func, this, otherArgs);
  5471. });
  5472. }
  5473. var startCase = createCompounder(function(result, word, index) {
  5474. return result + (index ? " " : "") + upperFirst(word);
  5475. });
  5476. function startsWith(string, target, position) {
  5477. string = toString(string);
  5478. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  5479. target = baseToString(target);
  5480. return string.slice(position, position + target.length) == target;
  5481. }
  5482. function stubObject() {
  5483. return {};
  5484. }
  5485. function stubString() {
  5486. return "";
  5487. }
  5488. function stubTrue() {
  5489. return true;
  5490. }
  5491. var subtract = createMathOperation(function(minuend, subtrahend) {
  5492. return minuend - subtrahend;
  5493. }, 0);
  5494. function sum$1(array) {
  5495. return array && array.length ? baseSum(array, identity) : 0;
  5496. }
  5497. function sumBy(array, iteratee) {
  5498. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  5499. }
  5500. function tail(array) {
  5501. var length = array == null ? 0 : array.length;
  5502. return length ? baseSlice(array, 1, length) : [];
  5503. }
  5504. function take(array, n, guard) {
  5505. if (!(array && array.length)) {
  5506. return [];
  5507. }
  5508. n = guard || n === void 0 ? 1 : toInteger(n);
  5509. return baseSlice(array, 0, n < 0 ? 0 : n);
  5510. }
  5511. function takeRight(array, n, guard) {
  5512. var length = array == null ? 0 : array.length;
  5513. if (!length) {
  5514. return [];
  5515. }
  5516. n = guard || n === void 0 ? 1 : toInteger(n);
  5517. n = length - n;
  5518. return baseSlice(array, n < 0 ? 0 : n, length);
  5519. }
  5520. function takeRightWhile(array, predicate) {
  5521. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  5522. }
  5523. function takeWhile(array, predicate) {
  5524. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  5525. }
  5526. function tap(value, interceptor) {
  5527. interceptor(value);
  5528. return value;
  5529. }
  5530. var objectProto$2 = Object.prototype;
  5531. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  5532. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5533. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) {
  5534. return srcValue;
  5535. }
  5536. return objValue;
  5537. }
  5538. var stringEscapes = {
  5539. "\\": "\\",
  5540. "'": "'",
  5541. "\n": "n",
  5542. "\r": "r",
  5543. "\u2028": "u2028",
  5544. "\u2029": "u2029"
  5545. };
  5546. function escapeStringChar(chr) {
  5547. return "\\" + stringEscapes[chr];
  5548. }
  5549. var reInterpolate = /<%=([\s\S]+?)%>/g;
  5550. var reEscape = /<%-([\s\S]+?)%>/g;
  5551. var reEvaluate = /<%([\s\S]+?)%>/g;
  5552. var templateSettings = {
  5553. "escape": reEscape,
  5554. "evaluate": reEvaluate,
  5555. "interpolate": reInterpolate,
  5556. "variable": "",
  5557. "imports": {
  5558. "_": { "escape": escape }
  5559. }
  5560. };
  5561. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  5562. var reEmptyStringLeading = /\b__p \+= '';/g;
  5563. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  5564. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  5565. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  5566. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  5567. var reNoMatch = /($^)/;
  5568. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  5569. var objectProto$1 = Object.prototype;
  5570. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  5571. function template(string, options, guard) {
  5572. var settings = templateSettings.imports._.templateSettings || templateSettings;
  5573. if (guard && isIterateeCall(string, options, guard)) {
  5574. options = void 0;
  5575. }
  5576. string = toString(string);
  5577. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  5578. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  5579. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  5580. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  5581. var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  5582. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  5583. interpolateValue || (interpolateValue = esTemplateValue);
  5584. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  5585. if (escapeValue) {
  5586. isEscaping = true;
  5587. source += "' +\n__e(" + escapeValue + ") +\n'";
  5588. }
  5589. if (evaluateValue) {
  5590. isEvaluating = true;
  5591. source += "';\n" + evaluateValue + ";\n__p += '";
  5592. }
  5593. if (interpolateValue) {
  5594. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  5595. }
  5596. index = offset + match.length;
  5597. return match;
  5598. });
  5599. source += "';\n";
  5600. var variable = hasOwnProperty$1.call(options, "variable") && options.variable;
  5601. if (!variable) {
  5602. source = "with (obj) {\n" + source + "\n}\n";
  5603. } else if (reForbiddenIdentifierChars.test(variable)) {
  5604. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  5605. }
  5606. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  5607. 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}";
  5608. var result = attempt(function() {
  5609. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  5610. });
  5611. result.source = source;
  5612. if (isError(result)) {
  5613. throw result;
  5614. }
  5615. return result;
  5616. }
  5617. var FUNC_ERROR_TEXT = "Expected a function";
  5618. function throttle(func, wait, options) {
  5619. var leading = true, trailing = true;
  5620. if (typeof func != "function") {
  5621. throw new TypeError(FUNC_ERROR_TEXT);
  5622. }
  5623. if (isObject(options)) {
  5624. leading = "leading" in options ? !!options.leading : leading;
  5625. trailing = "trailing" in options ? !!options.trailing : trailing;
  5626. }
  5627. return debounce(func, wait, {
  5628. "leading": leading,
  5629. "maxWait": wait,
  5630. "trailing": trailing
  5631. });
  5632. }
  5633. function thru(value, interceptor) {
  5634. return interceptor(value);
  5635. }
  5636. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  5637. var MAX_ARRAY_LENGTH$1 = 4294967295;
  5638. var nativeMin$3 = Math.min;
  5639. function times(n, iteratee) {
  5640. n = toInteger(n);
  5641. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  5642. return [];
  5643. }
  5644. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  5645. iteratee = castFunction(iteratee);
  5646. n -= MAX_ARRAY_LENGTH$1;
  5647. var result = baseTimes(length, iteratee);
  5648. while (++index < n) {
  5649. iteratee(index);
  5650. }
  5651. return result;
  5652. }
  5653. function wrapperToIterator() {
  5654. return this;
  5655. }
  5656. function baseWrapperValue(value, actions) {
  5657. var result = value;
  5658. if (result instanceof LazyWrapper) {
  5659. result = result.value();
  5660. }
  5661. return arrayReduce(actions, function(result2, action) {
  5662. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  5663. }, result);
  5664. }
  5665. function wrapperValue() {
  5666. return baseWrapperValue(this.__wrapped__, this.__actions__);
  5667. }
  5668. function toLower(value) {
  5669. return toString(value).toLowerCase();
  5670. }
  5671. function toPath(value) {
  5672. if (isArray(value)) {
  5673. return arrayMap(value, toKey);
  5674. }
  5675. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  5676. }
  5677. var MAX_SAFE_INTEGER = 9007199254740991;
  5678. function toSafeInteger(value) {
  5679. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  5680. }
  5681. function toUpper(value) {
  5682. return toString(value).toUpperCase();
  5683. }
  5684. function transform(object, iteratee, accumulator) {
  5685. var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  5686. iteratee = baseIteratee(iteratee);
  5687. if (accumulator == null) {
  5688. var Ctor = object && object.constructor;
  5689. if (isArrLike) {
  5690. accumulator = isArr ? new Ctor() : [];
  5691. } else if (isObject(object)) {
  5692. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  5693. } else {
  5694. accumulator = {};
  5695. }
  5696. }
  5697. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  5698. return iteratee(accumulator, value, index, object2);
  5699. });
  5700. return accumulator;
  5701. }
  5702. function charsEndIndex(strSymbols, chrSymbols) {
  5703. var index = strSymbols.length;
  5704. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5705. }
  5706. return index;
  5707. }
  5708. function charsStartIndex(strSymbols, chrSymbols) {
  5709. var index = -1, length = strSymbols.length;
  5710. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5711. }
  5712. return index;
  5713. }
  5714. function trim(string, chars, guard) {
  5715. string = toString(string);
  5716. if (string && (guard || chars === void 0)) {
  5717. return baseTrim(string);
  5718. }
  5719. if (!string || !(chars = baseToString(chars))) {
  5720. return string;
  5721. }
  5722. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  5723. return castSlice(strSymbols, start, end).join("");
  5724. }
  5725. function trimEnd(string, chars, guard) {
  5726. string = toString(string);
  5727. if (string && (guard || chars === void 0)) {
  5728. return string.slice(0, trimmedEndIndex(string) + 1);
  5729. }
  5730. if (!string || !(chars = baseToString(chars))) {
  5731. return string;
  5732. }
  5733. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  5734. return castSlice(strSymbols, 0, end).join("");
  5735. }
  5736. var reTrimStart = /^\s+/;
  5737. function trimStart(string, chars, guard) {
  5738. string = toString(string);
  5739. if (string && (guard || chars === void 0)) {
  5740. return string.replace(reTrimStart, "");
  5741. }
  5742. if (!string || !(chars = baseToString(chars))) {
  5743. return string;
  5744. }
  5745. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  5746. return castSlice(strSymbols, start).join("");
  5747. }
  5748. var DEFAULT_TRUNC_LENGTH = 30;
  5749. var DEFAULT_TRUNC_OMISSION = "...";
  5750. var reFlags = /\w*$/;
  5751. function truncate(string, options) {
  5752. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  5753. if (isObject(options)) {
  5754. var separator = "separator" in options ? options.separator : separator;
  5755. length = "length" in options ? toInteger(options.length) : length;
  5756. omission = "omission" in options ? baseToString(options.omission) : omission;
  5757. }
  5758. string = toString(string);
  5759. var strLength = string.length;
  5760. if (hasUnicode(string)) {
  5761. var strSymbols = stringToArray(string);
  5762. strLength = strSymbols.length;
  5763. }
  5764. if (length >= strLength) {
  5765. return string;
  5766. }
  5767. var end = length - stringSize(omission);
  5768. if (end < 1) {
  5769. return omission;
  5770. }
  5771. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  5772. if (separator === void 0) {
  5773. return result + omission;
  5774. }
  5775. if (strSymbols) {
  5776. end += result.length - end;
  5777. }
  5778. if (isRegExp(separator)) {
  5779. if (string.slice(end).search(separator)) {
  5780. var match, substring = result;
  5781. if (!separator.global) {
  5782. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  5783. }
  5784. separator.lastIndex = 0;
  5785. while (match = separator.exec(substring)) {
  5786. var newEnd = match.index;
  5787. }
  5788. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  5789. }
  5790. } else if (string.indexOf(baseToString(separator), end) != end) {
  5791. var index = result.lastIndexOf(separator);
  5792. if (index > -1) {
  5793. result = result.slice(0, index);
  5794. }
  5795. }
  5796. return result + omission;
  5797. }
  5798. function unary(func) {
  5799. return ary(func, 1);
  5800. }
  5801. var htmlUnescapes = {
  5802. "&amp;": "&",
  5803. "&lt;": "<",
  5804. "&gt;": ">",
  5805. "&quot;": '"',
  5806. "&#39;": "'"
  5807. };
  5808. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  5809. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  5810. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  5811. function unescape(string) {
  5812. string = toString(string);
  5813. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  5814. }
  5815. var INFINITY = 1 / 0;
  5816. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
  5817. return new Set$1(values);
  5818. };
  5819. var LARGE_ARRAY_SIZE = 200;
  5820. function baseUniq(array, iteratee, comparator) {
  5821. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5822. if (comparator) {
  5823. isCommon = false;
  5824. includes = arrayIncludesWith;
  5825. } else if (length >= LARGE_ARRAY_SIZE) {
  5826. var set = iteratee ? null : createSet(array);
  5827. if (set) {
  5828. return setToArray(set);
  5829. }
  5830. isCommon = false;
  5831. includes = cacheHas;
  5832. seen = new SetCache();
  5833. } else {
  5834. seen = iteratee ? [] : result;
  5835. }
  5836. outer:
  5837. while (++index < length) {
  5838. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5839. value = comparator || value !== 0 ? value : 0;
  5840. if (isCommon && computed === computed) {
  5841. var seenIndex = seen.length;
  5842. while (seenIndex--) {
  5843. if (seen[seenIndex] === computed) {
  5844. continue outer;
  5845. }
  5846. }
  5847. if (iteratee) {
  5848. seen.push(computed);
  5849. }
  5850. result.push(value);
  5851. } else if (!includes(seen, computed, comparator)) {
  5852. if (seen !== result) {
  5853. seen.push(computed);
  5854. }
  5855. result.push(value);
  5856. }
  5857. }
  5858. return result;
  5859. }
  5860. var union = baseRest(function(arrays) {
  5861. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5862. });
  5863. var unionBy = baseRest(function(arrays) {
  5864. var iteratee = last(arrays);
  5865. if (isArrayLikeObject(iteratee)) {
  5866. iteratee = void 0;
  5867. }
  5868. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  5869. });
  5870. var unionWith = baseRest(function(arrays) {
  5871. var comparator = last(arrays);
  5872. comparator = typeof comparator == "function" ? comparator : void 0;
  5873. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  5874. });
  5875. function uniq(array) {
  5876. return array && array.length ? baseUniq(array) : [];
  5877. }
  5878. function uniqBy(array, iteratee) {
  5879. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  5880. }
  5881. function uniqWith(array, comparator) {
  5882. comparator = typeof comparator == "function" ? comparator : void 0;
  5883. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  5884. }
  5885. var idCounter = 0;
  5886. function uniqueId(prefix) {
  5887. var id = ++idCounter;
  5888. return toString(prefix) + id;
  5889. }
  5890. function unset(object, path) {
  5891. return object == null ? true : baseUnset(object, path);
  5892. }
  5893. var nativeMax$2 = Math.max;
  5894. function unzip(array) {
  5895. if (!(array && array.length)) {
  5896. return [];
  5897. }
  5898. var length = 0;
  5899. array = arrayFilter(array, function(group) {
  5900. if (isArrayLikeObject(group)) {
  5901. length = nativeMax$2(group.length, length);
  5902. return true;
  5903. }
  5904. });
  5905. return baseTimes(length, function(index) {
  5906. return arrayMap(array, baseProperty(index));
  5907. });
  5908. }
  5909. function unzipWith(array, iteratee) {
  5910. if (!(array && array.length)) {
  5911. return [];
  5912. }
  5913. var result = unzip(array);
  5914. if (iteratee == null) {
  5915. return result;
  5916. }
  5917. return arrayMap(result, function(group) {
  5918. return apply(iteratee, void 0, group);
  5919. });
  5920. }
  5921. function baseUpdate(object, path, updater, customizer) {
  5922. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5923. }
  5924. function update(object, path, updater) {
  5925. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  5926. }
  5927. function updateWith(object, path, updater, customizer) {
  5928. customizer = typeof customizer == "function" ? customizer : void 0;
  5929. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  5930. }
  5931. var upperCase = createCompounder(function(result, word, index) {
  5932. return result + (index ? " " : "") + word.toUpperCase();
  5933. });
  5934. function valuesIn(object) {
  5935. return object == null ? [] : baseValues(object, keysIn(object));
  5936. }
  5937. var without = baseRest(function(array, values) {
  5938. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  5939. });
  5940. function wrap(value, wrapper) {
  5941. return partial(castFunction(wrapper), value);
  5942. }
  5943. var wrapperAt = flatRest(function(paths) {
  5944. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  5945. return baseAt(object, paths);
  5946. };
  5947. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  5948. return this.thru(interceptor);
  5949. }
  5950. value = value.slice(start, +start + (length ? 1 : 0));
  5951. value.__actions__.push({
  5952. "func": thru,
  5953. "args": [interceptor],
  5954. "thisArg": void 0
  5955. });
  5956. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  5957. if (length && !array.length) {
  5958. array.push(void 0);
  5959. }
  5960. return array;
  5961. });
  5962. });
  5963. function wrapperChain() {
  5964. return chain(this);
  5965. }
  5966. function wrapperReverse() {
  5967. var value = this.__wrapped__;
  5968. if (value instanceof LazyWrapper) {
  5969. var wrapped = value;
  5970. if (this.__actions__.length) {
  5971. wrapped = new LazyWrapper(this);
  5972. }
  5973. wrapped = wrapped.reverse();
  5974. wrapped.__actions__.push({
  5975. "func": thru,
  5976. "args": [reverse],
  5977. "thisArg": void 0
  5978. });
  5979. return new LodashWrapper(wrapped, this.__chain__);
  5980. }
  5981. return this.thru(reverse);
  5982. }
  5983. function baseXor(arrays, iteratee, comparator) {
  5984. var length = arrays.length;
  5985. if (length < 2) {
  5986. return length ? baseUniq(arrays[0]) : [];
  5987. }
  5988. var index = -1, result = Array(length);
  5989. while (++index < length) {
  5990. var array = arrays[index], othIndex = -1;
  5991. while (++othIndex < length) {
  5992. if (othIndex != index) {
  5993. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5994. }
  5995. }
  5996. }
  5997. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5998. }
  5999. var xor = baseRest(function(arrays) {
  6000. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  6001. });
  6002. var xorBy = baseRest(function(arrays) {
  6003. var iteratee = last(arrays);
  6004. if (isArrayLikeObject(iteratee)) {
  6005. iteratee = void 0;
  6006. }
  6007. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  6008. });
  6009. var xorWith = baseRest(function(arrays) {
  6010. var comparator = last(arrays);
  6011. comparator = typeof comparator == "function" ? comparator : void 0;
  6012. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  6013. });
  6014. var zip = baseRest(unzip);
  6015. function baseZipObject(props, values, assignFunc) {
  6016. var index = -1, length = props.length, valsLength = values.length, result = {};
  6017. while (++index < length) {
  6018. var value = index < valsLength ? values[index] : void 0;
  6019. assignFunc(result, props[index], value);
  6020. }
  6021. return result;
  6022. }
  6023. function zipObject(props, values) {
  6024. return baseZipObject(props || [], values || [], assignValue);
  6025. }
  6026. function zipObjectDeep(props, values) {
  6027. return baseZipObject(props || [], values || [], baseSet);
  6028. }
  6029. var zipWith = baseRest(function(arrays) {
  6030. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  6031. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  6032. return unzipWith(arrays, iteratee);
  6033. });
  6034. var array = {
  6035. chunk,
  6036. compact,
  6037. concat,
  6038. difference,
  6039. differenceBy,
  6040. differenceWith,
  6041. drop,
  6042. dropRight,
  6043. dropRightWhile,
  6044. dropWhile,
  6045. fill,
  6046. findIndex,
  6047. findLastIndex,
  6048. first: head,
  6049. flatten,
  6050. flattenDeep,
  6051. flattenDepth,
  6052. fromPairs,
  6053. head,
  6054. indexOf,
  6055. initial: initial$1,
  6056. intersection,
  6057. intersectionBy,
  6058. intersectionWith,
  6059. join,
  6060. last,
  6061. lastIndexOf,
  6062. nth,
  6063. pull,
  6064. pullAll,
  6065. pullAllBy,
  6066. pullAllWith,
  6067. pullAt,
  6068. remove,
  6069. reverse,
  6070. slice,
  6071. sortedIndex,
  6072. sortedIndexBy,
  6073. sortedIndexOf,
  6074. sortedLastIndex,
  6075. sortedLastIndexBy,
  6076. sortedLastIndexOf,
  6077. sortedUniq,
  6078. sortedUniqBy,
  6079. tail,
  6080. take,
  6081. takeRight,
  6082. takeRightWhile,
  6083. takeWhile,
  6084. union,
  6085. unionBy,
  6086. unionWith,
  6087. uniq,
  6088. uniqBy,
  6089. uniqWith,
  6090. unzip,
  6091. unzipWith,
  6092. without,
  6093. xor,
  6094. xorBy,
  6095. xorWith,
  6096. zip,
  6097. zipObject,
  6098. zipObjectDeep,
  6099. zipWith
  6100. };
  6101. var collection = {
  6102. countBy,
  6103. each: forEach,
  6104. eachRight: forEachRight,
  6105. every,
  6106. filter,
  6107. find,
  6108. findLast,
  6109. flatMap,
  6110. flatMapDeep,
  6111. flatMapDepth,
  6112. forEach,
  6113. forEachRight,
  6114. groupBy,
  6115. includes,
  6116. invokeMap,
  6117. keyBy,
  6118. map,
  6119. orderBy: orderBy$1,
  6120. partition,
  6121. reduce,
  6122. reduceRight,
  6123. reject,
  6124. sample,
  6125. sampleSize,
  6126. shuffle,
  6127. size,
  6128. some,
  6129. sortBy
  6130. };
  6131. var date = {
  6132. now
  6133. };
  6134. var func = {
  6135. after,
  6136. ary,
  6137. before,
  6138. bind,
  6139. bindKey,
  6140. curry,
  6141. curryRight,
  6142. debounce,
  6143. defer,
  6144. delay,
  6145. flip: flip$1,
  6146. memoize,
  6147. negate,
  6148. once,
  6149. overArgs,
  6150. partial,
  6151. partialRight,
  6152. rearg,
  6153. rest,
  6154. spread,
  6155. throttle,
  6156. unary,
  6157. wrap
  6158. };
  6159. var lang = {
  6160. castArray: castArray$1,
  6161. clone,
  6162. cloneDeep,
  6163. cloneDeepWith,
  6164. cloneWith,
  6165. conformsTo,
  6166. eq,
  6167. gt: gt$1,
  6168. gte,
  6169. isArguments,
  6170. isArray,
  6171. isArrayBuffer,
  6172. isArrayLike,
  6173. isArrayLikeObject,
  6174. isBoolean: isBoolean$1,
  6175. isBuffer,
  6176. isDate,
  6177. isElement: isElement$2,
  6178. isEmpty: isEmpty$1,
  6179. isEqual: isEqual$1,
  6180. isEqualWith,
  6181. isError,
  6182. isFinite,
  6183. isFunction,
  6184. isInteger,
  6185. isLength,
  6186. isMap,
  6187. isMatch,
  6188. isMatchWith,
  6189. isNaN: isNaN$1,
  6190. isNative,
  6191. isNil,
  6192. isNull,
  6193. isNumber: isNumber$1,
  6194. isObject,
  6195. isObjectLike,
  6196. isPlainObject,
  6197. isRegExp,
  6198. isSafeInteger,
  6199. isSet,
  6200. isString,
  6201. isSymbol,
  6202. isTypedArray,
  6203. isUndefined: isUndefined$1,
  6204. isWeakMap,
  6205. isWeakSet,
  6206. lt: lt$1,
  6207. lte,
  6208. toArray,
  6209. toFinite,
  6210. toInteger,
  6211. toLength,
  6212. toNumber,
  6213. toPlainObject,
  6214. toSafeInteger,
  6215. toString
  6216. };
  6217. var math = {
  6218. add,
  6219. ceil,
  6220. divide,
  6221. floor: floor$1,
  6222. max: max$3,
  6223. maxBy,
  6224. mean,
  6225. meanBy,
  6226. min: min$3,
  6227. minBy,
  6228. multiply,
  6229. round: round$1,
  6230. subtract,
  6231. sum: sum$1,
  6232. sumBy
  6233. };
  6234. var number = {
  6235. clamp,
  6236. inRange,
  6237. random
  6238. };
  6239. var object = {
  6240. assign,
  6241. assignIn,
  6242. assignInWith,
  6243. assignWith,
  6244. at: at$1,
  6245. create,
  6246. defaults,
  6247. defaultsDeep,
  6248. entries: toPairs,
  6249. entriesIn: toPairsIn,
  6250. extend: assignIn,
  6251. extendWith: assignInWith,
  6252. findKey,
  6253. findLastKey,
  6254. forIn,
  6255. forInRight,
  6256. forOwn,
  6257. forOwnRight,
  6258. functions,
  6259. functionsIn,
  6260. get,
  6261. has,
  6262. hasIn,
  6263. invert,
  6264. invertBy,
  6265. invoke,
  6266. keys,
  6267. keysIn,
  6268. mapKeys,
  6269. mapValues,
  6270. merge,
  6271. mergeWith,
  6272. omit,
  6273. omitBy,
  6274. pick,
  6275. pickBy,
  6276. result,
  6277. set,
  6278. setWith,
  6279. toPairs,
  6280. toPairsIn,
  6281. transform,
  6282. unset,
  6283. update,
  6284. updateWith,
  6285. values,
  6286. valuesIn
  6287. };
  6288. var seq = {
  6289. at: wrapperAt,
  6290. chain,
  6291. commit: wrapperCommit,
  6292. lodash,
  6293. next: wrapperNext,
  6294. plant: wrapperPlant,
  6295. reverse: wrapperReverse,
  6296. tap,
  6297. thru,
  6298. toIterator: wrapperToIterator,
  6299. toJSON: wrapperValue,
  6300. value: wrapperValue,
  6301. valueOf: wrapperValue,
  6302. wrapperChain
  6303. };
  6304. var string$1 = {
  6305. camelCase,
  6306. capitalize: capitalize$1,
  6307. deburr,
  6308. endsWith,
  6309. escape,
  6310. escapeRegExp,
  6311. kebabCase,
  6312. lowerCase,
  6313. lowerFirst,
  6314. pad,
  6315. padEnd,
  6316. padStart,
  6317. parseInt: parseInt$1,
  6318. repeat,
  6319. replace,
  6320. snakeCase,
  6321. split,
  6322. startCase,
  6323. startsWith,
  6324. template,
  6325. templateSettings,
  6326. toLower,
  6327. toUpper,
  6328. trim,
  6329. trimEnd,
  6330. trimStart,
  6331. truncate,
  6332. unescape,
  6333. upperCase,
  6334. upperFirst,
  6335. words
  6336. };
  6337. var util = {
  6338. attempt,
  6339. bindAll,
  6340. cond,
  6341. conforms,
  6342. constant,
  6343. defaultTo,
  6344. flow,
  6345. flowRight,
  6346. identity,
  6347. iteratee,
  6348. matches,
  6349. matchesProperty,
  6350. method,
  6351. methodOf,
  6352. mixin: mixin$1,
  6353. noop,
  6354. nthArg,
  6355. over,
  6356. overEvery,
  6357. overSome,
  6358. property,
  6359. propertyOf,
  6360. range: range$1,
  6361. rangeRight,
  6362. stubArray,
  6363. stubFalse,
  6364. stubObject,
  6365. stubString,
  6366. stubTrue,
  6367. times,
  6368. toPath,
  6369. uniqueId
  6370. };
  6371. function lazyClone() {
  6372. var result = new LazyWrapper(this.__wrapped__);
  6373. result.__actions__ = copyArray(this.__actions__);
  6374. result.__dir__ = this.__dir__;
  6375. result.__filtered__ = this.__filtered__;
  6376. result.__iteratees__ = copyArray(this.__iteratees__);
  6377. result.__takeCount__ = this.__takeCount__;
  6378. result.__views__ = copyArray(this.__views__);
  6379. return result;
  6380. }
  6381. function lazyReverse() {
  6382. if (this.__filtered__) {
  6383. var result = new LazyWrapper(this);
  6384. result.__dir__ = -1;
  6385. result.__filtered__ = true;
  6386. } else {
  6387. result = this.clone();
  6388. result.__dir__ *= -1;
  6389. }
  6390. return result;
  6391. }
  6392. var nativeMax$1 = Math.max;
  6393. var nativeMin$2 = Math.min;
  6394. function getView(start, end, transforms) {
  6395. var index = -1, length = transforms.length;
  6396. while (++index < length) {
  6397. var data = transforms[index], size = data.size;
  6398. switch (data.type) {
  6399. case "drop":
  6400. start += size;
  6401. break;
  6402. case "dropRight":
  6403. end -= size;
  6404. break;
  6405. case "take":
  6406. end = nativeMin$2(end, start + size);
  6407. break;
  6408. case "takeRight":
  6409. start = nativeMax$1(start, end - size);
  6410. break;
  6411. }
  6412. }
  6413. return { "start": start, "end": end };
  6414. }
  6415. var LAZY_FILTER_FLAG$1 = 1;
  6416. var LAZY_MAP_FLAG = 2;
  6417. var nativeMin$1 = Math.min;
  6418. function lazyValue() {
  6419. 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__);
  6420. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  6421. return baseWrapperValue(array, this.__actions__);
  6422. }
  6423. var result = [];
  6424. outer:
  6425. while (length-- && resIndex < takeCount) {
  6426. index += dir;
  6427. var iterIndex = -1, value = array[index];
  6428. while (++iterIndex < iterLength) {
  6429. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  6430. if (type == LAZY_MAP_FLAG) {
  6431. value = computed;
  6432. } else if (!computed) {
  6433. if (type == LAZY_FILTER_FLAG$1) {
  6434. continue outer;
  6435. } else {
  6436. break outer;
  6437. }
  6438. }
  6439. }
  6440. result[resIndex++] = value;
  6441. }
  6442. return result;
  6443. }
  6444. var VERSION = "4.17.21";
  6445. var WRAP_BIND_KEY_FLAG = 2;
  6446. var LAZY_FILTER_FLAG = 1;
  6447. var LAZY_WHILE_FLAG = 3;
  6448. var MAX_ARRAY_LENGTH = 4294967295;
  6449. var arrayProto = Array.prototype;
  6450. var objectProto = Object.prototype;
  6451. var hasOwnProperty = objectProto.hasOwnProperty;
  6452. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  6453. var nativeMax = Math.max;
  6454. var nativeMin = Math.min;
  6455. var mixin = function(func2) {
  6456. return function(object2, source, options) {
  6457. if (options == null) {
  6458. var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  6459. if (!(methodNames ? methodNames.length : isObj)) {
  6460. options = source;
  6461. source = object2;
  6462. object2 = this;
  6463. }
  6464. }
  6465. return func2(object2, source, options);
  6466. };
  6467. }(mixin$1);
  6468. lodash.after = func.after;
  6469. lodash.ary = func.ary;
  6470. lodash.assign = object.assign;
  6471. lodash.assignIn = object.assignIn;
  6472. lodash.assignInWith = object.assignInWith;
  6473. lodash.assignWith = object.assignWith;
  6474. lodash.at = object.at;
  6475. lodash.before = func.before;
  6476. lodash.bind = func.bind;
  6477. lodash.bindAll = util.bindAll;
  6478. lodash.bindKey = func.bindKey;
  6479. lodash.castArray = lang.castArray;
  6480. lodash.chain = seq.chain;
  6481. lodash.chunk = array.chunk;
  6482. lodash.compact = array.compact;
  6483. lodash.concat = array.concat;
  6484. lodash.cond = util.cond;
  6485. lodash.conforms = util.conforms;
  6486. lodash.constant = util.constant;
  6487. lodash.countBy = collection.countBy;
  6488. lodash.create = object.create;
  6489. lodash.curry = func.curry;
  6490. lodash.curryRight = func.curryRight;
  6491. lodash.debounce = func.debounce;
  6492. lodash.defaults = object.defaults;
  6493. lodash.defaultsDeep = object.defaultsDeep;
  6494. lodash.defer = func.defer;
  6495. lodash.delay = func.delay;
  6496. lodash.difference = array.difference;
  6497. lodash.differenceBy = array.differenceBy;
  6498. lodash.differenceWith = array.differenceWith;
  6499. lodash.drop = array.drop;
  6500. lodash.dropRight = array.dropRight;
  6501. lodash.dropRightWhile = array.dropRightWhile;
  6502. lodash.dropWhile = array.dropWhile;
  6503. lodash.fill = array.fill;
  6504. lodash.filter = collection.filter;
  6505. lodash.flatMap = collection.flatMap;
  6506. lodash.flatMapDeep = collection.flatMapDeep;
  6507. lodash.flatMapDepth = collection.flatMapDepth;
  6508. lodash.flatten = array.flatten;
  6509. lodash.flattenDeep = array.flattenDeep;
  6510. lodash.flattenDepth = array.flattenDepth;
  6511. lodash.flip = func.flip;
  6512. lodash.flow = util.flow;
  6513. lodash.flowRight = util.flowRight;
  6514. lodash.fromPairs = array.fromPairs;
  6515. lodash.functions = object.functions;
  6516. lodash.functionsIn = object.functionsIn;
  6517. lodash.groupBy = collection.groupBy;
  6518. lodash.initial = array.initial;
  6519. lodash.intersection = array.intersection;
  6520. lodash.intersectionBy = array.intersectionBy;
  6521. lodash.intersectionWith = array.intersectionWith;
  6522. lodash.invert = object.invert;
  6523. lodash.invertBy = object.invertBy;
  6524. lodash.invokeMap = collection.invokeMap;
  6525. lodash.iteratee = util.iteratee;
  6526. lodash.keyBy = collection.keyBy;
  6527. lodash.keys = keys;
  6528. lodash.keysIn = object.keysIn;
  6529. lodash.map = collection.map;
  6530. lodash.mapKeys = object.mapKeys;
  6531. lodash.mapValues = object.mapValues;
  6532. lodash.matches = util.matches;
  6533. lodash.matchesProperty = util.matchesProperty;
  6534. lodash.memoize = func.memoize;
  6535. lodash.merge = object.merge;
  6536. lodash.mergeWith = object.mergeWith;
  6537. lodash.method = util.method;
  6538. lodash.methodOf = util.methodOf;
  6539. lodash.mixin = mixin;
  6540. lodash.negate = negate;
  6541. lodash.nthArg = util.nthArg;
  6542. lodash.omit = object.omit;
  6543. lodash.omitBy = object.omitBy;
  6544. lodash.once = func.once;
  6545. lodash.orderBy = collection.orderBy;
  6546. lodash.over = util.over;
  6547. lodash.overArgs = func.overArgs;
  6548. lodash.overEvery = util.overEvery;
  6549. lodash.overSome = util.overSome;
  6550. lodash.partial = func.partial;
  6551. lodash.partialRight = func.partialRight;
  6552. lodash.partition = collection.partition;
  6553. lodash.pick = object.pick;
  6554. lodash.pickBy = object.pickBy;
  6555. lodash.property = util.property;
  6556. lodash.propertyOf = util.propertyOf;
  6557. lodash.pull = array.pull;
  6558. lodash.pullAll = array.pullAll;
  6559. lodash.pullAllBy = array.pullAllBy;
  6560. lodash.pullAllWith = array.pullAllWith;
  6561. lodash.pullAt = array.pullAt;
  6562. lodash.range = util.range;
  6563. lodash.rangeRight = util.rangeRight;
  6564. lodash.rearg = func.rearg;
  6565. lodash.reject = collection.reject;
  6566. lodash.remove = array.remove;
  6567. lodash.rest = func.rest;
  6568. lodash.reverse = array.reverse;
  6569. lodash.sampleSize = collection.sampleSize;
  6570. lodash.set = object.set;
  6571. lodash.setWith = object.setWith;
  6572. lodash.shuffle = collection.shuffle;
  6573. lodash.slice = array.slice;
  6574. lodash.sortBy = collection.sortBy;
  6575. lodash.sortedUniq = array.sortedUniq;
  6576. lodash.sortedUniqBy = array.sortedUniqBy;
  6577. lodash.split = string$1.split;
  6578. lodash.spread = func.spread;
  6579. lodash.tail = array.tail;
  6580. lodash.take = array.take;
  6581. lodash.takeRight = array.takeRight;
  6582. lodash.takeRightWhile = array.takeRightWhile;
  6583. lodash.takeWhile = array.takeWhile;
  6584. lodash.tap = seq.tap;
  6585. lodash.throttle = func.throttle;
  6586. lodash.thru = thru;
  6587. lodash.toArray = lang.toArray;
  6588. lodash.toPairs = object.toPairs;
  6589. lodash.toPairsIn = object.toPairsIn;
  6590. lodash.toPath = util.toPath;
  6591. lodash.toPlainObject = lang.toPlainObject;
  6592. lodash.transform = object.transform;
  6593. lodash.unary = func.unary;
  6594. lodash.union = array.union;
  6595. lodash.unionBy = array.unionBy;
  6596. lodash.unionWith = array.unionWith;
  6597. lodash.uniq = array.uniq;
  6598. lodash.uniqBy = array.uniqBy;
  6599. lodash.uniqWith = array.uniqWith;
  6600. lodash.unset = object.unset;
  6601. lodash.unzip = array.unzip;
  6602. lodash.unzipWith = array.unzipWith;
  6603. lodash.update = object.update;
  6604. lodash.updateWith = object.updateWith;
  6605. lodash.values = object.values;
  6606. lodash.valuesIn = object.valuesIn;
  6607. lodash.without = array.without;
  6608. lodash.words = string$1.words;
  6609. lodash.wrap = func.wrap;
  6610. lodash.xor = array.xor;
  6611. lodash.xorBy = array.xorBy;
  6612. lodash.xorWith = array.xorWith;
  6613. lodash.zip = array.zip;
  6614. lodash.zipObject = array.zipObject;
  6615. lodash.zipObjectDeep = array.zipObjectDeep;
  6616. lodash.zipWith = array.zipWith;
  6617. lodash.entries = object.toPairs;
  6618. lodash.entriesIn = object.toPairsIn;
  6619. lodash.extend = object.assignIn;
  6620. lodash.extendWith = object.assignInWith;
  6621. mixin(lodash, lodash);
  6622. lodash.add = math.add;
  6623. lodash.attempt = util.attempt;
  6624. lodash.camelCase = string$1.camelCase;
  6625. lodash.capitalize = string$1.capitalize;
  6626. lodash.ceil = math.ceil;
  6627. lodash.clamp = number.clamp;
  6628. lodash.clone = lang.clone;
  6629. lodash.cloneDeep = lang.cloneDeep;
  6630. lodash.cloneDeepWith = lang.cloneDeepWith;
  6631. lodash.cloneWith = lang.cloneWith;
  6632. lodash.conformsTo = lang.conformsTo;
  6633. lodash.deburr = string$1.deburr;
  6634. lodash.defaultTo = util.defaultTo;
  6635. lodash.divide = math.divide;
  6636. lodash.endsWith = string$1.endsWith;
  6637. lodash.eq = lang.eq;
  6638. lodash.escape = string$1.escape;
  6639. lodash.escapeRegExp = string$1.escapeRegExp;
  6640. lodash.every = collection.every;
  6641. lodash.find = collection.find;
  6642. lodash.findIndex = array.findIndex;
  6643. lodash.findKey = object.findKey;
  6644. lodash.findLast = collection.findLast;
  6645. lodash.findLastIndex = array.findLastIndex;
  6646. lodash.findLastKey = object.findLastKey;
  6647. lodash.floor = math.floor;
  6648. lodash.forEach = collection.forEach;
  6649. lodash.forEachRight = collection.forEachRight;
  6650. lodash.forIn = object.forIn;
  6651. lodash.forInRight = object.forInRight;
  6652. lodash.forOwn = object.forOwn;
  6653. lodash.forOwnRight = object.forOwnRight;
  6654. lodash.get = object.get;
  6655. lodash.gt = lang.gt;
  6656. lodash.gte = lang.gte;
  6657. lodash.has = object.has;
  6658. lodash.hasIn = object.hasIn;
  6659. lodash.head = array.head;
  6660. lodash.identity = identity;
  6661. lodash.includes = collection.includes;
  6662. lodash.indexOf = array.indexOf;
  6663. lodash.inRange = number.inRange;
  6664. lodash.invoke = object.invoke;
  6665. lodash.isArguments = lang.isArguments;
  6666. lodash.isArray = isArray;
  6667. lodash.isArrayBuffer = lang.isArrayBuffer;
  6668. lodash.isArrayLike = lang.isArrayLike;
  6669. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  6670. lodash.isBoolean = lang.isBoolean;
  6671. lodash.isBuffer = lang.isBuffer;
  6672. lodash.isDate = lang.isDate;
  6673. lodash.isElement = lang.isElement;
  6674. lodash.isEmpty = lang.isEmpty;
  6675. lodash.isEqual = lang.isEqual;
  6676. lodash.isEqualWith = lang.isEqualWith;
  6677. lodash.isError = lang.isError;
  6678. lodash.isFinite = lang.isFinite;
  6679. lodash.isFunction = lang.isFunction;
  6680. lodash.isInteger = lang.isInteger;
  6681. lodash.isLength = lang.isLength;
  6682. lodash.isMap = lang.isMap;
  6683. lodash.isMatch = lang.isMatch;
  6684. lodash.isMatchWith = lang.isMatchWith;
  6685. lodash.isNaN = lang.isNaN;
  6686. lodash.isNative = lang.isNative;
  6687. lodash.isNil = lang.isNil;
  6688. lodash.isNull = lang.isNull;
  6689. lodash.isNumber = lang.isNumber;
  6690. lodash.isObject = isObject;
  6691. lodash.isObjectLike = lang.isObjectLike;
  6692. lodash.isPlainObject = lang.isPlainObject;
  6693. lodash.isRegExp = lang.isRegExp;
  6694. lodash.isSafeInteger = lang.isSafeInteger;
  6695. lodash.isSet = lang.isSet;
  6696. lodash.isString = lang.isString;
  6697. lodash.isSymbol = lang.isSymbol;
  6698. lodash.isTypedArray = lang.isTypedArray;
  6699. lodash.isUndefined = lang.isUndefined;
  6700. lodash.isWeakMap = lang.isWeakMap;
  6701. lodash.isWeakSet = lang.isWeakSet;
  6702. lodash.join = array.join;
  6703. lodash.kebabCase = string$1.kebabCase;
  6704. lodash.last = last;
  6705. lodash.lastIndexOf = array.lastIndexOf;
  6706. lodash.lowerCase = string$1.lowerCase;
  6707. lodash.lowerFirst = string$1.lowerFirst;
  6708. lodash.lt = lang.lt;
  6709. lodash.lte = lang.lte;
  6710. lodash.max = math.max;
  6711. lodash.maxBy = math.maxBy;
  6712. lodash.mean = math.mean;
  6713. lodash.meanBy = math.meanBy;
  6714. lodash.min = math.min;
  6715. lodash.minBy = math.minBy;
  6716. lodash.stubArray = util.stubArray;
  6717. lodash.stubFalse = util.stubFalse;
  6718. lodash.stubObject = util.stubObject;
  6719. lodash.stubString = util.stubString;
  6720. lodash.stubTrue = util.stubTrue;
  6721. lodash.multiply = math.multiply;
  6722. lodash.nth = array.nth;
  6723. lodash.noop = util.noop;
  6724. lodash.now = date.now;
  6725. lodash.pad = string$1.pad;
  6726. lodash.padEnd = string$1.padEnd;
  6727. lodash.padStart = string$1.padStart;
  6728. lodash.parseInt = string$1.parseInt;
  6729. lodash.random = number.random;
  6730. lodash.reduce = collection.reduce;
  6731. lodash.reduceRight = collection.reduceRight;
  6732. lodash.repeat = string$1.repeat;
  6733. lodash.replace = string$1.replace;
  6734. lodash.result = object.result;
  6735. lodash.round = math.round;
  6736. lodash.sample = collection.sample;
  6737. lodash.size = collection.size;
  6738. lodash.snakeCase = string$1.snakeCase;
  6739. lodash.some = collection.some;
  6740. lodash.sortedIndex = array.sortedIndex;
  6741. lodash.sortedIndexBy = array.sortedIndexBy;
  6742. lodash.sortedIndexOf = array.sortedIndexOf;
  6743. lodash.sortedLastIndex = array.sortedLastIndex;
  6744. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  6745. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  6746. lodash.startCase = string$1.startCase;
  6747. lodash.startsWith = string$1.startsWith;
  6748. lodash.subtract = math.subtract;
  6749. lodash.sum = math.sum;
  6750. lodash.sumBy = math.sumBy;
  6751. lodash.template = string$1.template;
  6752. lodash.times = util.times;
  6753. lodash.toFinite = lang.toFinite;
  6754. lodash.toInteger = toInteger;
  6755. lodash.toLength = lang.toLength;
  6756. lodash.toLower = string$1.toLower;
  6757. lodash.toNumber = lang.toNumber;
  6758. lodash.toSafeInteger = lang.toSafeInteger;
  6759. lodash.toString = lang.toString;
  6760. lodash.toUpper = string$1.toUpper;
  6761. lodash.trim = string$1.trim;
  6762. lodash.trimEnd = string$1.trimEnd;
  6763. lodash.trimStart = string$1.trimStart;
  6764. lodash.truncate = string$1.truncate;
  6765. lodash.unescape = string$1.unescape;
  6766. lodash.uniqueId = util.uniqueId;
  6767. lodash.upperCase = string$1.upperCase;
  6768. lodash.upperFirst = string$1.upperFirst;
  6769. lodash.each = collection.forEach;
  6770. lodash.eachRight = collection.forEachRight;
  6771. lodash.first = array.head;
  6772. mixin(lodash, function() {
  6773. var source = {};
  6774. baseForOwn(lodash, function(func2, methodName) {
  6775. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  6776. source[methodName] = func2;
  6777. }
  6778. });
  6779. return source;
  6780. }(), { "chain": false });
  6781. lodash.VERSION = VERSION;
  6782. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  6783. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  6784. lodash[methodName].placeholder = lodash;
  6785. });
  6786. arrayEach(["drop", "take"], function(methodName, index) {
  6787. LazyWrapper.prototype[methodName] = function(n) {
  6788. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  6789. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  6790. if (result.__filtered__) {
  6791. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  6792. } else {
  6793. result.__views__.push({
  6794. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  6795. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  6796. });
  6797. }
  6798. return result;
  6799. };
  6800. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  6801. return this.reverse()[methodName](n).reverse();
  6802. };
  6803. });
  6804. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  6805. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  6806. LazyWrapper.prototype[methodName] = function(iteratee) {
  6807. var result = this.clone();
  6808. result.__iteratees__.push({
  6809. "iteratee": baseIteratee(iteratee),
  6810. "type": type
  6811. });
  6812. result.__filtered__ = result.__filtered__ || isFilter;
  6813. return result;
  6814. };
  6815. });
  6816. arrayEach(["head", "last"], function(methodName, index) {
  6817. var takeName = "take" + (index ? "Right" : "");
  6818. LazyWrapper.prototype[methodName] = function() {
  6819. return this[takeName](1).value()[0];
  6820. };
  6821. });
  6822. arrayEach(["initial", "tail"], function(methodName, index) {
  6823. var dropName = "drop" + (index ? "" : "Right");
  6824. LazyWrapper.prototype[methodName] = function() {
  6825. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  6826. };
  6827. });
  6828. LazyWrapper.prototype.compact = function() {
  6829. return this.filter(identity);
  6830. };
  6831. LazyWrapper.prototype.find = function(predicate) {
  6832. return this.filter(predicate).head();
  6833. };
  6834. LazyWrapper.prototype.findLast = function(predicate) {
  6835. return this.reverse().find(predicate);
  6836. };
  6837. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  6838. if (typeof path == "function") {
  6839. return new LazyWrapper(this);
  6840. }
  6841. return this.map(function(value) {
  6842. return baseInvoke(value, path, args);
  6843. });
  6844. });
  6845. LazyWrapper.prototype.reject = function(predicate) {
  6846. return this.filter(negate(baseIteratee(predicate)));
  6847. };
  6848. LazyWrapper.prototype.slice = function(start, end) {
  6849. start = toInteger(start);
  6850. var result = this;
  6851. if (result.__filtered__ && (start > 0 || end < 0)) {
  6852. return new LazyWrapper(result);
  6853. }
  6854. if (start < 0) {
  6855. result = result.takeRight(-start);
  6856. } else if (start) {
  6857. result = result.drop(start);
  6858. }
  6859. if (end !== void 0) {
  6860. end = toInteger(end);
  6861. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  6862. }
  6863. return result;
  6864. };
  6865. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  6866. return this.reverse().takeWhile(predicate).reverse();
  6867. };
  6868. LazyWrapper.prototype.toArray = function() {
  6869. return this.take(MAX_ARRAY_LENGTH);
  6870. };
  6871. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6872. 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);
  6873. if (!lodashFunc) {
  6874. return;
  6875. }
  6876. lodash.prototype[methodName] = function() {
  6877. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value);
  6878. var interceptor = function(value2) {
  6879. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  6880. return isTaker && chainAll ? result2[0] : result2;
  6881. };
  6882. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  6883. isLazy = useLazy = false;
  6884. }
  6885. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  6886. if (!retUnwrapped && useLazy) {
  6887. value = onlyLazy ? value : new LazyWrapper(this);
  6888. var result = func2.apply(value, args);
  6889. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  6890. return new LodashWrapper(result, chainAll);
  6891. }
  6892. if (isUnwrapped && onlyLazy) {
  6893. return func2.apply(this, args);
  6894. }
  6895. result = this.thru(interceptor);
  6896. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  6897. };
  6898. });
  6899. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  6900. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  6901. lodash.prototype[methodName] = function() {
  6902. var args = arguments;
  6903. if (retUnwrapped && !this.__chain__) {
  6904. var value = this.value();
  6905. return func2.apply(isArray(value) ? value : [], args);
  6906. }
  6907. return this[chainName](function(value2) {
  6908. return func2.apply(isArray(value2) ? value2 : [], args);
  6909. });
  6910. };
  6911. });
  6912. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6913. var lodashFunc = lodash[methodName];
  6914. if (lodashFunc) {
  6915. var key = lodashFunc.name + "";
  6916. if (!hasOwnProperty.call(realNames, key)) {
  6917. realNames[key] = [];
  6918. }
  6919. realNames[key].push({ "name": methodName, "func": lodashFunc });
  6920. }
  6921. });
  6922. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  6923. "name": "wrapper",
  6924. "func": void 0
  6925. }];
  6926. LazyWrapper.prototype.clone = lazyClone;
  6927. LazyWrapper.prototype.reverse = lazyReverse;
  6928. LazyWrapper.prototype.value = lazyValue;
  6929. lodash.prototype.at = seq.at;
  6930. lodash.prototype.chain = seq.wrapperChain;
  6931. lodash.prototype.commit = seq.commit;
  6932. lodash.prototype.next = seq.next;
  6933. lodash.prototype.plant = seq.plant;
  6934. lodash.prototype.reverse = seq.reverse;
  6935. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  6936. lodash.prototype.first = lodash.prototype.head;
  6937. if (symIterator) {
  6938. lodash.prototype[symIterator] = seq.toIterator;
  6939. }
  6940. /**
  6941. * @license
  6942. * Lodash (Custom Build) <https://lodash.com/>
  6943. * Build: `lodash modularize exports="es" -o ./`
  6944. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  6945. * Released under MIT license <https://lodash.com/license>
  6946. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6947. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6948. */
  6949. const isUndefined = (val) => val === void 0;
  6950. const isBoolean = (val) => typeof val === "boolean";
  6951. const isNumber = (val) => typeof val === "number";
  6952. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  6953. const isElement$1 = (e) => {
  6954. if (typeof Element === "undefined")
  6955. return false;
  6956. return e instanceof Element;
  6957. };
  6958. const isPropAbsent = (prop) => {
  6959. return isNil(prop);
  6960. };
  6961. const isStringNumber = (val) => {
  6962. if (!isString$1(val)) {
  6963. return false;
  6964. }
  6965. return !Number.isNaN(Number(val));
  6966. };
  6967. const isWindow$1 = (val) => {
  6968. return val === window;
  6969. };
  6970. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  6971. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  6972. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  6973. const capitalize = (str) => capitalize$2(str);
  6974. const keysOf = (arr) => Object.keys(arr);
  6975. const entriesOf = (arr) => Object.entries(arr);
  6976. const getProp = (obj, path, defaultValue) => {
  6977. return {
  6978. get value() {
  6979. return get(obj, path, defaultValue);
  6980. },
  6981. set value(val) {
  6982. set(obj, path, val);
  6983. }
  6984. };
  6985. };
  6986. class ElementPlusError extends Error {
  6987. constructor(m) {
  6988. super(m);
  6989. this.name = "ElementPlusError";
  6990. }
  6991. }
  6992. function throwError(scope, m) {
  6993. throw new ElementPlusError(`[${scope}] ${m}`);
  6994. }
  6995. function debugWarn(scope, message) {
  6996. }
  6997. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  6998. const hasClass = (el, cls) => {
  6999. if (!el || !cls)
  7000. return false;
  7001. if (cls.includes(" "))
  7002. throw new Error("className should not contain space.");
  7003. return el.classList.contains(cls);
  7004. };
  7005. const addClass = (el, cls) => {
  7006. if (!el || !cls.trim())
  7007. return;
  7008. el.classList.add(...classNameToArray(cls));
  7009. };
  7010. const removeClass = (el, cls) => {
  7011. if (!el || !cls.trim())
  7012. return;
  7013. el.classList.remove(...classNameToArray(cls));
  7014. };
  7015. const getStyle = (element, styleName) => {
  7016. var _a;
  7017. if (!isClient || !element || !styleName)
  7018. return "";
  7019. let key = camelize(styleName);
  7020. if (key === "float")
  7021. key = "cssFloat";
  7022. try {
  7023. const style = element.style[key];
  7024. if (style)
  7025. return style;
  7026. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  7027. return computed ? computed[key] : "";
  7028. } catch (e) {
  7029. return element.style[key];
  7030. }
  7031. };
  7032. function addUnit(value, defaultUnit = "px") {
  7033. if (!value)
  7034. return "";
  7035. if (isNumber(value) || isStringNumber(value)) {
  7036. return `${value}${defaultUnit}`;
  7037. } else if (isString$1(value)) {
  7038. return value;
  7039. }
  7040. }
  7041. const isScroll = (el, isVertical) => {
  7042. if (!isClient)
  7043. return false;
  7044. const key = {
  7045. undefined: "overflow",
  7046. true: "overflow-y",
  7047. false: "overflow-x"
  7048. }[String(isVertical)];
  7049. const overflow = getStyle(el, key);
  7050. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  7051. };
  7052. const getScrollContainer = (el, isVertical) => {
  7053. if (!isClient)
  7054. return;
  7055. let parent = el;
  7056. while (parent) {
  7057. if ([window, document, document.documentElement].includes(parent))
  7058. return window;
  7059. if (isScroll(parent, isVertical))
  7060. return parent;
  7061. parent = parent.parentNode;
  7062. }
  7063. return parent;
  7064. };
  7065. let scrollBarWidth;
  7066. const getScrollBarWidth = (namespace) => {
  7067. var _a;
  7068. if (!isClient)
  7069. return 0;
  7070. if (scrollBarWidth !== void 0)
  7071. return scrollBarWidth;
  7072. const outer = document.createElement("div");
  7073. outer.className = `${namespace}-scrollbar__wrap`;
  7074. outer.style.visibility = "hidden";
  7075. outer.style.width = "100px";
  7076. outer.style.position = "absolute";
  7077. outer.style.top = "-9999px";
  7078. document.body.appendChild(outer);
  7079. const widthNoScroll = outer.offsetWidth;
  7080. outer.style.overflow = "scroll";
  7081. const inner = document.createElement("div");
  7082. inner.style.width = "100%";
  7083. outer.appendChild(inner);
  7084. const widthWithScroll = inner.offsetWidth;
  7085. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7086. scrollBarWidth = widthNoScroll - widthWithScroll;
  7087. return scrollBarWidth;
  7088. };
  7089. function scrollIntoView(container, selected) {
  7090. if (!isClient)
  7091. return;
  7092. if (!selected) {
  7093. container.scrollTop = 0;
  7094. return;
  7095. }
  7096. const offsetParents = [];
  7097. let pointer = selected.offsetParent;
  7098. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7099. offsetParents.push(pointer);
  7100. pointer = pointer.offsetParent;
  7101. }
  7102. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7103. const bottom = top + selected.offsetHeight;
  7104. const viewRectTop = container.scrollTop;
  7105. const viewRectBottom = viewRectTop + container.clientHeight;
  7106. if (top < viewRectTop) {
  7107. container.scrollTop = top;
  7108. } else if (bottom > viewRectBottom) {
  7109. container.scrollTop = bottom - container.clientHeight;
  7110. }
  7111. }
  7112. function animateScrollTo(container, from, to, duration, callback) {
  7113. const startTime = Date.now();
  7114. let handle;
  7115. const scroll = () => {
  7116. const timestamp = Date.now();
  7117. const time = timestamp - startTime;
  7118. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  7119. if (isWindow$1(container)) {
  7120. container.scrollTo(window.pageXOffset, nextScrollTop);
  7121. } else {
  7122. container.scrollTop = nextScrollTop;
  7123. }
  7124. if (time < duration) {
  7125. handle = rAF(scroll);
  7126. } else if (typeof callback === "function") {
  7127. callback();
  7128. }
  7129. };
  7130. scroll();
  7131. return () => {
  7132. handle && cAF(handle);
  7133. };
  7134. }
  7135. const getScrollElement = (target, container) => {
  7136. if (isWindow$1(container)) {
  7137. return target.ownerDocument.documentElement;
  7138. }
  7139. return container;
  7140. };
  7141. const getScrollTop = (container) => {
  7142. if (isWindow$1(container)) {
  7143. return window.scrollY;
  7144. }
  7145. return container.scrollTop;
  7146. };
  7147. const getElement = (target) => {
  7148. if (!isClient || target === "")
  7149. return null;
  7150. if (isString$1(target)) {
  7151. try {
  7152. return document.querySelector(target);
  7153. } catch (e) {
  7154. return null;
  7155. }
  7156. }
  7157. return target;
  7158. };
  7159. let target = !isClient ? void 0 : document.body;
  7160. function createGlobalNode(id) {
  7161. const el = document.createElement("div");
  7162. if (id !== void 0) {
  7163. el.setAttribute("id", id);
  7164. }
  7165. if (target) {
  7166. target.appendChild(el);
  7167. }
  7168. return el;
  7169. }
  7170. function removeGlobalNode(el) {
  7171. el.remove();
  7172. }
  7173. var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7174. name: "ArrowDown",
  7175. __name: "arrow-down",
  7176. setup(__props) {
  7177. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7178. xmlns: "http://www.w3.org/2000/svg",
  7179. viewBox: "0 0 1024 1024"
  7180. }, [
  7181. vue.createElementVNode("path", {
  7182. fill: "currentColor",
  7183. 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"
  7184. })
  7185. ]));
  7186. }
  7187. });
  7188. var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
  7189. var arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7190. name: "ArrowLeft",
  7191. __name: "arrow-left",
  7192. setup(__props) {
  7193. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7194. xmlns: "http://www.w3.org/2000/svg",
  7195. viewBox: "0 0 1024 1024"
  7196. }, [
  7197. vue.createElementVNode("path", {
  7198. fill: "currentColor",
  7199. 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"
  7200. })
  7201. ]));
  7202. }
  7203. });
  7204. var arrow_left_default = arrow_left_vue_vue_type_script_setup_true_lang_default;
  7205. var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7206. name: "ArrowRight",
  7207. __name: "arrow-right",
  7208. setup(__props) {
  7209. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7210. xmlns: "http://www.w3.org/2000/svg",
  7211. viewBox: "0 0 1024 1024"
  7212. }, [
  7213. vue.createElementVNode("path", {
  7214. fill: "currentColor",
  7215. 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"
  7216. })
  7217. ]));
  7218. }
  7219. });
  7220. var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
  7221. var arrow_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7222. name: "ArrowUp",
  7223. __name: "arrow-up",
  7224. setup(__props) {
  7225. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7226. xmlns: "http://www.w3.org/2000/svg",
  7227. viewBox: "0 0 1024 1024"
  7228. }, [
  7229. vue.createElementVNode("path", {
  7230. fill: "currentColor",
  7231. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
  7232. })
  7233. ]));
  7234. }
  7235. });
  7236. var arrow_up_default = arrow_up_vue_vue_type_script_setup_true_lang_default;
  7237. var back_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7238. name: "Back",
  7239. __name: "back",
  7240. setup(__props) {
  7241. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7242. xmlns: "http://www.w3.org/2000/svg",
  7243. viewBox: "0 0 1024 1024"
  7244. }, [
  7245. vue.createElementVNode("path", {
  7246. fill: "currentColor",
  7247. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  7248. }),
  7249. vue.createElementVNode("path", {
  7250. fill: "currentColor",
  7251. d: "m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312z"
  7252. })
  7253. ]));
  7254. }
  7255. });
  7256. var back_default = back_vue_vue_type_script_setup_true_lang_default;
  7257. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7258. name: "Calendar",
  7259. __name: "calendar",
  7260. setup(__props) {
  7261. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7262. xmlns: "http://www.w3.org/2000/svg",
  7263. viewBox: "0 0 1024 1024"
  7264. }, [
  7265. vue.createElementVNode("path", {
  7266. fill: "currentColor",
  7267. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64"
  7268. })
  7269. ]));
  7270. }
  7271. });
  7272. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  7273. var caret_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7274. name: "CaretRight",
  7275. __name: "caret-right",
  7276. setup(__props) {
  7277. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7278. xmlns: "http://www.w3.org/2000/svg",
  7279. viewBox: "0 0 1024 1024"
  7280. }, [
  7281. vue.createElementVNode("path", {
  7282. fill: "currentColor",
  7283. d: "M384 192v640l384-320.064z"
  7284. })
  7285. ]));
  7286. }
  7287. });
  7288. var caret_right_default = caret_right_vue_vue_type_script_setup_true_lang_default;
  7289. var caret_top_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7290. name: "CaretTop",
  7291. __name: "caret-top",
  7292. setup(__props) {
  7293. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7294. xmlns: "http://www.w3.org/2000/svg",
  7295. viewBox: "0 0 1024 1024"
  7296. }, [
  7297. vue.createElementVNode("path", {
  7298. fill: "currentColor",
  7299. d: "M512 320 192 704h639.936z"
  7300. })
  7301. ]));
  7302. }
  7303. });
  7304. var caret_top_default = caret_top_vue_vue_type_script_setup_true_lang_default;
  7305. var check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7306. name: "Check",
  7307. __name: "check",
  7308. setup(__props) {
  7309. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7310. xmlns: "http://www.w3.org/2000/svg",
  7311. viewBox: "0 0 1024 1024"
  7312. }, [
  7313. vue.createElementVNode("path", {
  7314. fill: "currentColor",
  7315. 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"
  7316. })
  7317. ]));
  7318. }
  7319. });
  7320. var check_default = check_vue_vue_type_script_setup_true_lang_default;
  7321. var circle_check_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7322. name: "CircleCheckFilled",
  7323. __name: "circle-check-filled",
  7324. setup(__props) {
  7325. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7326. xmlns: "http://www.w3.org/2000/svg",
  7327. viewBox: "0 0 1024 1024"
  7328. }, [
  7329. vue.createElementVNode("path", {
  7330. fill: "currentColor",
  7331. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  7332. })
  7333. ]));
  7334. }
  7335. });
  7336. var circle_check_filled_default = circle_check_filled_vue_vue_type_script_setup_true_lang_default;
  7337. var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7338. name: "CircleCheck",
  7339. __name: "circle-check",
  7340. setup(__props) {
  7341. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7342. xmlns: "http://www.w3.org/2000/svg",
  7343. viewBox: "0 0 1024 1024"
  7344. }, [
  7345. vue.createElementVNode("path", {
  7346. fill: "currentColor",
  7347. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  7348. }),
  7349. vue.createElementVNode("path", {
  7350. fill: "currentColor",
  7351. 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"
  7352. })
  7353. ]));
  7354. }
  7355. });
  7356. var circle_check_default = circle_check_vue_vue_type_script_setup_true_lang_default;
  7357. var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7358. name: "CircleCloseFilled",
  7359. __name: "circle-close-filled",
  7360. setup(__props) {
  7361. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7362. xmlns: "http://www.w3.org/2000/svg",
  7363. viewBox: "0 0 1024 1024"
  7364. }, [
  7365. vue.createElementVNode("path", {
  7366. fill: "currentColor",
  7367. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
  7368. })
  7369. ]));
  7370. }
  7371. });
  7372. var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
  7373. var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7374. name: "CircleClose",
  7375. __name: "circle-close",
  7376. setup(__props) {
  7377. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7378. xmlns: "http://www.w3.org/2000/svg",
  7379. viewBox: "0 0 1024 1024"
  7380. }, [
  7381. vue.createElementVNode("path", {
  7382. fill: "currentColor",
  7383. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
  7384. }),
  7385. vue.createElementVNode("path", {
  7386. fill: "currentColor",
  7387. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  7388. })
  7389. ]));
  7390. }
  7391. });
  7392. var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
  7393. var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7394. name: "Clock",
  7395. __name: "clock",
  7396. setup(__props) {
  7397. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7398. xmlns: "http://www.w3.org/2000/svg",
  7399. viewBox: "0 0 1024 1024"
  7400. }, [
  7401. vue.createElementVNode("path", {
  7402. fill: "currentColor",
  7403. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  7404. }),
  7405. vue.createElementVNode("path", {
  7406. fill: "currentColor",
  7407. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  7408. }),
  7409. vue.createElementVNode("path", {
  7410. fill: "currentColor",
  7411. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  7412. })
  7413. ]));
  7414. }
  7415. });
  7416. var clock_default = clock_vue_vue_type_script_setup_true_lang_default;
  7417. var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7418. name: "Close",
  7419. __name: "close",
  7420. setup(__props) {
  7421. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7422. xmlns: "http://www.w3.org/2000/svg",
  7423. viewBox: "0 0 1024 1024"
  7424. }, [
  7425. vue.createElementVNode("path", {
  7426. fill: "currentColor",
  7427. 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"
  7428. })
  7429. ]));
  7430. }
  7431. });
  7432. var close_default = close_vue_vue_type_script_setup_true_lang_default;
  7433. var d_arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7434. name: "DArrowLeft",
  7435. __name: "d-arrow-left",
  7436. setup(__props) {
  7437. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7438. xmlns: "http://www.w3.org/2000/svg",
  7439. viewBox: "0 0 1024 1024"
  7440. }, [
  7441. vue.createElementVNode("path", {
  7442. fill: "currentColor",
  7443. 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"
  7444. })
  7445. ]));
  7446. }
  7447. });
  7448. var d_arrow_left_default = d_arrow_left_vue_vue_type_script_setup_true_lang_default;
  7449. var d_arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7450. name: "DArrowRight",
  7451. __name: "d-arrow-right",
  7452. setup(__props) {
  7453. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7454. xmlns: "http://www.w3.org/2000/svg",
  7455. viewBox: "0 0 1024 1024"
  7456. }, [
  7457. vue.createElementVNode("path", {
  7458. fill: "currentColor",
  7459. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  7460. })
  7461. ]));
  7462. }
  7463. });
  7464. var d_arrow_right_default = d_arrow_right_vue_vue_type_script_setup_true_lang_default;
  7465. var delete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7466. name: "Delete",
  7467. __name: "delete",
  7468. setup(__props) {
  7469. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7470. xmlns: "http://www.w3.org/2000/svg",
  7471. viewBox: "0 0 1024 1024"
  7472. }, [
  7473. vue.createElementVNode("path", {
  7474. fill: "currentColor",
  7475. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
  7476. })
  7477. ]));
  7478. }
  7479. });
  7480. var delete_default = delete_vue_vue_type_script_setup_true_lang_default;
  7481. var document_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7482. name: "Document",
  7483. __name: "document",
  7484. setup(__props) {
  7485. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7486. xmlns: "http://www.w3.org/2000/svg",
  7487. viewBox: "0 0 1024 1024"
  7488. }, [
  7489. vue.createElementVNode("path", {
  7490. fill: "currentColor",
  7491. d: "M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"
  7492. })
  7493. ]));
  7494. }
  7495. });
  7496. var document_default = document_vue_vue_type_script_setup_true_lang_default;
  7497. var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7498. name: "FullScreen",
  7499. __name: "full-screen",
  7500. setup(__props) {
  7501. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7502. xmlns: "http://www.w3.org/2000/svg",
  7503. viewBox: "0 0 1024 1024"
  7504. }, [
  7505. vue.createElementVNode("path", {
  7506. fill: "currentColor",
  7507. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
  7508. })
  7509. ]));
  7510. }
  7511. });
  7512. var full_screen_default = full_screen_vue_vue_type_script_setup_true_lang_default;
  7513. var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7514. name: "Hide",
  7515. __name: "hide",
  7516. setup(__props) {
  7517. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7518. xmlns: "http://www.w3.org/2000/svg",
  7519. viewBox: "0 0 1024 1024"
  7520. }, [
  7521. vue.createElementVNode("path", {
  7522. fill: "currentColor",
  7523. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
  7524. }),
  7525. vue.createElementVNode("path", {
  7526. fill: "currentColor",
  7527. 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"
  7528. })
  7529. ]));
  7530. }
  7531. });
  7532. var hide_default = hide_vue_vue_type_script_setup_true_lang_default;
  7533. var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7534. name: "InfoFilled",
  7535. __name: "info-filled",
  7536. setup(__props) {
  7537. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7538. xmlns: "http://www.w3.org/2000/svg",
  7539. viewBox: "0 0 1024 1024"
  7540. }, [
  7541. vue.createElementVNode("path", {
  7542. fill: "currentColor",
  7543. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
  7544. })
  7545. ]));
  7546. }
  7547. });
  7548. var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
  7549. var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7550. name: "Loading",
  7551. __name: "loading",
  7552. setup(__props) {
  7553. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7554. xmlns: "http://www.w3.org/2000/svg",
  7555. viewBox: "0 0 1024 1024"
  7556. }, [
  7557. vue.createElementVNode("path", {
  7558. fill: "currentColor",
  7559. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  7560. })
  7561. ]));
  7562. }
  7563. });
  7564. var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
  7565. var minus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7566. name: "Minus",
  7567. __name: "minus",
  7568. setup(__props) {
  7569. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7570. xmlns: "http://www.w3.org/2000/svg",
  7571. viewBox: "0 0 1024 1024"
  7572. }, [
  7573. vue.createElementVNode("path", {
  7574. fill: "currentColor",
  7575. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  7576. })
  7577. ]));
  7578. }
  7579. });
  7580. var minus_default = minus_vue_vue_type_script_setup_true_lang_default;
  7581. var more_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7582. name: "MoreFilled",
  7583. __name: "more-filled",
  7584. setup(__props) {
  7585. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7586. xmlns: "http://www.w3.org/2000/svg",
  7587. viewBox: "0 0 1024 1024"
  7588. }, [
  7589. vue.createElementVNode("path", {
  7590. fill: "currentColor",
  7591. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"
  7592. })
  7593. ]));
  7594. }
  7595. });
  7596. var more_filled_default = more_filled_vue_vue_type_script_setup_true_lang_default;
  7597. var more_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7598. name: "More",
  7599. __name: "more",
  7600. setup(__props) {
  7601. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7602. xmlns: "http://www.w3.org/2000/svg",
  7603. viewBox: "0 0 1024 1024"
  7604. }, [
  7605. vue.createElementVNode("path", {
  7606. fill: "currentColor",
  7607. d: "M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96"
  7608. })
  7609. ]));
  7610. }
  7611. });
  7612. var more_default = more_vue_vue_type_script_setup_true_lang_default;
  7613. var picture_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7614. name: "PictureFilled",
  7615. __name: "picture-filled",
  7616. setup(__props) {
  7617. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7618. xmlns: "http://www.w3.org/2000/svg",
  7619. viewBox: "0 0 1024 1024"
  7620. }, [
  7621. vue.createElementVNode("path", {
  7622. fill: "currentColor",
  7623. d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112M256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384"
  7624. })
  7625. ]));
  7626. }
  7627. });
  7628. var picture_filled_default = picture_filled_vue_vue_type_script_setup_true_lang_default;
  7629. var plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7630. name: "Plus",
  7631. __name: "plus",
  7632. setup(__props) {
  7633. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7634. xmlns: "http://www.w3.org/2000/svg",
  7635. viewBox: "0 0 1024 1024"
  7636. }, [
  7637. vue.createElementVNode("path", {
  7638. fill: "currentColor",
  7639. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
  7640. })
  7641. ]));
  7642. }
  7643. });
  7644. var plus_default = plus_vue_vue_type_script_setup_true_lang_default;
  7645. var question_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7646. name: "QuestionFilled",
  7647. __name: "question-filled",
  7648. setup(__props) {
  7649. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7650. xmlns: "http://www.w3.org/2000/svg",
  7651. viewBox: "0 0 1024 1024"
  7652. }, [
  7653. vue.createElementVNode("path", {
  7654. fill: "currentColor",
  7655. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z"
  7656. })
  7657. ]));
  7658. }
  7659. });
  7660. var question_filled_default = question_filled_vue_vue_type_script_setup_true_lang_default;
  7661. var refresh_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7662. name: "RefreshLeft",
  7663. __name: "refresh-left",
  7664. setup(__props) {
  7665. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7666. xmlns: "http://www.w3.org/2000/svg",
  7667. viewBox: "0 0 1024 1024"
  7668. }, [
  7669. vue.createElementVNode("path", {
  7670. fill: "currentColor",
  7671. 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"
  7672. })
  7673. ]));
  7674. }
  7675. });
  7676. var refresh_left_default = refresh_left_vue_vue_type_script_setup_true_lang_default;
  7677. var refresh_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7678. name: "RefreshRight",
  7679. __name: "refresh-right",
  7680. setup(__props) {
  7681. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7682. xmlns: "http://www.w3.org/2000/svg",
  7683. viewBox: "0 0 1024 1024"
  7684. }, [
  7685. vue.createElementVNode("path", {
  7686. fill: "currentColor",
  7687. 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"
  7688. })
  7689. ]));
  7690. }
  7691. });
  7692. var refresh_right_default = refresh_right_vue_vue_type_script_setup_true_lang_default;
  7693. var scale_to_original_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7694. name: "ScaleToOriginal",
  7695. __name: "scale-to-original",
  7696. setup(__props) {
  7697. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7698. xmlns: "http://www.w3.org/2000/svg",
  7699. viewBox: "0 0 1024 1024"
  7700. }, [
  7701. vue.createElementVNode("path", {
  7702. fill: "currentColor",
  7703. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118M512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412M512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512"
  7704. })
  7705. ]));
  7706. }
  7707. });
  7708. var scale_to_original_default = scale_to_original_vue_vue_type_script_setup_true_lang_default;
  7709. var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7710. name: "Search",
  7711. __name: "search",
  7712. setup(__props) {
  7713. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7714. xmlns: "http://www.w3.org/2000/svg",
  7715. viewBox: "0 0 1024 1024"
  7716. }, [
  7717. vue.createElementVNode("path", {
  7718. fill: "currentColor",
  7719. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
  7720. })
  7721. ]));
  7722. }
  7723. });
  7724. var search_default = search_vue_vue_type_script_setup_true_lang_default;
  7725. var sort_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7726. name: "SortDown",
  7727. __name: "sort-down",
  7728. setup(__props) {
  7729. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7730. xmlns: "http://www.w3.org/2000/svg",
  7731. viewBox: "0 0 1024 1024"
  7732. }, [
  7733. vue.createElementVNode("path", {
  7734. fill: "currentColor",
  7735. d: "M576 96v709.568L333.312 562.816A32 32 0 1 0 288 608l297.408 297.344A32 32 0 0 0 640 882.688V96a32 32 0 0 0-64 0"
  7736. })
  7737. ]));
  7738. }
  7739. });
  7740. var sort_down_default = sort_down_vue_vue_type_script_setup_true_lang_default;
  7741. var sort_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7742. name: "SortUp",
  7743. __name: "sort-up",
  7744. setup(__props) {
  7745. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7746. xmlns: "http://www.w3.org/2000/svg",
  7747. viewBox: "0 0 1024 1024"
  7748. }, [
  7749. vue.createElementVNode("path", {
  7750. fill: "currentColor",
  7751. d: "M384 141.248V928a32 32 0 1 0 64 0V218.56l242.688 242.688A32 32 0 1 0 736 416L438.592 118.656A32 32 0 0 0 384 141.248"
  7752. })
  7753. ]));
  7754. }
  7755. });
  7756. var sort_up_default = sort_up_vue_vue_type_script_setup_true_lang_default;
  7757. var star_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7758. name: "StarFilled",
  7759. __name: "star-filled",
  7760. setup(__props) {
  7761. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7762. xmlns: "http://www.w3.org/2000/svg",
  7763. viewBox: "0 0 1024 1024"
  7764. }, [
  7765. vue.createElementVNode("path", {
  7766. fill: "currentColor",
  7767. 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"
  7768. })
  7769. ]));
  7770. }
  7771. });
  7772. var star_filled_default = star_filled_vue_vue_type_script_setup_true_lang_default;
  7773. var star_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7774. name: "Star",
  7775. __name: "star",
  7776. setup(__props) {
  7777. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7778. xmlns: "http://www.w3.org/2000/svg",
  7779. viewBox: "0 0 1024 1024"
  7780. }, [
  7781. vue.createElementVNode("path", {
  7782. fill: "currentColor",
  7783. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  7784. })
  7785. ]));
  7786. }
  7787. });
  7788. var star_default = star_vue_vue_type_script_setup_true_lang_default;
  7789. var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7790. name: "SuccessFilled",
  7791. __name: "success-filled",
  7792. setup(__props) {
  7793. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7794. xmlns: "http://www.w3.org/2000/svg",
  7795. viewBox: "0 0 1024 1024"
  7796. }, [
  7797. vue.createElementVNode("path", {
  7798. fill: "currentColor",
  7799. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  7800. })
  7801. ]));
  7802. }
  7803. });
  7804. var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
  7805. var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7806. name: "View",
  7807. __name: "view",
  7808. setup(__props) {
  7809. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7810. xmlns: "http://www.w3.org/2000/svg",
  7811. viewBox: "0 0 1024 1024"
  7812. }, [
  7813. vue.createElementVNode("path", {
  7814. fill: "currentColor",
  7815. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
  7816. })
  7817. ]));
  7818. }
  7819. });
  7820. var view_default = view_vue_vue_type_script_setup_true_lang_default;
  7821. var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7822. name: "WarningFilled",
  7823. __name: "warning-filled",
  7824. setup(__props) {
  7825. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7826. xmlns: "http://www.w3.org/2000/svg",
  7827. viewBox: "0 0 1024 1024"
  7828. }, [
  7829. vue.createElementVNode("path", {
  7830. fill: "currentColor",
  7831. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
  7832. })
  7833. ]));
  7834. }
  7835. });
  7836. var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
  7837. var zoom_in_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7838. name: "ZoomIn",
  7839. __name: "zoom-in",
  7840. setup(__props) {
  7841. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7842. xmlns: "http://www.w3.org/2000/svg",
  7843. viewBox: "0 0 1024 1024"
  7844. }, [
  7845. vue.createElementVNode("path", {
  7846. fill: "currentColor",
  7847. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"
  7848. })
  7849. ]));
  7850. }
  7851. });
  7852. var zoom_in_default = zoom_in_vue_vue_type_script_setup_true_lang_default;
  7853. var zoom_out_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7854. name: "ZoomOut",
  7855. __name: "zoom-out",
  7856. setup(__props) {
  7857. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7858. xmlns: "http://www.w3.org/2000/svg",
  7859. viewBox: "0 0 1024 1024"
  7860. }, [
  7861. vue.createElementVNode("path", {
  7862. fill: "currentColor",
  7863. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"
  7864. })
  7865. ]));
  7866. }
  7867. });
  7868. var zoom_out_default = zoom_out_vue_vue_type_script_setup_true_lang_default;
  7869. /*! Element Plus Icons Vue v2.3.1 */
  7870. const epPropKey = "__epPropKey";
  7871. const definePropType = (val) => val;
  7872. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7873. const buildProp = (prop, key) => {
  7874. if (!isObject$1(prop) || isEpProp(prop))
  7875. return prop;
  7876. const { values, required, default: defaultValue, type, validator } = prop;
  7877. const _validator = values || validator ? (val) => {
  7878. let valid = false;
  7879. let allowedValues = [];
  7880. if (values) {
  7881. allowedValues = Array.from(values);
  7882. if (hasOwn(prop, "default")) {
  7883. allowedValues.push(defaultValue);
  7884. }
  7885. valid || (valid = allowedValues.includes(val));
  7886. }
  7887. if (validator)
  7888. valid || (valid = validator(val));
  7889. if (!valid && allowedValues.length > 0) {
  7890. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7891. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7892. }
  7893. return valid;
  7894. } : void 0;
  7895. const epProp = {
  7896. type,
  7897. required: !!required,
  7898. validator: _validator,
  7899. [epPropKey]: true
  7900. };
  7901. if (hasOwn(prop, "default"))
  7902. epProp.default = defaultValue;
  7903. return epProp;
  7904. };
  7905. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7906. key,
  7907. buildProp(option, key)
  7908. ]));
  7909. const iconPropType = definePropType([
  7910. String,
  7911. Object,
  7912. Function
  7913. ]);
  7914. const CloseComponents = {
  7915. Close: close_default
  7916. };
  7917. const TypeComponents = {
  7918. Close: close_default,
  7919. SuccessFilled: success_filled_default,
  7920. InfoFilled: info_filled_default,
  7921. WarningFilled: warning_filled_default,
  7922. CircleCloseFilled: circle_close_filled_default
  7923. };
  7924. const TypeComponentsMap = {
  7925. success: success_filled_default,
  7926. warning: warning_filled_default,
  7927. error: circle_close_filled_default,
  7928. info: info_filled_default
  7929. };
  7930. const ValidateComponentsMap = {
  7931. validating: loading_default,
  7932. success: circle_check_default,
  7933. error: circle_close_default
  7934. };
  7935. const withInstall = (main, extra) => {
  7936. main.install = (app) => {
  7937. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7938. app.component(comp.name, comp);
  7939. }
  7940. };
  7941. if (extra) {
  7942. for (const [key, comp] of Object.entries(extra)) {
  7943. main[key] = comp;
  7944. }
  7945. }
  7946. return main;
  7947. };
  7948. const withInstallFunction = (fn, name) => {
  7949. fn.install = (app) => {
  7950. fn._context = app._context;
  7951. app.config.globalProperties[name] = fn;
  7952. };
  7953. return fn;
  7954. };
  7955. const withInstallDirective = (directive, name) => {
  7956. directive.install = (app) => {
  7957. app.directive(name, directive);
  7958. };
  7959. return directive;
  7960. };
  7961. const withNoopInstall = (component) => {
  7962. component.install = NOOP;
  7963. return component;
  7964. };
  7965. const composeRefs = (...refs) => {
  7966. return (el) => {
  7967. refs.forEach((ref) => {
  7968. if (isFunction$1(ref)) {
  7969. ref(el);
  7970. } else {
  7971. ref.value = el;
  7972. }
  7973. });
  7974. };
  7975. };
  7976. const EVENT_CODE = {
  7977. tab: "Tab",
  7978. enter: "Enter",
  7979. space: "Space",
  7980. left: "ArrowLeft",
  7981. up: "ArrowUp",
  7982. right: "ArrowRight",
  7983. down: "ArrowDown",
  7984. esc: "Escape",
  7985. delete: "Delete",
  7986. backspace: "Backspace",
  7987. numpadEnter: "NumpadEnter",
  7988. pageUp: "PageUp",
  7989. pageDown: "PageDown",
  7990. home: "Home",
  7991. end: "End"
  7992. };
  7993. const datePickTypes = [
  7994. "year",
  7995. "years",
  7996. "month",
  7997. "months",
  7998. "date",
  7999. "dates",
  8000. "week",
  8001. "datetime",
  8002. "datetimerange",
  8003. "daterange",
  8004. "monthrange",
  8005. "yearrange"
  8006. ];
  8007. const WEEK_DAYS = [
  8008. "sun",
  8009. "mon",
  8010. "tue",
  8011. "wed",
  8012. "thu",
  8013. "fri",
  8014. "sat"
  8015. ];
  8016. const UPDATE_MODEL_EVENT = "update:modelValue";
  8017. const CHANGE_EVENT = "change";
  8018. const INPUT_EVENT = "input";
  8019. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  8020. const componentSizes = ["", "default", "small", "large"];
  8021. const componentSizeMap = {
  8022. large: 40,
  8023. default: 32,
  8024. small: 24
  8025. };
  8026. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8027. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8028. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8029. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8030. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8031. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8032. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8033. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8034. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8035. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8036. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8037. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8038. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8039. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8040. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8041. return PatchFlags2;
  8042. })(PatchFlags || {});
  8043. function isFragment(node) {
  8044. return vue.isVNode(node) && node.type === vue.Fragment;
  8045. }
  8046. function isComment(node) {
  8047. return vue.isVNode(node) && node.type === vue.Comment;
  8048. }
  8049. function isValidElementNode(node) {
  8050. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8051. }
  8052. const getNormalizedProps = (node) => {
  8053. if (!vue.isVNode(node)) {
  8054. return {};
  8055. }
  8056. const raw = node.props || {};
  8057. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8058. const props = {};
  8059. Object.keys(type).forEach((key) => {
  8060. if (hasOwn(type[key], "default")) {
  8061. props[key] = type[key].default;
  8062. }
  8063. });
  8064. Object.keys(raw).forEach((key) => {
  8065. props[camelize(key)] = raw[key];
  8066. });
  8067. return props;
  8068. };
  8069. const ensureOnlyChild = (children) => {
  8070. if (!isArray$1(children) || children.length > 1) {
  8071. throw new Error("expect to receive a single Vue element child");
  8072. }
  8073. return children[0];
  8074. };
  8075. const flattedChildren = (children) => {
  8076. const vNodes = isArray$1(children) ? children : [children];
  8077. const result = [];
  8078. vNodes.forEach((child) => {
  8079. var _a;
  8080. if (isArray$1(child)) {
  8081. result.push(...flattedChildren(child));
  8082. } else if (vue.isVNode(child) && isArray$1(child.children)) {
  8083. result.push(...flattedChildren(child.children));
  8084. } else {
  8085. result.push(child);
  8086. if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8087. result.push(...flattedChildren(child.component.subTree));
  8088. }
  8089. }
  8090. });
  8091. return result;
  8092. };
  8093. const unique = (arr) => [...new Set(arr)];
  8094. const castArray = (arr) => {
  8095. if (!arr && arr !== 0)
  8096. return [];
  8097. return Array.isArray(arr) ? arr : [arr];
  8098. };
  8099. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8100. const mutable = (val) => val;
  8101. function throttleByRaf(cb) {
  8102. let timer = 0;
  8103. const throttle = (...args) => {
  8104. if (timer) {
  8105. cAF(timer);
  8106. }
  8107. timer = rAF(() => {
  8108. cb(...args);
  8109. timer = 0;
  8110. });
  8111. };
  8112. throttle.cancel = () => {
  8113. cAF(timer);
  8114. timer = 0;
  8115. };
  8116. return throttle;
  8117. }
  8118. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8119. const LISTENER_PREFIX = /^on[A-Z]/;
  8120. const useAttrs = (params = {}) => {
  8121. const { excludeListeners = false, excludeKeys } = params;
  8122. const allExcludeKeys = vue.computed(() => {
  8123. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8124. });
  8125. const instance = vue.getCurrentInstance();
  8126. if (!instance) {
  8127. return vue.computed(() => ({}));
  8128. }
  8129. return vue.computed(() => {
  8130. var _a;
  8131. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8132. });
  8133. };
  8134. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8135. vue.watch(() => vue.unref(condition), (val) => {
  8136. }, {
  8137. immediate: true
  8138. });
  8139. };
  8140. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8141. let transform = {
  8142. offsetX: 0,
  8143. offsetY: 0
  8144. };
  8145. const onMousedown = (e) => {
  8146. const downX = e.clientX;
  8147. const downY = e.clientY;
  8148. const { offsetX, offsetY } = transform;
  8149. const targetRect = targetRef.value.getBoundingClientRect();
  8150. const targetLeft = targetRect.left;
  8151. const targetTop = targetRect.top;
  8152. const targetWidth = targetRect.width;
  8153. const targetHeight = targetRect.height;
  8154. const clientWidth = document.documentElement.clientWidth;
  8155. const clientHeight = document.documentElement.clientHeight;
  8156. const minLeft = -targetLeft + offsetX;
  8157. const minTop = -targetTop + offsetY;
  8158. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8159. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8160. const onMousemove = (e2) => {
  8161. let moveX = offsetX + e2.clientX - downX;
  8162. let moveY = offsetY + e2.clientY - downY;
  8163. if (!(overflow == null ? void 0 : overflow.value)) {
  8164. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8165. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8166. }
  8167. transform = {
  8168. offsetX: moveX,
  8169. offsetY: moveY
  8170. };
  8171. if (targetRef.value) {
  8172. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8173. }
  8174. };
  8175. const onMouseup = () => {
  8176. document.removeEventListener("mousemove", onMousemove);
  8177. document.removeEventListener("mouseup", onMouseup);
  8178. };
  8179. document.addEventListener("mousemove", onMousemove);
  8180. document.addEventListener("mouseup", onMouseup);
  8181. };
  8182. const onDraggable = () => {
  8183. if (dragRef.value && targetRef.value) {
  8184. dragRef.value.addEventListener("mousedown", onMousedown);
  8185. }
  8186. };
  8187. const offDraggable = () => {
  8188. if (dragRef.value && targetRef.value) {
  8189. dragRef.value.removeEventListener("mousedown", onMousedown);
  8190. }
  8191. };
  8192. const resetPosition = () => {
  8193. transform = {
  8194. offsetX: 0,
  8195. offsetY: 0
  8196. };
  8197. if (targetRef.value) {
  8198. targetRef.value.style.transform = "none";
  8199. }
  8200. };
  8201. vue.onMounted(() => {
  8202. vue.watchEffect(() => {
  8203. if (draggable.value) {
  8204. onDraggable();
  8205. } else {
  8206. offDraggable();
  8207. }
  8208. });
  8209. });
  8210. vue.onBeforeUnmount(() => {
  8211. offDraggable();
  8212. });
  8213. return {
  8214. resetPosition
  8215. };
  8216. };
  8217. const useFocus = (el) => {
  8218. return {
  8219. focus: () => {
  8220. var _a, _b;
  8221. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8222. }
  8223. };
  8224. };
  8225. var English = {
  8226. name: "en",
  8227. el: {
  8228. breadcrumb: {
  8229. label: "Breadcrumb"
  8230. },
  8231. colorpicker: {
  8232. confirm: "OK",
  8233. clear: "Clear",
  8234. defaultLabel: "color picker",
  8235. description: "current color is {color}. press enter to select a new color.",
  8236. alphaLabel: "pick alpha value"
  8237. },
  8238. datepicker: {
  8239. now: "Now",
  8240. today: "Today",
  8241. cancel: "Cancel",
  8242. clear: "Clear",
  8243. confirm: "OK",
  8244. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8245. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8246. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8247. selectedDate: "Selected date",
  8248. selectDate: "Select date",
  8249. selectTime: "Select time",
  8250. startDate: "Start Date",
  8251. startTime: "Start Time",
  8252. endDate: "End Date",
  8253. endTime: "End Time",
  8254. prevYear: "Previous Year",
  8255. nextYear: "Next Year",
  8256. prevMonth: "Previous Month",
  8257. nextMonth: "Next Month",
  8258. year: "",
  8259. month1: "January",
  8260. month2: "February",
  8261. month3: "March",
  8262. month4: "April",
  8263. month5: "May",
  8264. month6: "June",
  8265. month7: "July",
  8266. month8: "August",
  8267. month9: "September",
  8268. month10: "October",
  8269. month11: "November",
  8270. month12: "December",
  8271. week: "week",
  8272. weeks: {
  8273. sun: "Sun",
  8274. mon: "Mon",
  8275. tue: "Tue",
  8276. wed: "Wed",
  8277. thu: "Thu",
  8278. fri: "Fri",
  8279. sat: "Sat"
  8280. },
  8281. weeksFull: {
  8282. sun: "Sunday",
  8283. mon: "Monday",
  8284. tue: "Tuesday",
  8285. wed: "Wednesday",
  8286. thu: "Thursday",
  8287. fri: "Friday",
  8288. sat: "Saturday"
  8289. },
  8290. months: {
  8291. jan: "Jan",
  8292. feb: "Feb",
  8293. mar: "Mar",
  8294. apr: "Apr",
  8295. may: "May",
  8296. jun: "Jun",
  8297. jul: "Jul",
  8298. aug: "Aug",
  8299. sep: "Sep",
  8300. oct: "Oct",
  8301. nov: "Nov",
  8302. dec: "Dec"
  8303. }
  8304. },
  8305. inputNumber: {
  8306. decrease: "decrease number",
  8307. increase: "increase number"
  8308. },
  8309. select: {
  8310. loading: "Loading",
  8311. noMatch: "No matching data",
  8312. noData: "No data",
  8313. placeholder: "Select"
  8314. },
  8315. mention: {
  8316. loading: "Loading"
  8317. },
  8318. dropdown: {
  8319. toggleDropdown: "Toggle Dropdown"
  8320. },
  8321. cascader: {
  8322. noMatch: "No matching data",
  8323. loading: "Loading",
  8324. placeholder: "Select",
  8325. noData: "No data"
  8326. },
  8327. pagination: {
  8328. goto: "Go to",
  8329. pagesize: "/page",
  8330. total: "Total {total}",
  8331. pageClassifier: "",
  8332. page: "Page",
  8333. prev: "Go to previous page",
  8334. next: "Go to next page",
  8335. currentPage: "page {pager}",
  8336. prevPages: "Previous {pager} pages",
  8337. nextPages: "Next {pager} pages",
  8338. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8339. },
  8340. dialog: {
  8341. close: "Close this dialog"
  8342. },
  8343. drawer: {
  8344. close: "Close this dialog"
  8345. },
  8346. messagebox: {
  8347. title: "Message",
  8348. confirm: "OK",
  8349. cancel: "Cancel",
  8350. error: "Illegal input",
  8351. close: "Close this dialog"
  8352. },
  8353. upload: {
  8354. deleteTip: "press delete to remove",
  8355. delete: "Delete",
  8356. preview: "Preview",
  8357. continue: "Continue"
  8358. },
  8359. slider: {
  8360. defaultLabel: "slider between {min} and {max}",
  8361. defaultRangeStartLabel: "pick start value",
  8362. defaultRangeEndLabel: "pick end value"
  8363. },
  8364. table: {
  8365. emptyText: "No Data",
  8366. confirmFilter: "Confirm",
  8367. resetFilter: "Reset",
  8368. clearFilter: "All",
  8369. sumText: "Sum"
  8370. },
  8371. tour: {
  8372. next: "Next",
  8373. previous: "Previous",
  8374. finish: "Finish"
  8375. },
  8376. tree: {
  8377. emptyText: "No Data"
  8378. },
  8379. transfer: {
  8380. noMatch: "No matching data",
  8381. noData: "No data",
  8382. titles: ["List 1", "List 2"],
  8383. filterPlaceholder: "Enter keyword",
  8384. noCheckedFormat: "{total} items",
  8385. hasCheckedFormat: "{checked}/{total} checked"
  8386. },
  8387. image: {
  8388. error: "FAILED"
  8389. },
  8390. pageHeader: {
  8391. title: "Back"
  8392. },
  8393. popconfirm: {
  8394. confirmButtonText: "Yes",
  8395. cancelButtonText: "No"
  8396. },
  8397. carousel: {
  8398. leftArrow: "Carousel arrow left",
  8399. rightArrow: "Carousel arrow right",
  8400. indicator: "Carousel switch to index {index}"
  8401. }
  8402. }
  8403. };
  8404. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8405. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8406. var _a;
  8407. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8408. });
  8409. const buildLocaleContext = (locale) => {
  8410. const lang = vue.computed(() => vue.unref(locale).name);
  8411. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8412. return {
  8413. lang,
  8414. locale: localeRef,
  8415. t: buildTranslator(locale)
  8416. };
  8417. };
  8418. const localeContextKey = Symbol("localeContextKey");
  8419. const useLocale = (localeOverrides) => {
  8420. const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
  8421. return buildLocaleContext(vue.computed(() => locale.value || English));
  8422. };
  8423. const defaultNamespace = "el";
  8424. const statePrefix = "is-";
  8425. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8426. let cls = `${namespace}-${block}`;
  8427. if (blockSuffix) {
  8428. cls += `-${blockSuffix}`;
  8429. }
  8430. if (element) {
  8431. cls += `__${element}`;
  8432. }
  8433. if (modifier) {
  8434. cls += `--${modifier}`;
  8435. }
  8436. return cls;
  8437. };
  8438. const namespaceContextKey = Symbol("namespaceContextKey");
  8439. const useGetDerivedNamespace = (namespaceOverrides) => {
  8440. const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
  8441. const namespace = vue.computed(() => {
  8442. return vue.unref(derivedNamespace) || defaultNamespace;
  8443. });
  8444. return namespace;
  8445. };
  8446. const useNamespace = (block, namespaceOverrides) => {
  8447. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8448. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8449. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8450. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8451. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8452. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8453. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8454. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8455. const is = (name, ...args) => {
  8456. const state = args.length >= 1 ? args[0] : true;
  8457. return name && state ? `${statePrefix}${name}` : "";
  8458. };
  8459. const cssVar = (object) => {
  8460. const styles = {};
  8461. for (const key in object) {
  8462. if (object[key]) {
  8463. styles[`--${namespace.value}-${key}`] = object[key];
  8464. }
  8465. }
  8466. return styles;
  8467. };
  8468. const cssVarBlock = (object) => {
  8469. const styles = {};
  8470. for (const key in object) {
  8471. if (object[key]) {
  8472. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8473. }
  8474. }
  8475. return styles;
  8476. };
  8477. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8478. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8479. return {
  8480. namespace,
  8481. b,
  8482. e,
  8483. m,
  8484. be,
  8485. em,
  8486. bm,
  8487. bem,
  8488. is,
  8489. cssVar,
  8490. cssVarName,
  8491. cssVarBlock,
  8492. cssVarBlockName
  8493. };
  8494. };
  8495. const useLockscreen = (trigger, options = {}) => {
  8496. if (!vue.isRef(trigger)) {
  8497. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8498. }
  8499. const ns = options.ns || useNamespace("popup");
  8500. const hiddenCls = vue.computed(() => ns.bm("parent", "hidden"));
  8501. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8502. return;
  8503. }
  8504. let scrollBarWidth = 0;
  8505. let withoutHiddenClass = false;
  8506. let bodyWidth = "0";
  8507. const cleanup = () => {
  8508. setTimeout(() => {
  8509. removeClass(document == null ? void 0 : document.body, hiddenCls.value);
  8510. if (withoutHiddenClass && document) {
  8511. document.body.style.width = bodyWidth;
  8512. }
  8513. }, 200);
  8514. };
  8515. vue.watch(trigger, (val) => {
  8516. if (!val) {
  8517. cleanup();
  8518. return;
  8519. }
  8520. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8521. if (withoutHiddenClass) {
  8522. bodyWidth = document.body.style.width;
  8523. }
  8524. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8525. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8526. const bodyOverflowY = getStyle(document.body, "overflowY");
  8527. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8528. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8529. }
  8530. addClass(document.body, hiddenCls.value);
  8531. });
  8532. vue.onScopeDispose(() => cleanup());
  8533. };
  8534. const modalStack = [];
  8535. const closeModal = (e) => {
  8536. if (modalStack.length === 0)
  8537. return;
  8538. if (e.code === EVENT_CODE.esc) {
  8539. e.stopPropagation();
  8540. const topModal = modalStack[modalStack.length - 1];
  8541. topModal.handleClose();
  8542. }
  8543. };
  8544. const useModal = (instance, visibleRef) => {
  8545. vue.watch(visibleRef, (val) => {
  8546. if (val) {
  8547. modalStack.push(instance);
  8548. } else {
  8549. modalStack.splice(modalStack.indexOf(instance), 1);
  8550. }
  8551. });
  8552. };
  8553. if (isClient)
  8554. useEventListener(document, "keydown", closeModal);
  8555. const _prop = buildProp({
  8556. type: definePropType(Boolean),
  8557. default: null
  8558. });
  8559. const _event = buildProp({
  8560. type: definePropType(Function)
  8561. });
  8562. const createModelToggleComposable = (name) => {
  8563. const updateEventKey = `update:${name}`;
  8564. const updateEventKeyRaw = `onUpdate:${name}`;
  8565. const useModelToggleEmits2 = [updateEventKey];
  8566. const useModelToggleProps2 = {
  8567. [name]: _prop,
  8568. [updateEventKeyRaw]: _event
  8569. };
  8570. const useModelToggle2 = ({
  8571. indicator,
  8572. toggleReason,
  8573. shouldHideWhenRouteChanges,
  8574. shouldProceed,
  8575. onShow,
  8576. onHide
  8577. }) => {
  8578. const instance = vue.getCurrentInstance();
  8579. const { emit } = instance;
  8580. const props = instance.props;
  8581. const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw]));
  8582. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8583. const doShow = (event) => {
  8584. if (indicator.value === true) {
  8585. return;
  8586. }
  8587. indicator.value = true;
  8588. if (toggleReason) {
  8589. toggleReason.value = event;
  8590. }
  8591. if (isFunction$1(onShow)) {
  8592. onShow(event);
  8593. }
  8594. };
  8595. const doHide = (event) => {
  8596. if (indicator.value === false) {
  8597. return;
  8598. }
  8599. indicator.value = false;
  8600. if (toggleReason) {
  8601. toggleReason.value = event;
  8602. }
  8603. if (isFunction$1(onHide)) {
  8604. onHide(event);
  8605. }
  8606. };
  8607. const show = (event) => {
  8608. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8609. return;
  8610. const shouldEmit = hasUpdateHandler.value && isClient;
  8611. if (shouldEmit) {
  8612. emit(updateEventKey, true);
  8613. }
  8614. if (isModelBindingAbsent.value || !shouldEmit) {
  8615. doShow(event);
  8616. }
  8617. };
  8618. const hide = (event) => {
  8619. if (props.disabled === true || !isClient)
  8620. return;
  8621. const shouldEmit = hasUpdateHandler.value && isClient;
  8622. if (shouldEmit) {
  8623. emit(updateEventKey, false);
  8624. }
  8625. if (isModelBindingAbsent.value || !shouldEmit) {
  8626. doHide(event);
  8627. }
  8628. };
  8629. const onChange = (val) => {
  8630. if (!isBoolean(val))
  8631. return;
  8632. if (props.disabled && val) {
  8633. if (hasUpdateHandler.value) {
  8634. emit(updateEventKey, false);
  8635. }
  8636. } else if (indicator.value !== val) {
  8637. if (val) {
  8638. doShow();
  8639. } else {
  8640. doHide();
  8641. }
  8642. }
  8643. };
  8644. const toggle = () => {
  8645. if (indicator.value) {
  8646. hide();
  8647. } else {
  8648. show();
  8649. }
  8650. };
  8651. vue.watch(() => props[name], onChange);
  8652. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8653. vue.watch(() => ({
  8654. ...instance.proxy.$route
  8655. }), () => {
  8656. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8657. hide();
  8658. }
  8659. });
  8660. }
  8661. vue.onMounted(() => {
  8662. onChange(props[name]);
  8663. });
  8664. return {
  8665. hide,
  8666. show,
  8667. toggle,
  8668. hasUpdateHandler
  8669. };
  8670. };
  8671. return {
  8672. useModelToggle: useModelToggle2,
  8673. useModelToggleProps: useModelToggleProps2,
  8674. useModelToggleEmits: useModelToggleEmits2
  8675. };
  8676. };
  8677. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8678. const usePreventGlobal = (indicator, evt, cb) => {
  8679. const prevent = (e) => {
  8680. if (cb(e))
  8681. e.stopImmediatePropagation();
  8682. };
  8683. let stop = void 0;
  8684. vue.watch(() => indicator.value, (val) => {
  8685. if (val) {
  8686. stop = useEventListener(document, evt, prevent, true);
  8687. } else {
  8688. stop == null ? void 0 : stop();
  8689. }
  8690. }, { immediate: true });
  8691. };
  8692. const useProp = (name) => {
  8693. const vm = vue.getCurrentInstance();
  8694. return vue.computed(() => {
  8695. var _a, _b;
  8696. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  8697. });
  8698. };
  8699. 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});
  8700. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8701. const stateUpdater = {
  8702. name: "updateState",
  8703. enabled: true,
  8704. phase: "write",
  8705. fn: ({ state }) => {
  8706. const derivedState = deriveState(state);
  8707. Object.assign(states.value, derivedState);
  8708. },
  8709. requires: ["computeStyles"]
  8710. };
  8711. const options = vue.computed(() => {
  8712. const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
  8713. return {
  8714. onFirstUpdate,
  8715. placement: placement || "bottom",
  8716. strategy: strategy || "absolute",
  8717. modifiers: [
  8718. ...modifiers || [],
  8719. stateUpdater,
  8720. { name: "applyStyles", enabled: false }
  8721. ]
  8722. };
  8723. });
  8724. const instanceRef = vue.shallowRef();
  8725. const states = vue.ref({
  8726. styles: {
  8727. popper: {
  8728. position: vue.unref(options).strategy,
  8729. left: "0",
  8730. top: "0"
  8731. },
  8732. arrow: {
  8733. position: "absolute"
  8734. }
  8735. },
  8736. attributes: {}
  8737. });
  8738. const destroy = () => {
  8739. if (!instanceRef.value)
  8740. return;
  8741. instanceRef.value.destroy();
  8742. instanceRef.value = void 0;
  8743. };
  8744. vue.watch(options, (newOptions) => {
  8745. const instance = vue.unref(instanceRef);
  8746. if (instance) {
  8747. instance.setOptions(newOptions);
  8748. }
  8749. }, {
  8750. deep: true
  8751. });
  8752. vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8753. destroy();
  8754. if (!referenceElement || !popperElement)
  8755. return;
  8756. instanceRef.value = yn(referenceElement, popperElement, vue.unref(options));
  8757. });
  8758. vue.onBeforeUnmount(() => {
  8759. destroy();
  8760. });
  8761. return {
  8762. state: vue.computed(() => {
  8763. var _a;
  8764. return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  8765. }),
  8766. styles: vue.computed(() => vue.unref(states).styles),
  8767. attributes: vue.computed(() => vue.unref(states).attributes),
  8768. update: () => {
  8769. var _a;
  8770. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update();
  8771. },
  8772. forceUpdate: () => {
  8773. var _a;
  8774. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  8775. },
  8776. instanceRef: vue.computed(() => vue.unref(instanceRef))
  8777. };
  8778. };
  8779. function deriveState(state) {
  8780. const elements = Object.keys(state.elements);
  8781. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  8782. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  8783. return {
  8784. styles,
  8785. attributes
  8786. };
  8787. }
  8788. const useSameTarget = (handleClick) => {
  8789. if (!handleClick) {
  8790. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8791. }
  8792. let mousedownTarget = false;
  8793. let mouseupTarget = false;
  8794. const onClick = (e) => {
  8795. if (mousedownTarget && mouseupTarget) {
  8796. handleClick(e);
  8797. }
  8798. mousedownTarget = mouseupTarget = false;
  8799. };
  8800. const onMousedown = (e) => {
  8801. mousedownTarget = e.target === e.currentTarget;
  8802. };
  8803. const onMouseup = (e) => {
  8804. mouseupTarget = e.target === e.currentTarget;
  8805. };
  8806. return { onClick, onMousedown, onMouseup };
  8807. };
  8808. const useTeleport = (contentRenderer, appendToBody) => {
  8809. const isTeleportVisible = vue.ref(false);
  8810. if (!isClient) {
  8811. return {
  8812. isTeleportVisible,
  8813. showTeleport: NOOP,
  8814. hideTeleport: NOOP,
  8815. renderTeleport: NOOP
  8816. };
  8817. }
  8818. let $el = null;
  8819. const showTeleport = () => {
  8820. isTeleportVisible.value = true;
  8821. if ($el !== null)
  8822. return;
  8823. $el = createGlobalNode();
  8824. };
  8825. const hideTeleport = () => {
  8826. isTeleportVisible.value = false;
  8827. if ($el !== null) {
  8828. removeGlobalNode($el);
  8829. $el = null;
  8830. }
  8831. };
  8832. const renderTeleport = () => {
  8833. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  8834. };
  8835. vue.onUnmounted(hideTeleport);
  8836. return {
  8837. isTeleportVisible,
  8838. showTeleport,
  8839. hideTeleport,
  8840. renderTeleport
  8841. };
  8842. };
  8843. const useThrottleRender = (loading, throttle = 0) => {
  8844. if (throttle === 0)
  8845. return loading;
  8846. const throttled = vue.ref(false);
  8847. let timeoutHandle = null;
  8848. const dispatchThrottling = () => {
  8849. if (timeoutHandle) {
  8850. clearTimeout(timeoutHandle);
  8851. }
  8852. timeoutHandle = setTimeout(() => {
  8853. throttled.value = loading.value;
  8854. }, throttle);
  8855. };
  8856. vue.onMounted(dispatchThrottling);
  8857. vue.watch(() => loading.value, (val) => {
  8858. if (val) {
  8859. dispatchThrottling();
  8860. } else {
  8861. throttled.value = val;
  8862. }
  8863. });
  8864. return throttled;
  8865. };
  8866. function useTimeout() {
  8867. let timeoutHandle;
  8868. const registerTimeout = (fn, delay) => {
  8869. cancelTimeout();
  8870. timeoutHandle = window.setTimeout(fn, delay);
  8871. };
  8872. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  8873. tryOnScopeDispose(() => cancelTimeout());
  8874. return {
  8875. registerTimeout,
  8876. cancelTimeout
  8877. };
  8878. }
  8879. const AFTER_APPEAR = "after-appear";
  8880. const AFTER_ENTER = "after-enter";
  8881. const AFTER_LEAVE = "after-leave";
  8882. const APPEAR = "appear";
  8883. const APPEAR_CANCELLED = "appear-cancelled";
  8884. const BEFORE_ENTER = "before-enter";
  8885. const BEFORE_LEAVE = "before-leave";
  8886. const ENTER = "enter";
  8887. const ENTER_CANCELLED = "enter-cancelled";
  8888. const LEAVE = "leave";
  8889. const LEAVE_CANCELLED = "leave-cancelled";
  8890. const useTransitionFallthroughEmits = [
  8891. AFTER_APPEAR,
  8892. AFTER_ENTER,
  8893. AFTER_LEAVE,
  8894. APPEAR,
  8895. APPEAR_CANCELLED,
  8896. BEFORE_ENTER,
  8897. BEFORE_LEAVE,
  8898. ENTER,
  8899. ENTER_CANCELLED,
  8900. LEAVE,
  8901. LEAVE_CANCELLED
  8902. ];
  8903. const useTransitionFallthrough = () => {
  8904. const { emit } = vue.getCurrentInstance();
  8905. return {
  8906. onAfterAppear: () => {
  8907. emit(AFTER_APPEAR);
  8908. },
  8909. onAfterEnter: () => {
  8910. emit(AFTER_ENTER);
  8911. },
  8912. onAfterLeave: () => {
  8913. emit(AFTER_LEAVE);
  8914. },
  8915. onAppearCancelled: () => {
  8916. emit(APPEAR_CANCELLED);
  8917. },
  8918. onBeforeEnter: () => {
  8919. emit(BEFORE_ENTER);
  8920. },
  8921. onBeforeLeave: () => {
  8922. emit(BEFORE_LEAVE);
  8923. },
  8924. onEnter: () => {
  8925. emit(ENTER);
  8926. },
  8927. onEnterCancelled: () => {
  8928. emit(ENTER_CANCELLED);
  8929. },
  8930. onLeave: () => {
  8931. emit(LEAVE);
  8932. },
  8933. onLeaveCancelled: () => {
  8934. emit(LEAVE_CANCELLED);
  8935. }
  8936. };
  8937. };
  8938. const defaultIdInjection = {
  8939. prefix: Math.floor(Math.random() * 1e4),
  8940. current: 0
  8941. };
  8942. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8943. const useIdInjection = () => {
  8944. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8945. };
  8946. const useId = (deterministicId) => {
  8947. const idInjection = useIdInjection();
  8948. const namespace = useGetDerivedNamespace();
  8949. const idRef = vue.computed(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8950. return idRef;
  8951. };
  8952. let registeredEscapeHandlers = [];
  8953. const cachedHandler = (e) => {
  8954. const event = e;
  8955. if (event.key === EVENT_CODE.esc) {
  8956. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  8957. }
  8958. };
  8959. const useEscapeKeydown = (handler) => {
  8960. vue.onMounted(() => {
  8961. if (registeredEscapeHandlers.length === 0) {
  8962. document.addEventListener("keydown", cachedHandler);
  8963. }
  8964. if (isClient)
  8965. registeredEscapeHandlers.push(handler);
  8966. });
  8967. vue.onBeforeUnmount(() => {
  8968. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  8969. if (registeredEscapeHandlers.length === 0) {
  8970. if (isClient)
  8971. document.removeEventListener("keydown", cachedHandler);
  8972. }
  8973. });
  8974. };
  8975. let cachedContainer;
  8976. const usePopperContainerId = () => {
  8977. const namespace = useGetDerivedNamespace();
  8978. const idInjection = useIdInjection();
  8979. const id = vue.computed(() => {
  8980. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  8981. });
  8982. const selector = vue.computed(() => `#${id.value}`);
  8983. return {
  8984. id,
  8985. selector
  8986. };
  8987. };
  8988. const createContainer = (id) => {
  8989. const container = document.createElement("div");
  8990. container.id = id;
  8991. document.body.appendChild(container);
  8992. return container;
  8993. };
  8994. const usePopperContainer = () => {
  8995. const { id, selector } = usePopperContainerId();
  8996. vue.onBeforeMount(() => {
  8997. if (!isClient)
  8998. return;
  8999. if (!cachedContainer || !document.body.querySelector(selector.value)) {
  9000. cachedContainer = createContainer(id.value);
  9001. }
  9002. });
  9003. return {
  9004. id,
  9005. selector
  9006. };
  9007. };
  9008. const useDelayedRender = ({
  9009. indicator,
  9010. intermediateIndicator,
  9011. shouldSetIntermediate = () => true,
  9012. beforeShow,
  9013. afterShow,
  9014. afterHide,
  9015. beforeHide
  9016. }) => {
  9017. vue.watch(() => vue.unref(indicator), (val) => {
  9018. if (val) {
  9019. beforeShow == null ? void 0 : beforeShow();
  9020. vue.nextTick(() => {
  9021. if (!vue.unref(indicator))
  9022. return;
  9023. if (shouldSetIntermediate("show")) {
  9024. intermediateIndicator.value = true;
  9025. }
  9026. });
  9027. } else {
  9028. beforeHide == null ? void 0 : beforeHide();
  9029. vue.nextTick(() => {
  9030. if (vue.unref(indicator))
  9031. return;
  9032. if (shouldSetIntermediate("hide")) {
  9033. intermediateIndicator.value = false;
  9034. }
  9035. });
  9036. }
  9037. });
  9038. vue.watch(() => intermediateIndicator.value, (val) => {
  9039. if (val) {
  9040. afterShow == null ? void 0 : afterShow();
  9041. } else {
  9042. afterHide == null ? void 0 : afterHide();
  9043. }
  9044. });
  9045. };
  9046. const useDelayedToggleProps = buildProps({
  9047. showAfter: {
  9048. type: Number,
  9049. default: 0
  9050. },
  9051. hideAfter: {
  9052. type: Number,
  9053. default: 200
  9054. },
  9055. autoClose: {
  9056. type: Number,
  9057. default: 0
  9058. }
  9059. });
  9060. const useDelayedToggle = ({
  9061. showAfter,
  9062. hideAfter,
  9063. autoClose,
  9064. open,
  9065. close
  9066. }) => {
  9067. const { registerTimeout } = useTimeout();
  9068. const {
  9069. registerTimeout: registerTimeoutForAutoClose,
  9070. cancelTimeout: cancelTimeoutForAutoClose
  9071. } = useTimeout();
  9072. const onOpen = (event) => {
  9073. registerTimeout(() => {
  9074. open(event);
  9075. const _autoClose = vue.unref(autoClose);
  9076. if (isNumber(_autoClose) && _autoClose > 0) {
  9077. registerTimeoutForAutoClose(() => {
  9078. close(event);
  9079. }, _autoClose);
  9080. }
  9081. }, vue.unref(showAfter));
  9082. };
  9083. const onClose = (event) => {
  9084. cancelTimeoutForAutoClose();
  9085. registerTimeout(() => {
  9086. close(event);
  9087. }, vue.unref(hideAfter));
  9088. };
  9089. return {
  9090. onOpen,
  9091. onClose
  9092. };
  9093. };
  9094. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9095. const useForwardRef = (forwardRef) => {
  9096. const setForwardRef = (el) => {
  9097. forwardRef.value = el;
  9098. };
  9099. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9100. setForwardRef
  9101. });
  9102. };
  9103. const useForwardRefDirective = (setForwardRef) => {
  9104. return {
  9105. mounted(el) {
  9106. setForwardRef(el);
  9107. },
  9108. updated(el) {
  9109. setForwardRef(el);
  9110. },
  9111. unmounted() {
  9112. setForwardRef(null);
  9113. }
  9114. };
  9115. };
  9116. const initial = {
  9117. current: 0
  9118. };
  9119. const zIndex = vue.ref(0);
  9120. const defaultInitialZIndex = 2e3;
  9121. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9122. const zIndexContextKey = Symbol("zIndexContextKey");
  9123. const useZIndex = (zIndexOverrides) => {
  9124. const increasingInjection = vue.getCurrentInstance() ? vue.inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9125. const zIndexInjection = zIndexOverrides || (vue.getCurrentInstance() ? vue.inject(zIndexContextKey, void 0) : void 0);
  9126. const initialZIndex = vue.computed(() => {
  9127. const zIndexFromInjection = vue.unref(zIndexInjection);
  9128. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9129. });
  9130. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9131. const nextZIndex = () => {
  9132. increasingInjection.current++;
  9133. zIndex.value = increasingInjection.current;
  9134. return currentZIndex.value;
  9135. };
  9136. if (!isClient && !vue.inject(ZINDEX_INJECTION_KEY)) ;
  9137. return {
  9138. initialZIndex,
  9139. currentZIndex,
  9140. nextZIndex
  9141. };
  9142. };
  9143. function getSide(placement) {
  9144. return placement.split('-')[0];
  9145. }
  9146. function getAlignment(placement) {
  9147. return placement.split('-')[1];
  9148. }
  9149. function getMainAxisFromPlacement(placement) {
  9150. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9151. }
  9152. function getLengthFromAxis(axis) {
  9153. return axis === 'y' ? 'height' : 'width';
  9154. }
  9155. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9156. let {
  9157. reference,
  9158. floating
  9159. } = _ref;
  9160. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9161. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9162. const mainAxis = getMainAxisFromPlacement(placement);
  9163. const length = getLengthFromAxis(mainAxis);
  9164. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9165. const side = getSide(placement);
  9166. const isVertical = mainAxis === 'x';
  9167. let coords;
  9168. switch (side) {
  9169. case 'top':
  9170. coords = {
  9171. x: commonX,
  9172. y: reference.y - floating.height
  9173. };
  9174. break;
  9175. case 'bottom':
  9176. coords = {
  9177. x: commonX,
  9178. y: reference.y + reference.height
  9179. };
  9180. break;
  9181. case 'right':
  9182. coords = {
  9183. x: reference.x + reference.width,
  9184. y: commonY
  9185. };
  9186. break;
  9187. case 'left':
  9188. coords = {
  9189. x: reference.x - floating.width,
  9190. y: commonY
  9191. };
  9192. break;
  9193. default:
  9194. coords = {
  9195. x: reference.x,
  9196. y: reference.y
  9197. };
  9198. }
  9199. switch (getAlignment(placement)) {
  9200. case 'start':
  9201. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9202. break;
  9203. case 'end':
  9204. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9205. break;
  9206. }
  9207. return coords;
  9208. }
  9209. /**
  9210. * Computes the `x` and `y` coordinates that will place the floating element
  9211. * next to a reference element when it is given a certain positioning strategy.
  9212. *
  9213. * This export does not have any `platform` interface logic. You will need to
  9214. * write one for the platform you are using Floating UI with.
  9215. */
  9216. const computePosition$1 = async (reference, floating, config) => {
  9217. const {
  9218. placement = 'bottom',
  9219. strategy = 'absolute',
  9220. middleware = [],
  9221. platform
  9222. } = config;
  9223. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9224. let rects = await platform.getElementRects({
  9225. reference,
  9226. floating,
  9227. strategy
  9228. });
  9229. let {
  9230. x,
  9231. y
  9232. } = computeCoordsFromPlacement(rects, placement, rtl);
  9233. let statefulPlacement = placement;
  9234. let middlewareData = {};
  9235. let resetCount = 0;
  9236. for (let i = 0; i < middleware.length; i++) {
  9237. const {
  9238. name,
  9239. fn
  9240. } = middleware[i];
  9241. const {
  9242. x: nextX,
  9243. y: nextY,
  9244. data,
  9245. reset
  9246. } = await fn({
  9247. x,
  9248. y,
  9249. initialPlacement: placement,
  9250. placement: statefulPlacement,
  9251. strategy,
  9252. middlewareData,
  9253. rects,
  9254. platform,
  9255. elements: {
  9256. reference,
  9257. floating
  9258. }
  9259. });
  9260. x = nextX != null ? nextX : x;
  9261. y = nextY != null ? nextY : y;
  9262. middlewareData = { ...middlewareData,
  9263. [name]: { ...middlewareData[name],
  9264. ...data
  9265. }
  9266. };
  9267. if (reset && resetCount <= 50) {
  9268. resetCount++;
  9269. if (typeof reset === 'object') {
  9270. if (reset.placement) {
  9271. statefulPlacement = reset.placement;
  9272. }
  9273. if (reset.rects) {
  9274. rects = reset.rects === true ? await platform.getElementRects({
  9275. reference,
  9276. floating,
  9277. strategy
  9278. }) : reset.rects;
  9279. }
  9280. ({
  9281. x,
  9282. y
  9283. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9284. }
  9285. i = -1;
  9286. continue;
  9287. }
  9288. }
  9289. return {
  9290. x,
  9291. y,
  9292. placement: statefulPlacement,
  9293. strategy,
  9294. middlewareData
  9295. };
  9296. };
  9297. function expandPaddingObject(padding) {
  9298. return {
  9299. top: 0,
  9300. right: 0,
  9301. bottom: 0,
  9302. left: 0,
  9303. ...padding
  9304. };
  9305. }
  9306. function getSideObjectFromPadding(padding) {
  9307. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9308. top: padding,
  9309. right: padding,
  9310. bottom: padding,
  9311. left: padding
  9312. };
  9313. }
  9314. function rectToClientRect(rect) {
  9315. return { ...rect,
  9316. top: rect.y,
  9317. left: rect.x,
  9318. right: rect.x + rect.width,
  9319. bottom: rect.y + rect.height
  9320. };
  9321. }
  9322. /**
  9323. * Resolves with an object of overflow side offsets that determine how much the
  9324. * element is overflowing a given clipping boundary.
  9325. * - positive = overflowing the boundary by that number of pixels
  9326. * - negative = how many pixels left before it will overflow
  9327. * - 0 = lies flush with the boundary
  9328. * @see https://floating-ui.com/docs/detectOverflow
  9329. */
  9330. async function detectOverflow(middlewareArguments, options) {
  9331. var _await$platform$isEle;
  9332. if (options === void 0) {
  9333. options = {};
  9334. }
  9335. const {
  9336. x,
  9337. y,
  9338. platform,
  9339. rects,
  9340. elements,
  9341. strategy
  9342. } = middlewareArguments;
  9343. const {
  9344. boundary = 'clippingAncestors',
  9345. rootBoundary = 'viewport',
  9346. elementContext = 'floating',
  9347. altBoundary = false,
  9348. padding = 0
  9349. } = options;
  9350. const paddingObject = getSideObjectFromPadding(padding);
  9351. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9352. const element = elements[altBoundary ? altContext : elementContext];
  9353. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  9354. element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
  9355. boundary,
  9356. rootBoundary,
  9357. strategy
  9358. }));
  9359. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9360. rect: elementContext === 'floating' ? { ...rects.floating,
  9361. x,
  9362. y
  9363. } : rects.reference,
  9364. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  9365. strategy
  9366. }) : rects[elementContext]);
  9367. return {
  9368. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  9369. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  9370. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  9371. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  9372. };
  9373. }
  9374. const min$2 = Math.min;
  9375. const max$2 = Math.max;
  9376. function within(min$1, value, max$1) {
  9377. return max$2(min$1, min$2(value, max$1));
  9378. }
  9379. /**
  9380. * Positions an inner element of the floating element such that it is centered
  9381. * to the reference element.
  9382. * @see https://floating-ui.com/docs/arrow
  9383. */
  9384. const arrow = options => ({
  9385. name: 'arrow',
  9386. options,
  9387. async fn(middlewareArguments) {
  9388. // Since `element` is required, we don't Partial<> the type
  9389. const {
  9390. element,
  9391. padding = 0
  9392. } = options != null ? options : {};
  9393. const {
  9394. x,
  9395. y,
  9396. placement,
  9397. rects,
  9398. platform
  9399. } = middlewareArguments;
  9400. if (element == null) {
  9401. return {};
  9402. }
  9403. const paddingObject = getSideObjectFromPadding(padding);
  9404. const coords = {
  9405. x,
  9406. y
  9407. };
  9408. const axis = getMainAxisFromPlacement(placement);
  9409. const alignment = getAlignment(placement);
  9410. const length = getLengthFromAxis(axis);
  9411. const arrowDimensions = await platform.getDimensions(element);
  9412. const minProp = axis === 'y' ? 'top' : 'left';
  9413. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9414. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9415. const startDiff = coords[axis] - rects.reference[axis];
  9416. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9417. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9418. if (clientSize === 0) {
  9419. clientSize = rects.floating[length];
  9420. }
  9421. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9422. // point is outside the floating element's bounds
  9423. const min = paddingObject[minProp];
  9424. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9425. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9426. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9427. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9428. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9429. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9430. return {
  9431. [axis]: coords[axis] - alignmentOffset,
  9432. data: {
  9433. [axis]: offset,
  9434. centerOffset: center - offset
  9435. }
  9436. };
  9437. }
  9438. });
  9439. const hash$1 = {
  9440. left: 'right',
  9441. right: 'left',
  9442. bottom: 'top',
  9443. top: 'bottom'
  9444. };
  9445. function getOppositePlacement(placement) {
  9446. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  9447. }
  9448. function getAlignmentSides(placement, rects, rtl) {
  9449. if (rtl === void 0) {
  9450. rtl = false;
  9451. }
  9452. const alignment = getAlignment(placement);
  9453. const mainAxis = getMainAxisFromPlacement(placement);
  9454. const length = getLengthFromAxis(mainAxis);
  9455. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9456. if (rects.reference[length] > rects.floating[length]) {
  9457. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  9458. }
  9459. return {
  9460. main: mainAlignmentSide,
  9461. cross: getOppositePlacement(mainAlignmentSide)
  9462. };
  9463. }
  9464. const hash = {
  9465. start: 'end',
  9466. end: 'start'
  9467. };
  9468. function getOppositeAlignmentPlacement(placement) {
  9469. return placement.replace(/start|end/g, matched => hash[matched]);
  9470. }
  9471. function getExpandedPlacements(placement) {
  9472. const oppositePlacement = getOppositePlacement(placement);
  9473. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  9474. }
  9475. /**
  9476. * Changes the placement of the floating element to one that will fit if the
  9477. * initially specified `placement` does not.
  9478. * @see https://floating-ui.com/docs/flip
  9479. */
  9480. const flip = function (options) {
  9481. if (options === void 0) {
  9482. options = {};
  9483. }
  9484. return {
  9485. name: 'flip',
  9486. options,
  9487. async fn(middlewareArguments) {
  9488. var _middlewareData$flip;
  9489. const {
  9490. placement,
  9491. middlewareData,
  9492. rects,
  9493. initialPlacement,
  9494. platform,
  9495. elements
  9496. } = middlewareArguments;
  9497. const {
  9498. mainAxis: checkMainAxis = true,
  9499. crossAxis: checkCrossAxis = true,
  9500. fallbackPlacements: specifiedFallbackPlacements,
  9501. fallbackStrategy = 'bestFit',
  9502. flipAlignment = true,
  9503. ...detectOverflowOptions
  9504. } = options;
  9505. const side = getSide(placement);
  9506. const isBasePlacement = side === initialPlacement;
  9507. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  9508. const placements = [initialPlacement, ...fallbackPlacements];
  9509. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9510. const overflows = [];
  9511. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  9512. if (checkMainAxis) {
  9513. overflows.push(overflow[side]);
  9514. }
  9515. if (checkCrossAxis) {
  9516. const {
  9517. main,
  9518. cross
  9519. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9520. overflows.push(overflow[main], overflow[cross]);
  9521. }
  9522. overflowsData = [...overflowsData, {
  9523. placement,
  9524. overflows
  9525. }]; // One or more sides is overflowing
  9526. if (!overflows.every(side => side <= 0)) {
  9527. var _middlewareData$flip$, _middlewareData$flip2;
  9528. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  9529. const nextPlacement = placements[nextIndex];
  9530. if (nextPlacement) {
  9531. // Try next placement and re-run the lifecycle
  9532. return {
  9533. data: {
  9534. index: nextIndex,
  9535. overflows: overflowsData
  9536. },
  9537. reset: {
  9538. placement: nextPlacement
  9539. }
  9540. };
  9541. }
  9542. let resetPlacement = 'bottom';
  9543. switch (fallbackStrategy) {
  9544. case 'bestFit':
  9545. {
  9546. var _overflowsData$map$so;
  9547. const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
  9548. if (placement) {
  9549. resetPlacement = placement;
  9550. }
  9551. break;
  9552. }
  9553. case 'initialPlacement':
  9554. resetPlacement = initialPlacement;
  9555. break;
  9556. }
  9557. if (placement !== resetPlacement) {
  9558. return {
  9559. reset: {
  9560. placement: resetPlacement
  9561. }
  9562. };
  9563. }
  9564. }
  9565. return {};
  9566. }
  9567. };
  9568. };
  9569. async function convertValueToCoords(middlewareArguments, value) {
  9570. const {
  9571. placement,
  9572. platform,
  9573. elements
  9574. } = middlewareArguments;
  9575. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9576. const side = getSide(placement);
  9577. const alignment = getAlignment(placement);
  9578. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9579. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9580. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9581. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9582. let {
  9583. mainAxis,
  9584. crossAxis,
  9585. alignmentAxis
  9586. } = typeof rawValue === 'number' ? {
  9587. mainAxis: rawValue,
  9588. crossAxis: 0,
  9589. alignmentAxis: null
  9590. } : {
  9591. mainAxis: 0,
  9592. crossAxis: 0,
  9593. alignmentAxis: null,
  9594. ...rawValue
  9595. };
  9596. if (alignment && typeof alignmentAxis === 'number') {
  9597. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9598. }
  9599. return isVertical ? {
  9600. x: crossAxis * crossAxisMulti,
  9601. y: mainAxis * mainAxisMulti
  9602. } : {
  9603. x: mainAxis * mainAxisMulti,
  9604. y: crossAxis * crossAxisMulti
  9605. };
  9606. }
  9607. /**
  9608. * Displaces the floating element from its reference element.
  9609. * @see https://floating-ui.com/docs/offset
  9610. */
  9611. const offset = function (value) {
  9612. if (value === void 0) {
  9613. value = 0;
  9614. }
  9615. return {
  9616. name: 'offset',
  9617. options: value,
  9618. async fn(middlewareArguments) {
  9619. const {
  9620. x,
  9621. y
  9622. } = middlewareArguments;
  9623. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9624. return {
  9625. x: x + diffCoords.x,
  9626. y: y + diffCoords.y,
  9627. data: diffCoords
  9628. };
  9629. }
  9630. };
  9631. };
  9632. function getCrossAxis(axis) {
  9633. return axis === 'x' ? 'y' : 'x';
  9634. }
  9635. /**
  9636. * Shifts the floating element in order to keep it in view when it will overflow
  9637. * a clipping boundary.
  9638. * @see https://floating-ui.com/docs/shift
  9639. */
  9640. const shift = function (options) {
  9641. if (options === void 0) {
  9642. options = {};
  9643. }
  9644. return {
  9645. name: 'shift',
  9646. options,
  9647. async fn(middlewareArguments) {
  9648. const {
  9649. x,
  9650. y,
  9651. placement
  9652. } = middlewareArguments;
  9653. const {
  9654. mainAxis: checkMainAxis = true,
  9655. crossAxis: checkCrossAxis = false,
  9656. limiter = {
  9657. fn: _ref => {
  9658. let {
  9659. x,
  9660. y
  9661. } = _ref;
  9662. return {
  9663. x,
  9664. y
  9665. };
  9666. }
  9667. },
  9668. ...detectOverflowOptions
  9669. } = options;
  9670. const coords = {
  9671. x,
  9672. y
  9673. };
  9674. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9675. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  9676. const crossAxis = getCrossAxis(mainAxis);
  9677. let mainAxisCoord = coords[mainAxis];
  9678. let crossAxisCoord = coords[crossAxis];
  9679. if (checkMainAxis) {
  9680. const minSide = mainAxis === 'y' ? 'top' : 'left';
  9681. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  9682. const min = mainAxisCoord + overflow[minSide];
  9683. const max = mainAxisCoord - overflow[maxSide];
  9684. mainAxisCoord = within(min, mainAxisCoord, max);
  9685. }
  9686. if (checkCrossAxis) {
  9687. const minSide = crossAxis === 'y' ? 'top' : 'left';
  9688. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  9689. const min = crossAxisCoord + overflow[minSide];
  9690. const max = crossAxisCoord - overflow[maxSide];
  9691. crossAxisCoord = within(min, crossAxisCoord, max);
  9692. }
  9693. const limitedCoords = limiter.fn({ ...middlewareArguments,
  9694. [mainAxis]: mainAxisCoord,
  9695. [crossAxis]: crossAxisCoord
  9696. });
  9697. return { ...limitedCoords,
  9698. data: {
  9699. x: limitedCoords.x - x,
  9700. y: limitedCoords.y - y
  9701. }
  9702. };
  9703. }
  9704. };
  9705. };
  9706. function isWindow(value) {
  9707. return value && value.document && value.location && value.alert && value.setInterval;
  9708. }
  9709. function getWindow(node) {
  9710. if (node == null) {
  9711. return window;
  9712. }
  9713. if (!isWindow(node)) {
  9714. const ownerDocument = node.ownerDocument;
  9715. return ownerDocument ? ownerDocument.defaultView || window : window;
  9716. }
  9717. return node;
  9718. }
  9719. function getComputedStyle$1(element) {
  9720. return getWindow(element).getComputedStyle(element);
  9721. }
  9722. function getNodeName(node) {
  9723. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9724. }
  9725. function getUAString() {
  9726. const uaData = navigator.userAgentData;
  9727. if (uaData != null && uaData.brands) {
  9728. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9729. }
  9730. return navigator.userAgent;
  9731. }
  9732. function isHTMLElement(value) {
  9733. return value instanceof getWindow(value).HTMLElement;
  9734. }
  9735. function isElement(value) {
  9736. return value instanceof getWindow(value).Element;
  9737. }
  9738. function isNode(value) {
  9739. return value instanceof getWindow(value).Node;
  9740. }
  9741. function isShadowRoot(node) {
  9742. // Browsers without `ShadowRoot` support
  9743. if (typeof ShadowRoot === 'undefined') {
  9744. return false;
  9745. }
  9746. const OwnElement = getWindow(node).ShadowRoot;
  9747. return node instanceof OwnElement || node instanceof ShadowRoot;
  9748. }
  9749. function isOverflowElement(element) {
  9750. // Firefox wants us to check `-x` and `-y` variations as well
  9751. const {
  9752. overflow,
  9753. overflowX,
  9754. overflowY
  9755. } = getComputedStyle$1(element);
  9756. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9757. }
  9758. function isTableElement(element) {
  9759. return ['table', 'td', 'th'].includes(getNodeName(element));
  9760. }
  9761. function isContainingBlock(element) {
  9762. // TODO: Try and use feature detection here instead
  9763. const isFirefox = /firefox/i.test(getUAString());
  9764. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9765. // create a containing block.
  9766. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9767. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9768. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9769. }
  9770. function isLayoutViewport() {
  9771. // Not Safari
  9772. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9773. // • Always-visible scrollbar or not
  9774. // • Width of <html>, etc.
  9775. // const vV = win.visualViewport;
  9776. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9777. }
  9778. const min$1 = Math.min;
  9779. const max$1 = Math.max;
  9780. const round = Math.round;
  9781. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9782. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9783. if (includeScale === void 0) {
  9784. includeScale = false;
  9785. }
  9786. if (isFixedStrategy === void 0) {
  9787. isFixedStrategy = false;
  9788. }
  9789. const clientRect = element.getBoundingClientRect();
  9790. let scaleX = 1;
  9791. let scaleY = 1;
  9792. if (includeScale && isHTMLElement(element)) {
  9793. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9794. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9795. }
  9796. const win = isElement(element) ? getWindow(element) : window;
  9797. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9798. 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;
  9799. 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;
  9800. const width = clientRect.width / scaleX;
  9801. const height = clientRect.height / scaleY;
  9802. return {
  9803. width,
  9804. height,
  9805. top: y,
  9806. right: x + width,
  9807. bottom: y + height,
  9808. left: x,
  9809. x,
  9810. y
  9811. };
  9812. }
  9813. function getDocumentElement(node) {
  9814. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9815. }
  9816. function getNodeScroll(element) {
  9817. if (isElement(element)) {
  9818. return {
  9819. scrollLeft: element.scrollLeft,
  9820. scrollTop: element.scrollTop
  9821. };
  9822. }
  9823. return {
  9824. scrollLeft: element.pageXOffset,
  9825. scrollTop: element.pageYOffset
  9826. };
  9827. }
  9828. function getWindowScrollBarX(element) {
  9829. // If <html> has a CSS width greater than the viewport, then this will be
  9830. // incorrect for RTL.
  9831. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9832. }
  9833. function isScaled(element) {
  9834. const rect = getBoundingClientRect(element);
  9835. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9836. }
  9837. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9838. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9839. const documentElement = getDocumentElement(offsetParent);
  9840. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9841. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9842. let scroll = {
  9843. scrollLeft: 0,
  9844. scrollTop: 0
  9845. };
  9846. const offsets = {
  9847. x: 0,
  9848. y: 0
  9849. };
  9850. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9851. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9852. scroll = getNodeScroll(offsetParent);
  9853. }
  9854. if (isHTMLElement(offsetParent)) {
  9855. const offsetRect = getBoundingClientRect(offsetParent, true);
  9856. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9857. offsets.y = offsetRect.y + offsetParent.clientTop;
  9858. } else if (documentElement) {
  9859. offsets.x = getWindowScrollBarX(documentElement);
  9860. }
  9861. }
  9862. return {
  9863. x: rect.left + scroll.scrollLeft - offsets.x,
  9864. y: rect.top + scroll.scrollTop - offsets.y,
  9865. width: rect.width,
  9866. height: rect.height
  9867. };
  9868. }
  9869. function getParentNode(node) {
  9870. if (getNodeName(node) === 'html') {
  9871. return node;
  9872. }
  9873. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9874. // @ts-ignore
  9875. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9876. node.parentNode || ( // DOM Element detected
  9877. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9878. getDocumentElement(node) // fallback
  9879. );
  9880. }
  9881. function getTrueOffsetParent(element) {
  9882. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9883. return null;
  9884. }
  9885. return composedOffsetParent(element);
  9886. }
  9887. /**
  9888. * Polyfills the old offsetParent behavior from before the spec was changed:
  9889. * https://github.com/w3c/csswg-drafts/issues/159
  9890. */
  9891. function composedOffsetParent(element) {
  9892. let {
  9893. offsetParent
  9894. } = element;
  9895. let ancestor = element;
  9896. let foundInsideSlot = false;
  9897. while (ancestor && ancestor !== offsetParent) {
  9898. const {
  9899. assignedSlot
  9900. } = ancestor;
  9901. if (assignedSlot) {
  9902. let newOffsetParent = assignedSlot.offsetParent;
  9903. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9904. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9905. const oldDisplay = assignedSlot.style.display;
  9906. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9907. newOffsetParent = assignedSlot.offsetParent;
  9908. assignedSlot.style.display = oldDisplay;
  9909. if (!hadStyleAttribute) {
  9910. assignedSlot.removeAttribute('style');
  9911. }
  9912. }
  9913. ancestor = assignedSlot;
  9914. if (offsetParent !== newOffsetParent) {
  9915. offsetParent = newOffsetParent;
  9916. foundInsideSlot = true;
  9917. }
  9918. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9919. break;
  9920. }
  9921. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9922. }
  9923. return offsetParent;
  9924. }
  9925. function getContainingBlock(element) {
  9926. let currentNode = getParentNode(element);
  9927. if (isShadowRoot(currentNode)) {
  9928. currentNode = currentNode.host;
  9929. }
  9930. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9931. if (isContainingBlock(currentNode)) {
  9932. return currentNode;
  9933. } else {
  9934. const parent = currentNode.parentNode;
  9935. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9936. }
  9937. }
  9938. return null;
  9939. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9940. // such as table ancestors and cross browser bugs.
  9941. function getOffsetParent(element) {
  9942. const window = getWindow(element);
  9943. let offsetParent = getTrueOffsetParent(element);
  9944. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9945. offsetParent = getTrueOffsetParent(offsetParent);
  9946. }
  9947. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9948. return window;
  9949. }
  9950. return offsetParent || getContainingBlock(element) || window;
  9951. }
  9952. function getDimensions(element) {
  9953. if (isHTMLElement(element)) {
  9954. return {
  9955. width: element.offsetWidth,
  9956. height: element.offsetHeight
  9957. };
  9958. }
  9959. const rect = getBoundingClientRect(element);
  9960. return {
  9961. width: rect.width,
  9962. height: rect.height
  9963. };
  9964. }
  9965. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  9966. let {
  9967. rect,
  9968. offsetParent,
  9969. strategy
  9970. } = _ref;
  9971. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9972. const documentElement = getDocumentElement(offsetParent);
  9973. if (offsetParent === documentElement) {
  9974. return rect;
  9975. }
  9976. let scroll = {
  9977. scrollLeft: 0,
  9978. scrollTop: 0
  9979. };
  9980. const offsets = {
  9981. x: 0,
  9982. y: 0
  9983. };
  9984. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9985. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9986. scroll = getNodeScroll(offsetParent);
  9987. }
  9988. if (isHTMLElement(offsetParent)) {
  9989. const offsetRect = getBoundingClientRect(offsetParent, true);
  9990. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9991. offsets.y = offsetRect.y + offsetParent.clientTop;
  9992. } // This doesn't appear to be need to be negated.
  9993. // else if (documentElement) {
  9994. // offsets.x = getWindowScrollBarX(documentElement);
  9995. // }
  9996. }
  9997. return { ...rect,
  9998. x: rect.x - scroll.scrollLeft + offsets.x,
  9999. y: rect.y - scroll.scrollTop + offsets.y
  10000. };
  10001. }
  10002. function getViewportRect(element, strategy) {
  10003. const win = getWindow(element);
  10004. const html = getDocumentElement(element);
  10005. const visualViewport = win.visualViewport;
  10006. let width = html.clientWidth;
  10007. let height = html.clientHeight;
  10008. let x = 0;
  10009. let y = 0;
  10010. if (visualViewport) {
  10011. width = visualViewport.width;
  10012. height = visualViewport.height;
  10013. const layoutViewport = isLayoutViewport();
  10014. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  10015. x = visualViewport.offsetLeft;
  10016. y = visualViewport.offsetTop;
  10017. }
  10018. }
  10019. return {
  10020. width,
  10021. height,
  10022. x,
  10023. y
  10024. };
  10025. }
  10026. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  10027. function getDocumentRect(element) {
  10028. var _element$ownerDocumen;
  10029. const html = getDocumentElement(element);
  10030. const scroll = getNodeScroll(element);
  10031. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  10032. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  10033. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  10034. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  10035. const y = -scroll.scrollTop;
  10036. if (getComputedStyle$1(body || html).direction === 'rtl') {
  10037. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  10038. }
  10039. return {
  10040. width,
  10041. height,
  10042. x,
  10043. y
  10044. };
  10045. }
  10046. function getNearestOverflowAncestor(node) {
  10047. const parentNode = getParentNode(node);
  10048. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  10049. // @ts-ignore assume body is always available
  10050. return node.ownerDocument.body;
  10051. }
  10052. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  10053. return parentNode;
  10054. }
  10055. return getNearestOverflowAncestor(parentNode);
  10056. }
  10057. function getOverflowAncestors(node, list) {
  10058. var _node$ownerDocument;
  10059. if (list === void 0) {
  10060. list = [];
  10061. }
  10062. const scrollableAncestor = getNearestOverflowAncestor(node);
  10063. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  10064. const win = getWindow(scrollableAncestor);
  10065. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  10066. const updatedList = list.concat(target);
  10067. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  10068. updatedList.concat(getOverflowAncestors(target));
  10069. }
  10070. function contains(parent, child) {
  10071. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  10072. if (parent.contains(child)) {
  10073. return true;
  10074. } // then fallback to custom implementation with Shadow DOM support
  10075. else if (rootNode && isShadowRoot(rootNode)) {
  10076. let next = child;
  10077. do {
  10078. // use `===` replace node.isSameNode()
  10079. if (next && parent === next) {
  10080. return true;
  10081. } // @ts-ignore: need a better way to handle this...
  10082. next = next.parentNode || next.host;
  10083. } while (next);
  10084. }
  10085. return false;
  10086. }
  10087. function getInnerBoundingClientRect(element, strategy) {
  10088. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10089. const top = clientRect.top + element.clientTop;
  10090. const left = clientRect.left + element.clientLeft;
  10091. return {
  10092. top,
  10093. left,
  10094. x: left,
  10095. y: top,
  10096. right: left + element.clientWidth,
  10097. bottom: top + element.clientHeight,
  10098. width: element.clientWidth,
  10099. height: element.clientHeight
  10100. };
  10101. }
  10102. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10103. if (clippingParent === 'viewport') {
  10104. return rectToClientRect(getViewportRect(element, strategy));
  10105. }
  10106. if (isElement(clippingParent)) {
  10107. return getInnerBoundingClientRect(clippingParent, strategy);
  10108. }
  10109. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10110. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10111. // clipping (or hiding) overflowing elements with a position different from
  10112. // `initial`
  10113. function getClippingAncestors(element) {
  10114. const clippingAncestors = getOverflowAncestors(element);
  10115. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10116. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10117. if (!isElement(clipperElement)) {
  10118. return [];
  10119. } // @ts-ignore isElement check ensures we return Array<Element>
  10120. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10121. } // Gets the maximum area that the element is visible in due to any number of
  10122. // clipping ancestors
  10123. function getClippingRect(_ref) {
  10124. let {
  10125. element,
  10126. boundary,
  10127. rootBoundary,
  10128. strategy
  10129. } = _ref;
  10130. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10131. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10132. const firstClippingAncestor = clippingAncestors[0];
  10133. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10134. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10135. accRect.top = max$1(rect.top, accRect.top);
  10136. accRect.right = min$1(rect.right, accRect.right);
  10137. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10138. accRect.left = max$1(rect.left, accRect.left);
  10139. return accRect;
  10140. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10141. return {
  10142. width: clippingRect.right - clippingRect.left,
  10143. height: clippingRect.bottom - clippingRect.top,
  10144. x: clippingRect.left,
  10145. y: clippingRect.top
  10146. };
  10147. }
  10148. const platform = {
  10149. getClippingRect,
  10150. convertOffsetParentRelativeRectToViewportRelativeRect,
  10151. isElement,
  10152. getDimensions,
  10153. getOffsetParent,
  10154. getDocumentElement,
  10155. getElementRects: _ref => {
  10156. let {
  10157. reference,
  10158. floating,
  10159. strategy
  10160. } = _ref;
  10161. return {
  10162. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10163. floating: { ...getDimensions(floating),
  10164. x: 0,
  10165. y: 0
  10166. }
  10167. };
  10168. },
  10169. getClientRects: element => Array.from(element.getClientRects()),
  10170. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10171. };
  10172. /**
  10173. * Automatically updates the position of the floating element when necessary.
  10174. * @see https://floating-ui.com/docs/autoUpdate
  10175. */
  10176. function autoUpdate(reference, floating, update, options) {
  10177. if (options === void 0) {
  10178. options = {};
  10179. }
  10180. const {
  10181. ancestorScroll: _ancestorScroll = true,
  10182. ancestorResize: _ancestorResize = true,
  10183. elementResize = true,
  10184. animationFrame = false
  10185. } = options;
  10186. const ancestorScroll = _ancestorScroll && !animationFrame;
  10187. const ancestorResize = _ancestorResize && !animationFrame;
  10188. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  10189. ancestors.forEach(ancestor => {
  10190. ancestorScroll && ancestor.addEventListener('scroll', update, {
  10191. passive: true
  10192. });
  10193. ancestorResize && ancestor.addEventListener('resize', update);
  10194. });
  10195. let observer = null;
  10196. if (elementResize) {
  10197. let initialUpdate = true;
  10198. observer = new ResizeObserver(() => {
  10199. if (!initialUpdate) {
  10200. update();
  10201. }
  10202. initialUpdate = false;
  10203. });
  10204. isElement(reference) && !animationFrame && observer.observe(reference);
  10205. observer.observe(floating);
  10206. }
  10207. let frameId;
  10208. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  10209. if (animationFrame) {
  10210. frameLoop();
  10211. }
  10212. function frameLoop() {
  10213. const nextRefRect = getBoundingClientRect(reference);
  10214. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  10215. update();
  10216. }
  10217. prevRefRect = nextRefRect;
  10218. frameId = requestAnimationFrame(frameLoop);
  10219. }
  10220. update();
  10221. return () => {
  10222. var _observer;
  10223. ancestors.forEach(ancestor => {
  10224. ancestorScroll && ancestor.removeEventListener('scroll', update);
  10225. ancestorResize && ancestor.removeEventListener('resize', update);
  10226. });
  10227. (_observer = observer) == null ? void 0 : _observer.disconnect();
  10228. observer = null;
  10229. if (animationFrame) {
  10230. cancelAnimationFrame(frameId);
  10231. }
  10232. };
  10233. }
  10234. /**
  10235. * Computes the `x` and `y` coordinates that will place the floating element
  10236. * next to a reference element when it is given a certain CSS positioning
  10237. * strategy.
  10238. */
  10239. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10240. platform,
  10241. ...options
  10242. });
  10243. const useFloatingProps = buildProps({});
  10244. const unrefReference = (elRef) => {
  10245. if (!isClient)
  10246. return;
  10247. if (!elRef)
  10248. return elRef;
  10249. const unrefEl = unrefElement(elRef);
  10250. if (unrefEl)
  10251. return unrefEl;
  10252. return vue.isRef(elRef) ? unrefEl : elRef;
  10253. };
  10254. const getPositionDataWithUnit = (record, key) => {
  10255. const value = record == null ? void 0 : record[key];
  10256. return isNil(value) ? "" : `${value}px`;
  10257. };
  10258. const useFloating$1 = ({
  10259. middleware,
  10260. placement,
  10261. strategy
  10262. }) => {
  10263. const referenceRef = vue.ref();
  10264. const contentRef = vue.ref();
  10265. const x = vue.ref();
  10266. const y = vue.ref();
  10267. const middlewareData = vue.ref({});
  10268. const states = {
  10269. x,
  10270. y,
  10271. placement,
  10272. strategy,
  10273. middlewareData
  10274. };
  10275. const update = async () => {
  10276. if (!isClient)
  10277. return;
  10278. const referenceEl = unrefReference(referenceRef);
  10279. const contentEl = unrefElement(contentRef);
  10280. if (!referenceEl || !contentEl)
  10281. return;
  10282. const data = await computePosition(referenceEl, contentEl, {
  10283. placement: vue.unref(placement),
  10284. strategy: vue.unref(strategy),
  10285. middleware: vue.unref(middleware)
  10286. });
  10287. keysOf(states).forEach((key) => {
  10288. states[key].value = data[key];
  10289. });
  10290. };
  10291. vue.onMounted(() => {
  10292. vue.watchEffect(() => {
  10293. update();
  10294. });
  10295. });
  10296. return {
  10297. ...states,
  10298. update,
  10299. referenceRef,
  10300. contentRef
  10301. };
  10302. };
  10303. const arrowMiddleware = ({
  10304. arrowRef,
  10305. padding
  10306. }) => {
  10307. return {
  10308. name: "arrow",
  10309. options: {
  10310. element: arrowRef,
  10311. padding
  10312. },
  10313. fn(args) {
  10314. const arrowEl = vue.unref(arrowRef);
  10315. if (!arrowEl)
  10316. return {};
  10317. return arrow({
  10318. element: arrowEl,
  10319. padding
  10320. }).fn(args);
  10321. }
  10322. };
  10323. };
  10324. function useCursor(input) {
  10325. let selectionInfo;
  10326. function recordCursor() {
  10327. if (input.value == void 0)
  10328. return;
  10329. const { selectionStart, selectionEnd, value } = input.value;
  10330. if (selectionStart == null || selectionEnd == null)
  10331. return;
  10332. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10333. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10334. selectionInfo = {
  10335. selectionStart,
  10336. selectionEnd,
  10337. value,
  10338. beforeTxt,
  10339. afterTxt
  10340. };
  10341. }
  10342. function setCursor() {
  10343. if (input.value == void 0 || selectionInfo == void 0)
  10344. return;
  10345. const { value } = input.value;
  10346. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  10347. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10348. return;
  10349. let startPos = value.length;
  10350. if (value.endsWith(afterTxt)) {
  10351. startPos = value.length - afterTxt.length;
  10352. } else if (value.startsWith(beforeTxt)) {
  10353. startPos = beforeTxt.length;
  10354. } else {
  10355. const beforeLastChar = beforeTxt[selectionStart - 1];
  10356. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10357. if (newIndex !== -1) {
  10358. startPos = newIndex + 1;
  10359. }
  10360. }
  10361. input.value.setSelectionRange(startPos, startPos);
  10362. }
  10363. return [recordCursor, setCursor];
  10364. }
  10365. const getOrderedChildren = (vm, childComponentName, children) => {
  10366. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10367. var _a;
  10368. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10369. });
  10370. const uids = nodes.map((n) => n.component.uid);
  10371. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10372. };
  10373. const useOrderedChildren = (vm, childComponentName) => {
  10374. const children = {};
  10375. const orderedChildren = vue.shallowRef([]);
  10376. const addChild = (child) => {
  10377. children[child.uid] = child;
  10378. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10379. };
  10380. const removeChild = (uid) => {
  10381. delete children[uid];
  10382. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10383. };
  10384. return {
  10385. children: orderedChildren,
  10386. addChild,
  10387. removeChild
  10388. };
  10389. };
  10390. const useSizeProp = buildProp({
  10391. type: String,
  10392. values: componentSizes,
  10393. required: false
  10394. });
  10395. const useSizeProps = {
  10396. size: useSizeProp
  10397. };
  10398. const SIZE_INJECTION_KEY = Symbol("size");
  10399. const useGlobalSize = () => {
  10400. const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
  10401. return vue.computed(() => {
  10402. return vue.unref(injectedSize.size) || "";
  10403. });
  10404. };
  10405. function useFocusController(target, {
  10406. beforeFocus,
  10407. afterFocus,
  10408. beforeBlur,
  10409. afterBlur
  10410. } = {}) {
  10411. const instance = vue.getCurrentInstance();
  10412. const { emit } = instance;
  10413. const wrapperRef = vue.shallowRef();
  10414. const isFocused = vue.ref(false);
  10415. const handleFocus = (event) => {
  10416. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  10417. if (cancelFocus || isFocused.value)
  10418. return;
  10419. isFocused.value = true;
  10420. emit("focus", event);
  10421. afterFocus == null ? void 0 : afterFocus();
  10422. };
  10423. const handleBlur = (event) => {
  10424. var _a;
  10425. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  10426. if (cancelBlur || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)))
  10427. return;
  10428. isFocused.value = false;
  10429. emit("blur", event);
  10430. afterBlur == null ? void 0 : afterBlur();
  10431. };
  10432. const handleClick = () => {
  10433. var _a, _b;
  10434. if (((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
  10435. return;
  10436. (_b = target.value) == null ? void 0 : _b.focus();
  10437. };
  10438. vue.watch(wrapperRef, (el) => {
  10439. if (el) {
  10440. el.setAttribute("tabindex", "-1");
  10441. }
  10442. });
  10443. useEventListener(wrapperRef, "focus", handleFocus, true);
  10444. useEventListener(wrapperRef, "blur", handleBlur, true);
  10445. useEventListener(wrapperRef, "click", handleClick, true);
  10446. return {
  10447. isFocused,
  10448. wrapperRef,
  10449. handleFocus,
  10450. handleBlur
  10451. };
  10452. }
  10453. function useComposition({
  10454. afterComposition,
  10455. emit
  10456. }) {
  10457. const isComposing = vue.ref(false);
  10458. const handleCompositionStart = (event) => {
  10459. emit == null ? void 0 : emit("compositionstart", event);
  10460. isComposing.value = true;
  10461. };
  10462. const handleCompositionUpdate = (event) => {
  10463. var _a;
  10464. emit == null ? void 0 : emit("compositionupdate", event);
  10465. const text = (_a = event.target) == null ? void 0 : _a.value;
  10466. const lastCharacter = text[text.length - 1] || "";
  10467. isComposing.value = !isKorean(lastCharacter);
  10468. };
  10469. const handleCompositionEnd = (event) => {
  10470. emit == null ? void 0 : emit("compositionend", event);
  10471. if (isComposing.value) {
  10472. isComposing.value = false;
  10473. vue.nextTick(() => afterComposition(event));
  10474. }
  10475. };
  10476. const handleComposition = (event) => {
  10477. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  10478. };
  10479. return {
  10480. isComposing,
  10481. handleComposition,
  10482. handleCompositionStart,
  10483. handleCompositionUpdate,
  10484. handleCompositionEnd
  10485. };
  10486. }
  10487. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  10488. const SCOPE$3 = "use-empty-values";
  10489. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  10490. const DEFAULT_VALUE_ON_CLEAR = void 0;
  10491. const useEmptyValuesProps = buildProps({
  10492. emptyValues: Array,
  10493. valueOnClear: {
  10494. type: [String, Number, Boolean, Function],
  10495. default: void 0,
  10496. validator: (val) => isFunction$1(val) ? !val() : !val
  10497. }
  10498. });
  10499. const useEmptyValues = (props, defaultValue) => {
  10500. const config = vue.getCurrentInstance() ? vue.inject(emptyValuesContextKey, vue.ref({})) : vue.ref({});
  10501. const emptyValues = vue.computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  10502. const valueOnClear = vue.computed(() => {
  10503. if (isFunction$1(props.valueOnClear)) {
  10504. return props.valueOnClear();
  10505. } else if (props.valueOnClear !== void 0) {
  10506. return props.valueOnClear;
  10507. } else if (isFunction$1(config.value.valueOnClear)) {
  10508. return config.value.valueOnClear();
  10509. } else if (config.value.valueOnClear !== void 0) {
  10510. return config.value.valueOnClear;
  10511. }
  10512. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  10513. });
  10514. const isEmptyValue = (value) => {
  10515. return emptyValues.value.includes(value);
  10516. };
  10517. if (!emptyValues.value.includes(valueOnClear.value)) ;
  10518. return {
  10519. emptyValues,
  10520. valueOnClear,
  10521. isEmptyValue
  10522. };
  10523. };
  10524. const ariaProps = buildProps({
  10525. ariaLabel: String,
  10526. ariaOrientation: {
  10527. type: String,
  10528. values: ["horizontal", "vertical", "undefined"]
  10529. },
  10530. ariaControls: String
  10531. });
  10532. const useAriaProps = (arias) => {
  10533. return pick(ariaProps, arias);
  10534. };
  10535. const configProviderContextKey = Symbol();
  10536. const globalConfig = vue.ref();
  10537. function useGlobalConfig(key, defaultValue = void 0) {
  10538. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  10539. if (key) {
  10540. return vue.computed(() => {
  10541. var _a, _b;
  10542. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  10543. });
  10544. } else {
  10545. return config;
  10546. }
  10547. }
  10548. function useGlobalComponentSettings(block, sizeFallback) {
  10549. const config = useGlobalConfig();
  10550. const ns = useNamespace(block, vue.computed(() => {
  10551. var _a;
  10552. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  10553. }));
  10554. const locale = useLocale(vue.computed(() => {
  10555. var _a;
  10556. return (_a = config.value) == null ? void 0 : _a.locale;
  10557. }));
  10558. const zIndex = useZIndex(vue.computed(() => {
  10559. var _a;
  10560. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  10561. }));
  10562. const size = vue.computed(() => {
  10563. var _a;
  10564. return vue.unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  10565. });
  10566. provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
  10567. return {
  10568. ns,
  10569. locale,
  10570. zIndex,
  10571. size
  10572. };
  10573. }
  10574. const provideGlobalConfig = (config, app, global = false) => {
  10575. var _a;
  10576. const inSetup = !!vue.getCurrentInstance();
  10577. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10578. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  10579. if (!provideFn) {
  10580. return;
  10581. }
  10582. const context = vue.computed(() => {
  10583. const cfg = vue.unref(config);
  10584. if (!(oldConfig == null ? void 0 : oldConfig.value))
  10585. return cfg;
  10586. return mergeConfig(oldConfig.value, cfg);
  10587. });
  10588. provideFn(configProviderContextKey, context);
  10589. provideFn(localeContextKey, vue.computed(() => context.value.locale));
  10590. provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
  10591. provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
  10592. provideFn(SIZE_INJECTION_KEY, {
  10593. size: vue.computed(() => context.value.size || "")
  10594. });
  10595. provideFn(emptyValuesContextKey, vue.computed(() => ({
  10596. emptyValues: context.value.emptyValues,
  10597. valueOnClear: context.value.valueOnClear
  10598. })));
  10599. if (global || !globalConfig.value) {
  10600. globalConfig.value = context.value;
  10601. }
  10602. return context;
  10603. };
  10604. const mergeConfig = (a, b) => {
  10605. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  10606. const obj = {};
  10607. for (const key of keys) {
  10608. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  10609. }
  10610. return obj;
  10611. };
  10612. const configProviderProps = buildProps({
  10613. a11y: {
  10614. type: Boolean,
  10615. default: true
  10616. },
  10617. locale: {
  10618. type: definePropType(Object)
  10619. },
  10620. size: useSizeProp,
  10621. button: {
  10622. type: definePropType(Object)
  10623. },
  10624. experimentalFeatures: {
  10625. type: definePropType(Object)
  10626. },
  10627. keyboardNavigation: {
  10628. type: Boolean,
  10629. default: true
  10630. },
  10631. message: {
  10632. type: definePropType(Object)
  10633. },
  10634. zIndex: Number,
  10635. namespace: {
  10636. type: String,
  10637. default: "el"
  10638. },
  10639. ...useEmptyValuesProps
  10640. });
  10641. const messageConfig = {};
  10642. const ConfigProvider = vue.defineComponent({
  10643. name: "ElConfigProvider",
  10644. props: configProviderProps,
  10645. setup(props, { slots }) {
  10646. vue.watch(() => props.message, (val) => {
  10647. Object.assign(messageConfig, val != null ? val : {});
  10648. }, { immediate: true, deep: true });
  10649. const config = provideGlobalConfig(props);
  10650. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  10651. }
  10652. });
  10653. const ElConfigProvider = withInstall(ConfigProvider);
  10654. const version$1 = "2.8.2";
  10655. const makeInstaller = (components = []) => {
  10656. const install = (app, options) => {
  10657. if (app[INSTALLED_KEY])
  10658. return;
  10659. app[INSTALLED_KEY] = true;
  10660. components.forEach((c) => app.use(c));
  10661. if (options)
  10662. provideGlobalConfig(options, app, true);
  10663. };
  10664. return {
  10665. version: version$1,
  10666. install
  10667. };
  10668. };
  10669. const affixProps = buildProps({
  10670. zIndex: {
  10671. type: definePropType([Number, String]),
  10672. default: 100
  10673. },
  10674. target: {
  10675. type: String,
  10676. default: ""
  10677. },
  10678. offset: {
  10679. type: Number,
  10680. default: 0
  10681. },
  10682. position: {
  10683. type: String,
  10684. values: ["top", "bottom"],
  10685. default: "top"
  10686. }
  10687. });
  10688. const affixEmits = {
  10689. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10690. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10691. };
  10692. var _export_sfc = (sfc, props) => {
  10693. const target = sfc.__vccOpts || sfc;
  10694. for (const [key, val] of props) {
  10695. target[key] = val;
  10696. }
  10697. return target;
  10698. };
  10699. const COMPONENT_NAME$n = "ElAffix";
  10700. const __default__$1O = vue.defineComponent({
  10701. name: COMPONENT_NAME$n
  10702. });
  10703. const _sfc_main$2u = /* @__PURE__ */ vue.defineComponent({
  10704. ...__default__$1O,
  10705. props: affixProps,
  10706. emits: affixEmits,
  10707. setup(__props, { expose, emit }) {
  10708. const props = __props;
  10709. const ns = useNamespace("affix");
  10710. const target = vue.shallowRef();
  10711. const root = vue.shallowRef();
  10712. const scrollContainer = vue.shallowRef();
  10713. const { height: windowHeight } = useWindowSize();
  10714. const {
  10715. height: rootHeight,
  10716. width: rootWidth,
  10717. top: rootTop,
  10718. bottom: rootBottom,
  10719. update: updateRoot
  10720. } = useElementBounding(root, { windowScroll: false });
  10721. const targetRect = useElementBounding(target);
  10722. const fixed = vue.ref(false);
  10723. const scrollTop = vue.ref(0);
  10724. const transform = vue.ref(0);
  10725. const rootStyle = vue.computed(() => {
  10726. return {
  10727. height: fixed.value ? `${rootHeight.value}px` : "",
  10728. width: fixed.value ? `${rootWidth.value}px` : ""
  10729. };
  10730. });
  10731. const affixStyle = vue.computed(() => {
  10732. if (!fixed.value)
  10733. return {};
  10734. const offset = props.offset ? addUnit(props.offset) : 0;
  10735. return {
  10736. height: `${rootHeight.value}px`,
  10737. width: `${rootWidth.value}px`,
  10738. top: props.position === "top" ? offset : "",
  10739. bottom: props.position === "bottom" ? offset : "",
  10740. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10741. zIndex: props.zIndex
  10742. };
  10743. });
  10744. const update = () => {
  10745. if (!scrollContainer.value)
  10746. return;
  10747. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10748. const { position, target: target2, offset } = props;
  10749. const rootHeightOffset = offset + rootHeight.value;
  10750. if (position === "top") {
  10751. if (target2) {
  10752. const difference = targetRect.bottom.value - rootHeightOffset;
  10753. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  10754. transform.value = difference < 0 ? difference : 0;
  10755. } else {
  10756. fixed.value = offset > rootTop.value;
  10757. }
  10758. } else if (target2) {
  10759. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  10760. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10761. transform.value = difference < 0 ? -difference : 0;
  10762. } else {
  10763. fixed.value = windowHeight.value - offset < rootBottom.value;
  10764. }
  10765. };
  10766. const handleScroll = () => {
  10767. updateRoot();
  10768. emit("scroll", {
  10769. scrollTop: scrollTop.value,
  10770. fixed: fixed.value
  10771. });
  10772. };
  10773. vue.watch(fixed, (val) => emit("change", val));
  10774. vue.onMounted(() => {
  10775. var _a;
  10776. if (props.target) {
  10777. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10778. if (!target.value)
  10779. throwError(COMPONENT_NAME$n, `Target does not exist: ${props.target}`);
  10780. } else {
  10781. target.value = document.documentElement;
  10782. }
  10783. scrollContainer.value = getScrollContainer(root.value, true);
  10784. updateRoot();
  10785. });
  10786. useEventListener(scrollContainer, "scroll", handleScroll);
  10787. vue.watchEffect(update);
  10788. expose({
  10789. update,
  10790. updateRoot
  10791. });
  10792. return (_ctx, _cache) => {
  10793. return vue.openBlock(), vue.createElementBlock("div", {
  10794. ref_key: "root",
  10795. ref: root,
  10796. class: vue.normalizeClass(vue.unref(ns).b()),
  10797. style: vue.normalizeStyle(vue.unref(rootStyle))
  10798. }, [
  10799. vue.createElementVNode("div", {
  10800. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  10801. style: vue.normalizeStyle(vue.unref(affixStyle))
  10802. }, [
  10803. vue.renderSlot(_ctx.$slots, "default")
  10804. ], 6)
  10805. ], 6);
  10806. };
  10807. }
  10808. });
  10809. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2u, [["__file", "affix.vue"]]);
  10810. const ElAffix = withInstall(Affix);
  10811. const iconProps = buildProps({
  10812. size: {
  10813. type: definePropType([Number, String])
  10814. },
  10815. color: {
  10816. type: String
  10817. }
  10818. });
  10819. const __default__$1N = vue.defineComponent({
  10820. name: "ElIcon",
  10821. inheritAttrs: false
  10822. });
  10823. const _sfc_main$2t = /* @__PURE__ */ vue.defineComponent({
  10824. ...__default__$1N,
  10825. props: iconProps,
  10826. setup(__props) {
  10827. const props = __props;
  10828. const ns = useNamespace("icon");
  10829. const style = vue.computed(() => {
  10830. const { size, color } = props;
  10831. if (!size && !color)
  10832. return {};
  10833. return {
  10834. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10835. "--color": color
  10836. };
  10837. });
  10838. return (_ctx, _cache) => {
  10839. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  10840. class: vue.unref(ns).b(),
  10841. style: vue.unref(style)
  10842. }, _ctx.$attrs), [
  10843. vue.renderSlot(_ctx.$slots, "default")
  10844. ], 16);
  10845. };
  10846. }
  10847. });
  10848. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2t, [["__file", "icon.vue"]]);
  10849. const ElIcon = withInstall(Icon);
  10850. const alertEffects = ["light", "dark"];
  10851. const alertProps = buildProps({
  10852. title: {
  10853. type: String,
  10854. default: ""
  10855. },
  10856. description: {
  10857. type: String,
  10858. default: ""
  10859. },
  10860. type: {
  10861. type: String,
  10862. values: keysOf(TypeComponentsMap),
  10863. default: "info"
  10864. },
  10865. closable: {
  10866. type: Boolean,
  10867. default: true
  10868. },
  10869. closeText: {
  10870. type: String,
  10871. default: ""
  10872. },
  10873. showIcon: Boolean,
  10874. center: Boolean,
  10875. effect: {
  10876. type: String,
  10877. values: alertEffects,
  10878. default: "light"
  10879. }
  10880. });
  10881. const alertEmits = {
  10882. close: (evt) => evt instanceof MouseEvent
  10883. };
  10884. const __default__$1M = vue.defineComponent({
  10885. name: "ElAlert"
  10886. });
  10887. const _sfc_main$2s = /* @__PURE__ */ vue.defineComponent({
  10888. ...__default__$1M,
  10889. props: alertProps,
  10890. emits: alertEmits,
  10891. setup(__props, { emit }) {
  10892. const props = __props;
  10893. const { Close } = TypeComponents;
  10894. const slots = vue.useSlots();
  10895. const ns = useNamespace("alert");
  10896. const visible = vue.ref(true);
  10897. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  10898. const iconClass = vue.computed(() => [
  10899. ns.e("icon"),
  10900. { [ns.is("big")]: !!props.description || !!slots.default }
  10901. ]);
  10902. const withDescription = vue.computed(() => {
  10903. return { "with-description": props.description || slots.default };
  10904. });
  10905. const close = (evt) => {
  10906. visible.value = false;
  10907. emit("close", evt);
  10908. };
  10909. return (_ctx, _cache) => {
  10910. return vue.openBlock(), vue.createBlock(vue.Transition, {
  10911. name: vue.unref(ns).b("fade"),
  10912. persisted: ""
  10913. }, {
  10914. default: vue.withCtx(() => [
  10915. vue.withDirectives(vue.createElementVNode("div", {
  10916. 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)]),
  10917. role: "alert"
  10918. }, [
  10919. _ctx.showIcon && vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10920. key: 0,
  10921. class: vue.normalizeClass(vue.unref(iconClass))
  10922. }, {
  10923. default: vue.withCtx(() => [
  10924. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  10925. ]),
  10926. _: 1
  10927. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  10928. vue.createElementVNode("div", {
  10929. class: vue.normalizeClass(vue.unref(ns).e("content"))
  10930. }, [
  10931. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  10932. key: 0,
  10933. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(withDescription)])
  10934. }, [
  10935. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  10936. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  10937. ])
  10938. ], 2)) : vue.createCommentVNode("v-if", true),
  10939. _ctx.$slots.default || _ctx.description ? (vue.openBlock(), vue.createElementBlock("p", {
  10940. key: 1,
  10941. class: vue.normalizeClass(vue.unref(ns).e("description"))
  10942. }, [
  10943. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  10944. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  10945. ])
  10946. ], 2)) : vue.createCommentVNode("v-if", true),
  10947. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  10948. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  10949. key: 0,
  10950. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  10951. onClick: close
  10952. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10953. key: 1,
  10954. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  10955. onClick: close
  10956. }, {
  10957. default: vue.withCtx(() => [
  10958. vue.createVNode(vue.unref(Close))
  10959. ]),
  10960. _: 1
  10961. }, 8, ["class"]))
  10962. ], 64)) : vue.createCommentVNode("v-if", true)
  10963. ], 2)
  10964. ], 2), [
  10965. [vue.vShow, visible.value]
  10966. ])
  10967. ]),
  10968. _: 3
  10969. }, 8, ["name"]);
  10970. };
  10971. }
  10972. });
  10973. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__file", "alert.vue"]]);
  10974. const ElAlert = withInstall(Alert);
  10975. const formContextKey = Symbol("formContextKey");
  10976. const formItemContextKey = Symbol("formItemContextKey");
  10977. const useFormSize = (fallback, ignore = {}) => {
  10978. const emptyRef = vue.ref(void 0);
  10979. const size = ignore.prop ? emptyRef : useProp("size");
  10980. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  10981. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  10982. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  10983. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  10984. };
  10985. const useFormDisabled = (fallback) => {
  10986. const disabled = useProp("disabled");
  10987. const form = vue.inject(formContextKey, void 0);
  10988. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  10989. };
  10990. const useSize = useFormSize;
  10991. const useDisabled = useFormDisabled;
  10992. const useFormItem = () => {
  10993. const form = vue.inject(formContextKey, void 0);
  10994. const formItem = vue.inject(formItemContextKey, void 0);
  10995. return {
  10996. form,
  10997. formItem
  10998. };
  10999. };
  11000. const useFormItemInputId = (props, {
  11001. formItemContext,
  11002. disableIdGeneration,
  11003. disableIdManagement
  11004. }) => {
  11005. if (!disableIdGeneration) {
  11006. disableIdGeneration = vue.ref(false);
  11007. }
  11008. if (!disableIdManagement) {
  11009. disableIdManagement = vue.ref(false);
  11010. }
  11011. const inputId = vue.ref();
  11012. let idUnwatch = void 0;
  11013. const isLabeledByFormItem = vue.computed(() => {
  11014. var _a;
  11015. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  11016. });
  11017. vue.onMounted(() => {
  11018. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  11019. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  11020. if (newId !== inputId.value) {
  11021. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11022. inputId.value && formItemContext.removeInputId(inputId.value);
  11023. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  11024. formItemContext.addInputId(newId);
  11025. }
  11026. }
  11027. inputId.value = newId;
  11028. }
  11029. }, { immediate: true });
  11030. });
  11031. vue.onUnmounted(() => {
  11032. idUnwatch && idUnwatch();
  11033. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11034. inputId.value && formItemContext.removeInputId(inputId.value);
  11035. }
  11036. });
  11037. return {
  11038. isLabeledByFormItem,
  11039. inputId
  11040. };
  11041. };
  11042. const formMetaProps = buildProps({
  11043. size: {
  11044. type: String,
  11045. values: componentSizes
  11046. },
  11047. disabled: Boolean
  11048. });
  11049. const formProps = buildProps({
  11050. ...formMetaProps,
  11051. model: Object,
  11052. rules: {
  11053. type: definePropType(Object)
  11054. },
  11055. labelPosition: {
  11056. type: String,
  11057. values: ["left", "right", "top"],
  11058. default: "right"
  11059. },
  11060. requireAsteriskPosition: {
  11061. type: String,
  11062. values: ["left", "right"],
  11063. default: "left"
  11064. },
  11065. labelWidth: {
  11066. type: [String, Number],
  11067. default: ""
  11068. },
  11069. labelSuffix: {
  11070. type: String,
  11071. default: ""
  11072. },
  11073. inline: Boolean,
  11074. inlineMessage: Boolean,
  11075. statusIcon: Boolean,
  11076. showMessage: {
  11077. type: Boolean,
  11078. default: true
  11079. },
  11080. validateOnRuleChange: {
  11081. type: Boolean,
  11082. default: true
  11083. },
  11084. hideRequiredAsterisk: Boolean,
  11085. scrollToError: Boolean,
  11086. scrollIntoViewOptions: {
  11087. type: [Object, Boolean]
  11088. }
  11089. });
  11090. const formEmits = {
  11091. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  11092. };
  11093. function useFormLabelWidth() {
  11094. const potentialLabelWidthArr = vue.ref([]);
  11095. const autoLabelWidth = vue.computed(() => {
  11096. if (!potentialLabelWidthArr.value.length)
  11097. return "0";
  11098. const max = Math.max(...potentialLabelWidthArr.value);
  11099. return max ? `${max}px` : "";
  11100. });
  11101. function getLabelWidthIndex(width) {
  11102. const index = potentialLabelWidthArr.value.indexOf(width);
  11103. if (index === -1 && autoLabelWidth.value === "0") ;
  11104. return index;
  11105. }
  11106. function registerLabelWidth(val, oldVal) {
  11107. if (val && oldVal) {
  11108. const index = getLabelWidthIndex(oldVal);
  11109. potentialLabelWidthArr.value.splice(index, 1, val);
  11110. } else if (val) {
  11111. potentialLabelWidthArr.value.push(val);
  11112. }
  11113. }
  11114. function deregisterLabelWidth(val) {
  11115. const index = getLabelWidthIndex(val);
  11116. if (index > -1) {
  11117. potentialLabelWidthArr.value.splice(index, 1);
  11118. }
  11119. }
  11120. return {
  11121. autoLabelWidth,
  11122. registerLabelWidth,
  11123. deregisterLabelWidth
  11124. };
  11125. }
  11126. const filterFields = (fields, props) => {
  11127. const normalized = castArray$1(props);
  11128. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  11129. };
  11130. const COMPONENT_NAME$m = "ElForm";
  11131. const __default__$1L = vue.defineComponent({
  11132. name: COMPONENT_NAME$m
  11133. });
  11134. const _sfc_main$2r = /* @__PURE__ */ vue.defineComponent({
  11135. ...__default__$1L,
  11136. props: formProps,
  11137. emits: formEmits,
  11138. setup(__props, { expose, emit }) {
  11139. const props = __props;
  11140. const fields = [];
  11141. const formSize = useFormSize();
  11142. const ns = useNamespace("form");
  11143. const formClasses = vue.computed(() => {
  11144. const { labelPosition, inline } = props;
  11145. return [
  11146. ns.b(),
  11147. ns.m(formSize.value || "default"),
  11148. {
  11149. [ns.m(`label-${labelPosition}`)]: labelPosition,
  11150. [ns.m("inline")]: inline
  11151. }
  11152. ];
  11153. });
  11154. const getField = (prop) => {
  11155. return fields.find((field) => field.prop === prop);
  11156. };
  11157. const addField = (field) => {
  11158. fields.push(field);
  11159. };
  11160. const removeField = (field) => {
  11161. if (field.prop) {
  11162. fields.splice(fields.indexOf(field), 1);
  11163. }
  11164. };
  11165. const resetFields = (properties = []) => {
  11166. if (!props.model) {
  11167. return;
  11168. }
  11169. filterFields(fields, properties).forEach((field) => field.resetField());
  11170. };
  11171. const clearValidate = (props2 = []) => {
  11172. filterFields(fields, props2).forEach((field) => field.clearValidate());
  11173. };
  11174. const isValidatable = vue.computed(() => {
  11175. const hasModel = !!props.model;
  11176. return hasModel;
  11177. });
  11178. const obtainValidateFields = (props2) => {
  11179. if (fields.length === 0)
  11180. return [];
  11181. const filteredFields = filterFields(fields, props2);
  11182. if (!filteredFields.length) {
  11183. return [];
  11184. }
  11185. return filteredFields;
  11186. };
  11187. const validate = async (callback) => validateField(void 0, callback);
  11188. const doValidateField = async (props2 = []) => {
  11189. if (!isValidatable.value)
  11190. return false;
  11191. const fields2 = obtainValidateFields(props2);
  11192. if (fields2.length === 0)
  11193. return true;
  11194. let validationErrors = {};
  11195. for (const field of fields2) {
  11196. try {
  11197. await field.validate("");
  11198. } catch (fields3) {
  11199. validationErrors = {
  11200. ...validationErrors,
  11201. ...fields3
  11202. };
  11203. }
  11204. }
  11205. if (Object.keys(validationErrors).length === 0)
  11206. return true;
  11207. return Promise.reject(validationErrors);
  11208. };
  11209. const validateField = async (modelProps = [], callback) => {
  11210. const shouldThrow = !isFunction$1(callback);
  11211. try {
  11212. const result = await doValidateField(modelProps);
  11213. if (result === true) {
  11214. await (callback == null ? void 0 : callback(result));
  11215. }
  11216. return result;
  11217. } catch (e) {
  11218. if (e instanceof Error)
  11219. throw e;
  11220. const invalidFields = e;
  11221. if (props.scrollToError) {
  11222. scrollToField(Object.keys(invalidFields)[0]);
  11223. }
  11224. await (callback == null ? void 0 : callback(false, invalidFields));
  11225. return shouldThrow && Promise.reject(invalidFields);
  11226. }
  11227. };
  11228. const scrollToField = (prop) => {
  11229. var _a;
  11230. const field = filterFields(fields, prop)[0];
  11231. if (field) {
  11232. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  11233. }
  11234. };
  11235. vue.watch(() => props.rules, () => {
  11236. if (props.validateOnRuleChange) {
  11237. validate().catch((err) => debugWarn());
  11238. }
  11239. }, { deep: true });
  11240. vue.provide(formContextKey, vue.reactive({
  11241. ...vue.toRefs(props),
  11242. emit,
  11243. resetFields,
  11244. clearValidate,
  11245. validateField,
  11246. getField,
  11247. addField,
  11248. removeField,
  11249. ...useFormLabelWidth()
  11250. }));
  11251. expose({
  11252. validate,
  11253. validateField,
  11254. resetFields,
  11255. clearValidate,
  11256. scrollToField,
  11257. fields
  11258. });
  11259. return (_ctx, _cache) => {
  11260. return vue.openBlock(), vue.createElementBlock("form", {
  11261. class: vue.normalizeClass(vue.unref(formClasses))
  11262. }, [
  11263. vue.renderSlot(_ctx.$slots, "default")
  11264. ], 2);
  11265. };
  11266. }
  11267. });
  11268. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2r, [["__file", "form.vue"]]);
  11269. function _extends() {
  11270. _extends = Object.assign ? Object.assign.bind() : function(target) {
  11271. for (var i = 1; i < arguments.length; i++) {
  11272. var source = arguments[i];
  11273. for (var key in source) {
  11274. if (Object.prototype.hasOwnProperty.call(source, key)) {
  11275. target[key] = source[key];
  11276. }
  11277. }
  11278. }
  11279. return target;
  11280. };
  11281. return _extends.apply(this, arguments);
  11282. }
  11283. function _inheritsLoose(subClass, superClass) {
  11284. subClass.prototype = Object.create(superClass.prototype);
  11285. subClass.prototype.constructor = subClass;
  11286. _setPrototypeOf(subClass, superClass);
  11287. }
  11288. function _getPrototypeOf(o) {
  11289. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  11290. return o2.__proto__ || Object.getPrototypeOf(o2);
  11291. };
  11292. return _getPrototypeOf(o);
  11293. }
  11294. function _setPrototypeOf(o, p) {
  11295. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  11296. o2.__proto__ = p2;
  11297. return o2;
  11298. };
  11299. return _setPrototypeOf(o, p);
  11300. }
  11301. function _isNativeReflectConstruct() {
  11302. if (typeof Reflect === "undefined" || !Reflect.construct)
  11303. return false;
  11304. if (Reflect.construct.sham)
  11305. return false;
  11306. if (typeof Proxy === "function")
  11307. return true;
  11308. try {
  11309. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  11310. }));
  11311. return true;
  11312. } catch (e) {
  11313. return false;
  11314. }
  11315. }
  11316. function _construct(Parent, args, Class) {
  11317. if (_isNativeReflectConstruct()) {
  11318. _construct = Reflect.construct.bind();
  11319. } else {
  11320. _construct = function _construct2(Parent2, args2, Class2) {
  11321. var a = [null];
  11322. a.push.apply(a, args2);
  11323. var Constructor = Function.bind.apply(Parent2, a);
  11324. var instance = new Constructor();
  11325. if (Class2)
  11326. _setPrototypeOf(instance, Class2.prototype);
  11327. return instance;
  11328. };
  11329. }
  11330. return _construct.apply(null, arguments);
  11331. }
  11332. function _isNativeFunction(fn) {
  11333. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11334. }
  11335. function _wrapNativeSuper(Class) {
  11336. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11337. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  11338. if (Class2 === null || !_isNativeFunction(Class2))
  11339. return Class2;
  11340. if (typeof Class2 !== "function") {
  11341. throw new TypeError("Super expression must either be null or a function");
  11342. }
  11343. if (typeof _cache !== "undefined") {
  11344. if (_cache.has(Class2))
  11345. return _cache.get(Class2);
  11346. _cache.set(Class2, Wrapper);
  11347. }
  11348. function Wrapper() {
  11349. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  11350. }
  11351. Wrapper.prototype = Object.create(Class2.prototype, {
  11352. constructor: {
  11353. value: Wrapper,
  11354. enumerable: false,
  11355. writable: true,
  11356. configurable: true
  11357. }
  11358. });
  11359. return _setPrototypeOf(Wrapper, Class2);
  11360. };
  11361. return _wrapNativeSuper(Class);
  11362. }
  11363. var formatRegExp = /%[sdj%]/g;
  11364. var warning = function warning2() {
  11365. };
  11366. if (typeof process !== "undefined" && process.env && false) {
  11367. warning = function warning3(type4, errors) {
  11368. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  11369. if (errors.every(function(e) {
  11370. return typeof e === "string";
  11371. })) {
  11372. console.warn(type4, errors);
  11373. }
  11374. }
  11375. };
  11376. }
  11377. function convertFieldsError(errors) {
  11378. if (!errors || !errors.length)
  11379. return null;
  11380. var fields = {};
  11381. errors.forEach(function(error) {
  11382. var field = error.field;
  11383. fields[field] = fields[field] || [];
  11384. fields[field].push(error);
  11385. });
  11386. return fields;
  11387. }
  11388. function format(template) {
  11389. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11390. args[_key - 1] = arguments[_key];
  11391. }
  11392. var i = 0;
  11393. var len = args.length;
  11394. if (typeof template === "function") {
  11395. return template.apply(null, args);
  11396. }
  11397. if (typeof template === "string") {
  11398. var str = template.replace(formatRegExp, function(x) {
  11399. if (x === "%%") {
  11400. return "%";
  11401. }
  11402. if (i >= len) {
  11403. return x;
  11404. }
  11405. switch (x) {
  11406. case "%s":
  11407. return String(args[i++]);
  11408. case "%d":
  11409. return Number(args[i++]);
  11410. case "%j":
  11411. try {
  11412. return JSON.stringify(args[i++]);
  11413. } catch (_) {
  11414. return "[Circular]";
  11415. }
  11416. break;
  11417. default:
  11418. return x;
  11419. }
  11420. });
  11421. return str;
  11422. }
  11423. return template;
  11424. }
  11425. function isNativeStringType(type4) {
  11426. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  11427. }
  11428. function isEmptyValue(value, type4) {
  11429. if (value === void 0 || value === null) {
  11430. return true;
  11431. }
  11432. if (type4 === "array" && Array.isArray(value) && !value.length) {
  11433. return true;
  11434. }
  11435. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  11436. return true;
  11437. }
  11438. return false;
  11439. }
  11440. function asyncParallelArray(arr, func, callback) {
  11441. var results = [];
  11442. var total = 0;
  11443. var arrLength = arr.length;
  11444. function count(errors) {
  11445. results.push.apply(results, errors || []);
  11446. total++;
  11447. if (total === arrLength) {
  11448. callback(results);
  11449. }
  11450. }
  11451. arr.forEach(function(a) {
  11452. func(a, count);
  11453. });
  11454. }
  11455. function asyncSerialArray(arr, func, callback) {
  11456. var index = 0;
  11457. var arrLength = arr.length;
  11458. function next(errors) {
  11459. if (errors && errors.length) {
  11460. callback(errors);
  11461. return;
  11462. }
  11463. var original = index;
  11464. index = index + 1;
  11465. if (original < arrLength) {
  11466. func(arr[original], next);
  11467. } else {
  11468. callback([]);
  11469. }
  11470. }
  11471. next([]);
  11472. }
  11473. function flattenObjArr(objArr) {
  11474. var ret = [];
  11475. Object.keys(objArr).forEach(function(k) {
  11476. ret.push.apply(ret, objArr[k] || []);
  11477. });
  11478. return ret;
  11479. }
  11480. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11481. _inheritsLoose(AsyncValidationError2, _Error);
  11482. function AsyncValidationError2(errors, fields) {
  11483. var _this;
  11484. _this = _Error.call(this, "Async Validation Error") || this;
  11485. _this.errors = errors;
  11486. _this.fields = fields;
  11487. return _this;
  11488. }
  11489. return AsyncValidationError2;
  11490. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11491. function asyncMap(objArr, option, func, callback, source) {
  11492. if (option.first) {
  11493. var _pending = new Promise(function(resolve, reject) {
  11494. var next = function next2(errors) {
  11495. callback(errors);
  11496. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11497. };
  11498. var flattenArr = flattenObjArr(objArr);
  11499. asyncSerialArray(flattenArr, func, next);
  11500. });
  11501. _pending["catch"](function(e) {
  11502. return e;
  11503. });
  11504. return _pending;
  11505. }
  11506. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11507. var objArrKeys = Object.keys(objArr);
  11508. var objArrLength = objArrKeys.length;
  11509. var total = 0;
  11510. var results = [];
  11511. var pending = new Promise(function(resolve, reject) {
  11512. var next = function next2(errors) {
  11513. results.push.apply(results, errors);
  11514. total++;
  11515. if (total === objArrLength) {
  11516. callback(results);
  11517. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11518. }
  11519. };
  11520. if (!objArrKeys.length) {
  11521. callback(results);
  11522. resolve(source);
  11523. }
  11524. objArrKeys.forEach(function(key) {
  11525. var arr = objArr[key];
  11526. if (firstFields.indexOf(key) !== -1) {
  11527. asyncSerialArray(arr, func, next);
  11528. } else {
  11529. asyncParallelArray(arr, func, next);
  11530. }
  11531. });
  11532. });
  11533. pending["catch"](function(e) {
  11534. return e;
  11535. });
  11536. return pending;
  11537. }
  11538. function isErrorObj(obj) {
  11539. return !!(obj && obj.message !== void 0);
  11540. }
  11541. function getValue(value, path) {
  11542. var v = value;
  11543. for (var i = 0; i < path.length; i++) {
  11544. if (v == void 0) {
  11545. return v;
  11546. }
  11547. v = v[path[i]];
  11548. }
  11549. return v;
  11550. }
  11551. function complementError(rule, source) {
  11552. return function(oe) {
  11553. var fieldValue;
  11554. if (rule.fullFields) {
  11555. fieldValue = getValue(source, rule.fullFields);
  11556. } else {
  11557. fieldValue = source[oe.field || rule.fullField];
  11558. }
  11559. if (isErrorObj(oe)) {
  11560. oe.field = oe.field || rule.fullField;
  11561. oe.fieldValue = fieldValue;
  11562. return oe;
  11563. }
  11564. return {
  11565. message: typeof oe === "function" ? oe() : oe,
  11566. fieldValue,
  11567. field: oe.field || rule.fullField
  11568. };
  11569. };
  11570. }
  11571. function deepMerge(target, source) {
  11572. if (source) {
  11573. for (var s in source) {
  11574. if (source.hasOwnProperty(s)) {
  11575. var value = source[s];
  11576. if (typeof value === "object" && typeof target[s] === "object") {
  11577. target[s] = _extends({}, target[s], value);
  11578. } else {
  11579. target[s] = value;
  11580. }
  11581. }
  11582. }
  11583. }
  11584. return target;
  11585. }
  11586. var required$1 = function required(rule, value, source, errors, options, type4) {
  11587. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  11588. errors.push(format(options.messages.required, rule.fullField));
  11589. }
  11590. };
  11591. var whitespace = function whitespace2(rule, value, source, errors, options) {
  11592. if (/^\s+$/.test(value) || value === "") {
  11593. errors.push(format(options.messages.whitespace, rule.fullField));
  11594. }
  11595. };
  11596. var urlReg;
  11597. var getUrlRegex = function() {
  11598. if (urlReg) {
  11599. return urlReg;
  11600. }
  11601. var word = "[a-fA-F\\d:]";
  11602. var b = function b2(options) {
  11603. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11604. };
  11605. 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}";
  11606. var v6seg = "[a-fA-F\\d]{1,4}";
  11607. 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();
  11608. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11609. var v4exact = new RegExp("^" + v4 + "$");
  11610. var v6exact = new RegExp("^" + v6 + "$");
  11611. var ip = function ip2(options) {
  11612. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11613. };
  11614. ip.v4 = function(options) {
  11615. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11616. };
  11617. ip.v6 = function(options) {
  11618. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11619. };
  11620. var protocol = "(?:(?:[a-z]+:)?//)";
  11621. var auth = "(?:\\S+(?::\\S*)?@)?";
  11622. var ipv4 = ip.v4().source;
  11623. var ipv6 = ip.v6().source;
  11624. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  11625. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  11626. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  11627. var port = "(?::\\d{2,5})?";
  11628. var path = '(?:[/?#][^\\s"]*)?';
  11629. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  11630. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11631. return urlReg;
  11632. };
  11633. var pattern$2 = {
  11634. 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,}))$/,
  11635. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11636. };
  11637. var types = {
  11638. integer: function integer(value) {
  11639. return types.number(value) && parseInt(value, 10) === value;
  11640. },
  11641. "float": function float(value) {
  11642. return types.number(value) && !types.integer(value);
  11643. },
  11644. array: function array(value) {
  11645. return Array.isArray(value);
  11646. },
  11647. regexp: function regexp(value) {
  11648. if (value instanceof RegExp) {
  11649. return true;
  11650. }
  11651. try {
  11652. return !!new RegExp(value);
  11653. } catch (e) {
  11654. return false;
  11655. }
  11656. },
  11657. date: function date(value) {
  11658. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11659. },
  11660. number: function number(value) {
  11661. if (isNaN(value)) {
  11662. return false;
  11663. }
  11664. return typeof value === "number";
  11665. },
  11666. object: function object(value) {
  11667. return typeof value === "object" && !types.array(value);
  11668. },
  11669. method: function method(value) {
  11670. return typeof value === "function";
  11671. },
  11672. email: function email(value) {
  11673. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11674. },
  11675. url: function url(value) {
  11676. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11677. },
  11678. hex: function hex(value) {
  11679. return typeof value === "string" && !!value.match(pattern$2.hex);
  11680. }
  11681. };
  11682. var type$1 = function type(rule, value, source, errors, options) {
  11683. if (rule.required && value === void 0) {
  11684. required$1(rule, value, source, errors, options);
  11685. return;
  11686. }
  11687. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  11688. var ruleType = rule.type;
  11689. if (custom.indexOf(ruleType) > -1) {
  11690. if (!types[ruleType](value)) {
  11691. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11692. }
  11693. } else if (ruleType && typeof value !== rule.type) {
  11694. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11695. }
  11696. };
  11697. var range = function range2(rule, value, source, errors, options) {
  11698. var len = typeof rule.len === "number";
  11699. var min = typeof rule.min === "number";
  11700. var max = typeof rule.max === "number";
  11701. var val = value;
  11702. var key = null;
  11703. var num = typeof value === "number";
  11704. var str = typeof value === "string";
  11705. var arr = Array.isArray(value);
  11706. if (num) {
  11707. key = "number";
  11708. } else if (str) {
  11709. key = "string";
  11710. } else if (arr) {
  11711. key = "array";
  11712. }
  11713. if (!key) {
  11714. return false;
  11715. }
  11716. if (arr) {
  11717. val = value.length;
  11718. }
  11719. if (str) {
  11720. val = value.length;
  11721. }
  11722. if (len) {
  11723. if (val !== rule.len) {
  11724. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  11725. }
  11726. } else if (min && !max && val < rule.min) {
  11727. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  11728. } else if (max && !min && val > rule.max) {
  11729. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  11730. } else if (min && max && (val < rule.min || val > rule.max)) {
  11731. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  11732. }
  11733. };
  11734. var ENUM$1 = "enum";
  11735. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  11736. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  11737. if (rule[ENUM$1].indexOf(value) === -1) {
  11738. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  11739. }
  11740. };
  11741. var pattern$1 = function pattern(rule, value, source, errors, options) {
  11742. if (rule.pattern) {
  11743. if (rule.pattern instanceof RegExp) {
  11744. rule.pattern.lastIndex = 0;
  11745. if (!rule.pattern.test(value)) {
  11746. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11747. }
  11748. } else if (typeof rule.pattern === "string") {
  11749. var _pattern = new RegExp(rule.pattern);
  11750. if (!_pattern.test(value)) {
  11751. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11752. }
  11753. }
  11754. }
  11755. };
  11756. var rules = {
  11757. required: required$1,
  11758. whitespace,
  11759. type: type$1,
  11760. range,
  11761. "enum": enumerable$1,
  11762. pattern: pattern$1
  11763. };
  11764. var string = function string2(rule, value, callback, source, options) {
  11765. var errors = [];
  11766. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11767. if (validate) {
  11768. if (isEmptyValue(value, "string") && !rule.required) {
  11769. return callback();
  11770. }
  11771. rules.required(rule, value, source, errors, options, "string");
  11772. if (!isEmptyValue(value, "string")) {
  11773. rules.type(rule, value, source, errors, options);
  11774. rules.range(rule, value, source, errors, options);
  11775. rules.pattern(rule, value, source, errors, options);
  11776. if (rule.whitespace === true) {
  11777. rules.whitespace(rule, value, source, errors, options);
  11778. }
  11779. }
  11780. }
  11781. callback(errors);
  11782. };
  11783. var method2 = function method3(rule, value, callback, source, options) {
  11784. var errors = [];
  11785. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11786. if (validate) {
  11787. if (isEmptyValue(value) && !rule.required) {
  11788. return callback();
  11789. }
  11790. rules.required(rule, value, source, errors, options);
  11791. if (value !== void 0) {
  11792. rules.type(rule, value, source, errors, options);
  11793. }
  11794. }
  11795. callback(errors);
  11796. };
  11797. var number2 = function number3(rule, value, callback, source, options) {
  11798. var errors = [];
  11799. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11800. if (validate) {
  11801. if (value === "") {
  11802. value = void 0;
  11803. }
  11804. if (isEmptyValue(value) && !rule.required) {
  11805. return callback();
  11806. }
  11807. rules.required(rule, value, source, errors, options);
  11808. if (value !== void 0) {
  11809. rules.type(rule, value, source, errors, options);
  11810. rules.range(rule, value, source, errors, options);
  11811. }
  11812. }
  11813. callback(errors);
  11814. };
  11815. var _boolean = function _boolean2(rule, value, callback, source, options) {
  11816. var errors = [];
  11817. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11818. if (validate) {
  11819. if (isEmptyValue(value) && !rule.required) {
  11820. return callback();
  11821. }
  11822. rules.required(rule, value, source, errors, options);
  11823. if (value !== void 0) {
  11824. rules.type(rule, value, source, errors, options);
  11825. }
  11826. }
  11827. callback(errors);
  11828. };
  11829. var regexp2 = function regexp3(rule, value, callback, source, options) {
  11830. var errors = [];
  11831. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11832. if (validate) {
  11833. if (isEmptyValue(value) && !rule.required) {
  11834. return callback();
  11835. }
  11836. rules.required(rule, value, source, errors, options);
  11837. if (!isEmptyValue(value)) {
  11838. rules.type(rule, value, source, errors, options);
  11839. }
  11840. }
  11841. callback(errors);
  11842. };
  11843. var integer2 = function integer3(rule, value, callback, source, options) {
  11844. var errors = [];
  11845. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11846. if (validate) {
  11847. if (isEmptyValue(value) && !rule.required) {
  11848. return callback();
  11849. }
  11850. rules.required(rule, value, source, errors, options);
  11851. if (value !== void 0) {
  11852. rules.type(rule, value, source, errors, options);
  11853. rules.range(rule, value, source, errors, options);
  11854. }
  11855. }
  11856. callback(errors);
  11857. };
  11858. var floatFn = function floatFn2(rule, value, callback, source, options) {
  11859. var errors = [];
  11860. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11861. if (validate) {
  11862. if (isEmptyValue(value) && !rule.required) {
  11863. return callback();
  11864. }
  11865. rules.required(rule, value, source, errors, options);
  11866. if (value !== void 0) {
  11867. rules.type(rule, value, source, errors, options);
  11868. rules.range(rule, value, source, errors, options);
  11869. }
  11870. }
  11871. callback(errors);
  11872. };
  11873. var array2 = function array3(rule, value, callback, source, options) {
  11874. var errors = [];
  11875. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11876. if (validate) {
  11877. if ((value === void 0 || value === null) && !rule.required) {
  11878. return callback();
  11879. }
  11880. rules.required(rule, value, source, errors, options, "array");
  11881. if (value !== void 0 && value !== null) {
  11882. rules.type(rule, value, source, errors, options);
  11883. rules.range(rule, value, source, errors, options);
  11884. }
  11885. }
  11886. callback(errors);
  11887. };
  11888. var object2 = function object3(rule, value, callback, source, options) {
  11889. var errors = [];
  11890. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11891. if (validate) {
  11892. if (isEmptyValue(value) && !rule.required) {
  11893. return callback();
  11894. }
  11895. rules.required(rule, value, source, errors, options);
  11896. if (value !== void 0) {
  11897. rules.type(rule, value, source, errors, options);
  11898. }
  11899. }
  11900. callback(errors);
  11901. };
  11902. var ENUM = "enum";
  11903. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  11904. var errors = [];
  11905. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11906. if (validate) {
  11907. if (isEmptyValue(value) && !rule.required) {
  11908. return callback();
  11909. }
  11910. rules.required(rule, value, source, errors, options);
  11911. if (value !== void 0) {
  11912. rules[ENUM](rule, value, source, errors, options);
  11913. }
  11914. }
  11915. callback(errors);
  11916. };
  11917. var pattern2 = function pattern3(rule, value, callback, source, options) {
  11918. var errors = [];
  11919. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11920. if (validate) {
  11921. if (isEmptyValue(value, "string") && !rule.required) {
  11922. return callback();
  11923. }
  11924. rules.required(rule, value, source, errors, options);
  11925. if (!isEmptyValue(value, "string")) {
  11926. rules.pattern(rule, value, source, errors, options);
  11927. }
  11928. }
  11929. callback(errors);
  11930. };
  11931. var date2 = function date3(rule, value, callback, source, options) {
  11932. var errors = [];
  11933. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11934. if (validate) {
  11935. if (isEmptyValue(value, "date") && !rule.required) {
  11936. return callback();
  11937. }
  11938. rules.required(rule, value, source, errors, options);
  11939. if (!isEmptyValue(value, "date")) {
  11940. var dateObject;
  11941. if (value instanceof Date) {
  11942. dateObject = value;
  11943. } else {
  11944. dateObject = new Date(value);
  11945. }
  11946. rules.type(rule, dateObject, source, errors, options);
  11947. if (dateObject) {
  11948. rules.range(rule, dateObject.getTime(), source, errors, options);
  11949. }
  11950. }
  11951. }
  11952. callback(errors);
  11953. };
  11954. var required2 = function required3(rule, value, callback, source, options) {
  11955. var errors = [];
  11956. var type4 = Array.isArray(value) ? "array" : typeof value;
  11957. rules.required(rule, value, source, errors, options, type4);
  11958. callback(errors);
  11959. };
  11960. var type2 = function type3(rule, value, callback, source, options) {
  11961. var ruleType = rule.type;
  11962. var errors = [];
  11963. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11964. if (validate) {
  11965. if (isEmptyValue(value, ruleType) && !rule.required) {
  11966. return callback();
  11967. }
  11968. rules.required(rule, value, source, errors, options, ruleType);
  11969. if (!isEmptyValue(value, ruleType)) {
  11970. rules.type(rule, value, source, errors, options);
  11971. }
  11972. }
  11973. callback(errors);
  11974. };
  11975. var any = function any2(rule, value, callback, source, options) {
  11976. var errors = [];
  11977. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11978. if (validate) {
  11979. if (isEmptyValue(value) && !rule.required) {
  11980. return callback();
  11981. }
  11982. rules.required(rule, value, source, errors, options);
  11983. }
  11984. callback(errors);
  11985. };
  11986. var validators = {
  11987. string,
  11988. method: method2,
  11989. number: number2,
  11990. "boolean": _boolean,
  11991. regexp: regexp2,
  11992. integer: integer2,
  11993. "float": floatFn,
  11994. array: array2,
  11995. object: object2,
  11996. "enum": enumerable2,
  11997. pattern: pattern2,
  11998. date: date2,
  11999. url: type2,
  12000. hex: type2,
  12001. email: type2,
  12002. required: required2,
  12003. any
  12004. };
  12005. function newMessages() {
  12006. return {
  12007. "default": "Validation error on field %s",
  12008. required: "%s is required",
  12009. "enum": "%s must be one of %s",
  12010. whitespace: "%s cannot be empty",
  12011. date: {
  12012. format: "%s date %s is invalid for format %s",
  12013. parse: "%s date could not be parsed, %s is invalid ",
  12014. invalid: "%s date %s is invalid"
  12015. },
  12016. types: {
  12017. string: "%s is not a %s",
  12018. method: "%s is not a %s (function)",
  12019. array: "%s is not an %s",
  12020. object: "%s is not an %s",
  12021. number: "%s is not a %s",
  12022. date: "%s is not a %s",
  12023. "boolean": "%s is not a %s",
  12024. integer: "%s is not an %s",
  12025. "float": "%s is not a %s",
  12026. regexp: "%s is not a valid %s",
  12027. email: "%s is not a valid %s",
  12028. url: "%s is not a valid %s",
  12029. hex: "%s is not a valid %s"
  12030. },
  12031. string: {
  12032. len: "%s must be exactly %s characters",
  12033. min: "%s must be at least %s characters",
  12034. max: "%s cannot be longer than %s characters",
  12035. range: "%s must be between %s and %s characters"
  12036. },
  12037. number: {
  12038. len: "%s must equal %s",
  12039. min: "%s cannot be less than %s",
  12040. max: "%s cannot be greater than %s",
  12041. range: "%s must be between %s and %s"
  12042. },
  12043. array: {
  12044. len: "%s must be exactly %s in length",
  12045. min: "%s cannot be less than %s in length",
  12046. max: "%s cannot be greater than %s in length",
  12047. range: "%s must be between %s and %s in length"
  12048. },
  12049. pattern: {
  12050. mismatch: "%s value %s does not match pattern %s"
  12051. },
  12052. clone: function clone() {
  12053. var cloned = JSON.parse(JSON.stringify(this));
  12054. cloned.clone = this.clone;
  12055. return cloned;
  12056. }
  12057. };
  12058. }
  12059. var messages = newMessages();
  12060. var Schema = /* @__PURE__ */ function() {
  12061. function Schema2(descriptor) {
  12062. this.rules = null;
  12063. this._messages = messages;
  12064. this.define(descriptor);
  12065. }
  12066. var _proto = Schema2.prototype;
  12067. _proto.define = function define(rules2) {
  12068. var _this = this;
  12069. if (!rules2) {
  12070. throw new Error("Cannot configure a schema with no rules");
  12071. }
  12072. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  12073. throw new Error("Rules must be an object");
  12074. }
  12075. this.rules = {};
  12076. Object.keys(rules2).forEach(function(name) {
  12077. var item = rules2[name];
  12078. _this.rules[name] = Array.isArray(item) ? item : [item];
  12079. });
  12080. };
  12081. _proto.messages = function messages2(_messages) {
  12082. if (_messages) {
  12083. this._messages = deepMerge(newMessages(), _messages);
  12084. }
  12085. return this._messages;
  12086. };
  12087. _proto.validate = function validate(source_, o, oc) {
  12088. var _this2 = this;
  12089. if (o === void 0) {
  12090. o = {};
  12091. }
  12092. if (oc === void 0) {
  12093. oc = function oc2() {
  12094. };
  12095. }
  12096. var source = source_;
  12097. var options = o;
  12098. var callback = oc;
  12099. if (typeof options === "function") {
  12100. callback = options;
  12101. options = {};
  12102. }
  12103. if (!this.rules || Object.keys(this.rules).length === 0) {
  12104. if (callback) {
  12105. callback(null, source);
  12106. }
  12107. return Promise.resolve(source);
  12108. }
  12109. function complete(results) {
  12110. var errors = [];
  12111. var fields = {};
  12112. function add(e) {
  12113. if (Array.isArray(e)) {
  12114. var _errors;
  12115. errors = (_errors = errors).concat.apply(_errors, e);
  12116. } else {
  12117. errors.push(e);
  12118. }
  12119. }
  12120. for (var i = 0; i < results.length; i++) {
  12121. add(results[i]);
  12122. }
  12123. if (!errors.length) {
  12124. callback(null, source);
  12125. } else {
  12126. fields = convertFieldsError(errors);
  12127. callback(errors, fields);
  12128. }
  12129. }
  12130. if (options.messages) {
  12131. var messages$1 = this.messages();
  12132. if (messages$1 === messages) {
  12133. messages$1 = newMessages();
  12134. }
  12135. deepMerge(messages$1, options.messages);
  12136. options.messages = messages$1;
  12137. } else {
  12138. options.messages = this.messages();
  12139. }
  12140. var series = {};
  12141. var keys = options.keys || Object.keys(this.rules);
  12142. keys.forEach(function(z) {
  12143. var arr = _this2.rules[z];
  12144. var value = source[z];
  12145. arr.forEach(function(r) {
  12146. var rule = r;
  12147. if (typeof rule.transform === "function") {
  12148. if (source === source_) {
  12149. source = _extends({}, source);
  12150. }
  12151. value = source[z] = rule.transform(value);
  12152. }
  12153. if (typeof rule === "function") {
  12154. rule = {
  12155. validator: rule
  12156. };
  12157. } else {
  12158. rule = _extends({}, rule);
  12159. }
  12160. rule.validator = _this2.getValidationMethod(rule);
  12161. if (!rule.validator) {
  12162. return;
  12163. }
  12164. rule.field = z;
  12165. rule.fullField = rule.fullField || z;
  12166. rule.type = _this2.getType(rule);
  12167. series[z] = series[z] || [];
  12168. series[z].push({
  12169. rule,
  12170. value,
  12171. source,
  12172. field: z
  12173. });
  12174. });
  12175. });
  12176. var errorFields = {};
  12177. return asyncMap(series, options, function(data, doIt) {
  12178. var rule = data.rule;
  12179. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  12180. deep = deep && (rule.required || !rule.required && data.value);
  12181. rule.field = data.field;
  12182. function addFullField(key, schema) {
  12183. return _extends({}, schema, {
  12184. fullField: rule.fullField + "." + key,
  12185. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  12186. });
  12187. }
  12188. function cb(e) {
  12189. if (e === void 0) {
  12190. e = [];
  12191. }
  12192. var errorList = Array.isArray(e) ? e : [e];
  12193. if (!options.suppressWarning && errorList.length) {
  12194. Schema2.warning("async-validator:", errorList);
  12195. }
  12196. if (errorList.length && rule.message !== void 0) {
  12197. errorList = [].concat(rule.message);
  12198. }
  12199. var filledErrors = errorList.map(complementError(rule, source));
  12200. if (options.first && filledErrors.length) {
  12201. errorFields[rule.field] = 1;
  12202. return doIt(filledErrors);
  12203. }
  12204. if (!deep) {
  12205. doIt(filledErrors);
  12206. } else {
  12207. if (rule.required && !data.value) {
  12208. if (rule.message !== void 0) {
  12209. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  12210. } else if (options.error) {
  12211. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  12212. }
  12213. return doIt(filledErrors);
  12214. }
  12215. var fieldsSchema = {};
  12216. if (rule.defaultField) {
  12217. Object.keys(data.value).map(function(key) {
  12218. fieldsSchema[key] = rule.defaultField;
  12219. });
  12220. }
  12221. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  12222. var paredFieldsSchema = {};
  12223. Object.keys(fieldsSchema).forEach(function(field) {
  12224. var fieldSchema = fieldsSchema[field];
  12225. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  12226. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  12227. });
  12228. var schema = new Schema2(paredFieldsSchema);
  12229. schema.messages(options.messages);
  12230. if (data.rule.options) {
  12231. data.rule.options.messages = options.messages;
  12232. data.rule.options.error = options.error;
  12233. }
  12234. schema.validate(data.value, data.rule.options || options, function(errs) {
  12235. var finalErrors = [];
  12236. if (filledErrors && filledErrors.length) {
  12237. finalErrors.push.apply(finalErrors, filledErrors);
  12238. }
  12239. if (errs && errs.length) {
  12240. finalErrors.push.apply(finalErrors, errs);
  12241. }
  12242. doIt(finalErrors.length ? finalErrors : null);
  12243. });
  12244. }
  12245. }
  12246. var res;
  12247. if (rule.asyncValidator) {
  12248. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  12249. } else if (rule.validator) {
  12250. try {
  12251. res = rule.validator(rule, data.value, cb, data.source, options);
  12252. } catch (error) {
  12253. console.error == null ? void 0 : console.error(error);
  12254. if (!options.suppressValidatorError) {
  12255. setTimeout(function() {
  12256. throw error;
  12257. }, 0);
  12258. }
  12259. cb(error.message);
  12260. }
  12261. if (res === true) {
  12262. cb();
  12263. } else if (res === false) {
  12264. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  12265. } else if (res instanceof Array) {
  12266. cb(res);
  12267. } else if (res instanceof Error) {
  12268. cb(res.message);
  12269. }
  12270. }
  12271. if (res && res.then) {
  12272. res.then(function() {
  12273. return cb();
  12274. }, function(e) {
  12275. return cb(e);
  12276. });
  12277. }
  12278. }, function(results) {
  12279. complete(results);
  12280. }, source);
  12281. };
  12282. _proto.getType = function getType(rule) {
  12283. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  12284. rule.type = "pattern";
  12285. }
  12286. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  12287. throw new Error(format("Unknown rule type %s", rule.type));
  12288. }
  12289. return rule.type || "string";
  12290. };
  12291. _proto.getValidationMethod = function getValidationMethod(rule) {
  12292. if (typeof rule.validator === "function") {
  12293. return rule.validator;
  12294. }
  12295. var keys = Object.keys(rule);
  12296. var messageIndex = keys.indexOf("message");
  12297. if (messageIndex !== -1) {
  12298. keys.splice(messageIndex, 1);
  12299. }
  12300. if (keys.length === 1 && keys[0] === "required") {
  12301. return validators.required;
  12302. }
  12303. return validators[this.getType(rule)] || void 0;
  12304. };
  12305. return Schema2;
  12306. }();
  12307. Schema.register = function register(type4, validator) {
  12308. if (typeof validator !== "function") {
  12309. throw new Error("Cannot register a validator by type, validator is not a function");
  12310. }
  12311. validators[type4] = validator;
  12312. };
  12313. Schema.warning = warning;
  12314. Schema.messages = messages;
  12315. Schema.validators = validators;
  12316. const formItemValidateStates = [
  12317. "",
  12318. "error",
  12319. "validating",
  12320. "success"
  12321. ];
  12322. const formItemProps = buildProps({
  12323. label: String,
  12324. labelWidth: {
  12325. type: [String, Number],
  12326. default: ""
  12327. },
  12328. labelPosition: {
  12329. type: String,
  12330. values: ["left", "right", "top", ""],
  12331. default: ""
  12332. },
  12333. prop: {
  12334. type: definePropType([String, Array])
  12335. },
  12336. required: {
  12337. type: Boolean,
  12338. default: void 0
  12339. },
  12340. rules: {
  12341. type: definePropType([Object, Array])
  12342. },
  12343. error: String,
  12344. validateStatus: {
  12345. type: String,
  12346. values: formItemValidateStates
  12347. },
  12348. for: String,
  12349. inlineMessage: {
  12350. type: [String, Boolean],
  12351. default: ""
  12352. },
  12353. showMessage: {
  12354. type: Boolean,
  12355. default: true
  12356. },
  12357. size: {
  12358. type: String,
  12359. values: componentSizes
  12360. }
  12361. });
  12362. const COMPONENT_NAME$l = "ElLabelWrap";
  12363. var FormLabelWrap = vue.defineComponent({
  12364. name: COMPONENT_NAME$l,
  12365. props: {
  12366. isAutoWidth: Boolean,
  12367. updateAll: Boolean
  12368. },
  12369. setup(props, {
  12370. slots
  12371. }) {
  12372. const formContext = vue.inject(formContextKey, void 0);
  12373. const formItemContext = vue.inject(formItemContextKey);
  12374. if (!formItemContext)
  12375. throwError(COMPONENT_NAME$l, "usage: <el-form-item><label-wrap /></el-form-item>");
  12376. const ns = useNamespace("form");
  12377. const el = vue.ref();
  12378. const computedWidth = vue.ref(0);
  12379. const getLabelWidth = () => {
  12380. var _a;
  12381. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  12382. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12383. return Math.ceil(Number.parseFloat(width));
  12384. } else {
  12385. return 0;
  12386. }
  12387. };
  12388. const updateLabelWidth = (action = "update") => {
  12389. vue.nextTick(() => {
  12390. if (slots.default && props.isAutoWidth) {
  12391. if (action === "update") {
  12392. computedWidth.value = getLabelWidth();
  12393. } else if (action === "remove") {
  12394. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  12395. }
  12396. }
  12397. });
  12398. };
  12399. const updateLabelWidthFn = () => updateLabelWidth("update");
  12400. vue.onMounted(() => {
  12401. updateLabelWidthFn();
  12402. });
  12403. vue.onBeforeUnmount(() => {
  12404. updateLabelWidth("remove");
  12405. });
  12406. vue.onUpdated(() => updateLabelWidthFn());
  12407. vue.watch(computedWidth, (val, oldVal) => {
  12408. if (props.updateAll) {
  12409. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  12410. }
  12411. });
  12412. useResizeObserver(vue.computed(() => {
  12413. var _a, _b;
  12414. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  12415. }), updateLabelWidthFn);
  12416. return () => {
  12417. var _a, _b;
  12418. if (!slots)
  12419. return null;
  12420. const {
  12421. isAutoWidth
  12422. } = props;
  12423. if (isAutoWidth) {
  12424. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  12425. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  12426. const style = {};
  12427. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12428. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12429. const labelPosition = formItemContext.labelPosition || formContext.labelPosition;
  12430. const marginPosition = labelPosition === "left" ? "marginRight" : "marginLeft";
  12431. if (marginWidth) {
  12432. style[marginPosition] = `${marginWidth}px`;
  12433. }
  12434. }
  12435. return vue.createVNode("div", {
  12436. "ref": el,
  12437. "class": [ns.be("item", "label-wrap")],
  12438. "style": style
  12439. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  12440. } else {
  12441. return vue.createVNode(vue.Fragment, {
  12442. "ref": el
  12443. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  12444. }
  12445. };
  12446. }
  12447. });
  12448. const __default__$1K = vue.defineComponent({
  12449. name: "ElFormItem"
  12450. });
  12451. const _sfc_main$2q = /* @__PURE__ */ vue.defineComponent({
  12452. ...__default__$1K,
  12453. props: formItemProps,
  12454. setup(__props, { expose }) {
  12455. const props = __props;
  12456. const slots = vue.useSlots();
  12457. const formContext = vue.inject(formContextKey, void 0);
  12458. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  12459. const _size = useFormSize(void 0, { formItem: false });
  12460. const ns = useNamespace("form-item");
  12461. const labelId = useId().value;
  12462. const inputIds = vue.ref([]);
  12463. const validateState = vue.ref("");
  12464. const validateStateDebounced = refDebounced(validateState, 100);
  12465. const validateMessage = vue.ref("");
  12466. const formItemRef = vue.ref();
  12467. let initialValue = void 0;
  12468. let isResettingField = false;
  12469. const labelPosition = vue.computed(() => props.labelPosition || (formContext == null ? void 0 : formContext.labelPosition));
  12470. const labelStyle = vue.computed(() => {
  12471. if (labelPosition.value === "top") {
  12472. return {};
  12473. }
  12474. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12475. if (labelWidth)
  12476. return { width: labelWidth };
  12477. return {};
  12478. });
  12479. const contentStyle = vue.computed(() => {
  12480. if (labelPosition.value === "top" || (formContext == null ? void 0 : formContext.inline)) {
  12481. return {};
  12482. }
  12483. if (!props.label && !props.labelWidth && isNested) {
  12484. return {};
  12485. }
  12486. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12487. if (!props.label && !slots.label) {
  12488. return { marginLeft: labelWidth };
  12489. }
  12490. return {};
  12491. });
  12492. const formItemClasses = vue.computed(() => [
  12493. ns.b(),
  12494. ns.m(_size.value),
  12495. ns.is("error", validateState.value === "error"),
  12496. ns.is("validating", validateState.value === "validating"),
  12497. ns.is("success", validateState.value === "success"),
  12498. ns.is("required", isRequired.value || props.required),
  12499. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  12500. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  12501. {
  12502. [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon,
  12503. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  12504. }
  12505. ]);
  12506. const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  12507. const validateClasses = vue.computed(() => [
  12508. ns.e("error"),
  12509. { [ns.em("error", "inline")]: _inlineMessage.value }
  12510. ]);
  12511. const propString = vue.computed(() => {
  12512. if (!props.prop)
  12513. return "";
  12514. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  12515. });
  12516. const hasLabel = vue.computed(() => {
  12517. return !!(props.label || slots.label);
  12518. });
  12519. const labelFor = vue.computed(() => {
  12520. return props.for || (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  12521. });
  12522. const isGroup = vue.computed(() => {
  12523. return !labelFor.value && hasLabel.value;
  12524. });
  12525. const isNested = !!parentFormItemContext;
  12526. const fieldValue = vue.computed(() => {
  12527. const model = formContext == null ? void 0 : formContext.model;
  12528. if (!model || !props.prop) {
  12529. return;
  12530. }
  12531. return getProp(model, props.prop).value;
  12532. });
  12533. const normalizedRules = vue.computed(() => {
  12534. const { required } = props;
  12535. const rules = [];
  12536. if (props.rules) {
  12537. rules.push(...castArray$1(props.rules));
  12538. }
  12539. const formRules = formContext == null ? void 0 : formContext.rules;
  12540. if (formRules && props.prop) {
  12541. const _rules = getProp(formRules, props.prop).value;
  12542. if (_rules) {
  12543. rules.push(...castArray$1(_rules));
  12544. }
  12545. }
  12546. if (required !== void 0) {
  12547. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  12548. if (requiredRules.length > 0) {
  12549. for (const [rule, i] of requiredRules) {
  12550. if (rule.required === required)
  12551. continue;
  12552. rules[i] = { ...rule, required };
  12553. }
  12554. } else {
  12555. rules.push({ required });
  12556. }
  12557. }
  12558. return rules;
  12559. });
  12560. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  12561. const getFilteredRule = (trigger) => {
  12562. const rules = normalizedRules.value;
  12563. return rules.filter((rule) => {
  12564. if (!rule.trigger || !trigger)
  12565. return true;
  12566. if (Array.isArray(rule.trigger)) {
  12567. return rule.trigger.includes(trigger);
  12568. } else {
  12569. return rule.trigger === trigger;
  12570. }
  12571. }).map(({ trigger: trigger2, ...rule }) => rule);
  12572. };
  12573. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  12574. const shouldShowError = vue.computed(() => {
  12575. var _a;
  12576. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  12577. });
  12578. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  12579. const setValidationState = (state) => {
  12580. validateState.value = state;
  12581. };
  12582. const onValidationFailed = (error) => {
  12583. var _a, _b;
  12584. const { errors, fields } = error;
  12585. if (!errors || !fields) {
  12586. console.error(error);
  12587. }
  12588. setValidationState("error");
  12589. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  12590. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  12591. };
  12592. const onValidationSucceeded = () => {
  12593. setValidationState("success");
  12594. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  12595. };
  12596. const doValidate = async (rules) => {
  12597. const modelName = propString.value;
  12598. const validator = new Schema({
  12599. [modelName]: rules
  12600. });
  12601. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12602. onValidationSucceeded();
  12603. return true;
  12604. }).catch((err) => {
  12605. onValidationFailed(err);
  12606. return Promise.reject(err);
  12607. });
  12608. };
  12609. const validate = async (trigger, callback) => {
  12610. if (isResettingField || !props.prop) {
  12611. return false;
  12612. }
  12613. const hasCallback = isFunction$1(callback);
  12614. if (!validateEnabled.value) {
  12615. callback == null ? void 0 : callback(false);
  12616. return false;
  12617. }
  12618. const rules = getFilteredRule(trigger);
  12619. if (rules.length === 0) {
  12620. callback == null ? void 0 : callback(true);
  12621. return true;
  12622. }
  12623. setValidationState("validating");
  12624. return doValidate(rules).then(() => {
  12625. callback == null ? void 0 : callback(true);
  12626. return true;
  12627. }).catch((err) => {
  12628. const { fields } = err;
  12629. callback == null ? void 0 : callback(false, fields);
  12630. return hasCallback ? false : Promise.reject(fields);
  12631. });
  12632. };
  12633. const clearValidate = () => {
  12634. setValidationState("");
  12635. validateMessage.value = "";
  12636. isResettingField = false;
  12637. };
  12638. const resetField = async () => {
  12639. const model = formContext == null ? void 0 : formContext.model;
  12640. if (!model || !props.prop)
  12641. return;
  12642. const computedValue = getProp(model, props.prop);
  12643. isResettingField = true;
  12644. computedValue.value = clone(initialValue);
  12645. await vue.nextTick();
  12646. clearValidate();
  12647. isResettingField = false;
  12648. };
  12649. const addInputId = (id) => {
  12650. if (!inputIds.value.includes(id)) {
  12651. inputIds.value.push(id);
  12652. }
  12653. };
  12654. const removeInputId = (id) => {
  12655. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12656. };
  12657. vue.watch(() => props.error, (val) => {
  12658. validateMessage.value = val || "";
  12659. setValidationState(val ? "error" : "");
  12660. }, { immediate: true });
  12661. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12662. const context = vue.reactive({
  12663. ...vue.toRefs(props),
  12664. $el: formItemRef,
  12665. size: _size,
  12666. validateState,
  12667. labelId,
  12668. inputIds,
  12669. isGroup,
  12670. hasLabel,
  12671. fieldValue,
  12672. addInputId,
  12673. removeInputId,
  12674. resetField,
  12675. clearValidate,
  12676. validate
  12677. });
  12678. vue.provide(formItemContextKey, context);
  12679. vue.onMounted(() => {
  12680. if (props.prop) {
  12681. formContext == null ? void 0 : formContext.addField(context);
  12682. initialValue = clone(fieldValue.value);
  12683. }
  12684. });
  12685. vue.onBeforeUnmount(() => {
  12686. formContext == null ? void 0 : formContext.removeField(context);
  12687. });
  12688. expose({
  12689. size: _size,
  12690. validateMessage,
  12691. validateState,
  12692. validate,
  12693. clearValidate,
  12694. resetField
  12695. });
  12696. return (_ctx, _cache) => {
  12697. var _a;
  12698. return vue.openBlock(), vue.createElementBlock("div", {
  12699. ref_key: "formItemRef",
  12700. ref: formItemRef,
  12701. class: vue.normalizeClass(vue.unref(formItemClasses)),
  12702. role: vue.unref(isGroup) ? "group" : void 0,
  12703. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  12704. }, [
  12705. vue.createVNode(vue.unref(FormLabelWrap), {
  12706. "is-auto-width": vue.unref(labelStyle).width === "auto",
  12707. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  12708. }, {
  12709. default: vue.withCtx(() => [
  12710. vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  12711. key: 0,
  12712. id: vue.unref(labelId),
  12713. for: vue.unref(labelFor),
  12714. class: vue.normalizeClass(vue.unref(ns).e("label")),
  12715. style: vue.normalizeStyle(vue.unref(labelStyle))
  12716. }, {
  12717. default: vue.withCtx(() => [
  12718. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  12719. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  12720. ])
  12721. ]),
  12722. _: 3
  12723. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  12724. ]),
  12725. _: 3
  12726. }, 8, ["is-auto-width", "update-all"]),
  12727. vue.createElementVNode("div", {
  12728. class: vue.normalizeClass(vue.unref(ns).e("content")),
  12729. style: vue.normalizeStyle(vue.unref(contentStyle))
  12730. }, [
  12731. vue.renderSlot(_ctx.$slots, "default"),
  12732. vue.createVNode(vue.TransitionGroup, {
  12733. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  12734. }, {
  12735. default: vue.withCtx(() => [
  12736. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  12737. key: 0,
  12738. error: validateMessage.value
  12739. }, () => [
  12740. vue.createElementVNode("div", {
  12741. class: vue.normalizeClass(vue.unref(validateClasses))
  12742. }, vue.toDisplayString(validateMessage.value), 3)
  12743. ]) : vue.createCommentVNode("v-if", true)
  12744. ]),
  12745. _: 3
  12746. }, 8, ["name"])
  12747. ], 6)
  12748. ], 10, ["role", "aria-labelledby"]);
  12749. };
  12750. }
  12751. });
  12752. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "form-item.vue"]]);
  12753. const ElForm = withInstall(Form, {
  12754. FormItem
  12755. });
  12756. const ElFormItem = withNoopInstall(FormItem);
  12757. let hiddenTextarea = void 0;
  12758. const HIDDEN_STYLE = `
  12759. height:0 !important;
  12760. visibility:hidden !important;
  12761. ${isFirefox() ? "" : "overflow:hidden !important;"}
  12762. position:absolute !important;
  12763. z-index:-1000 !important;
  12764. top:0 !important;
  12765. right:0 !important;
  12766. `;
  12767. const CONTEXT_STYLE = [
  12768. "letter-spacing",
  12769. "line-height",
  12770. "padding-top",
  12771. "padding-bottom",
  12772. "font-family",
  12773. "font-weight",
  12774. "font-size",
  12775. "text-rendering",
  12776. "text-transform",
  12777. "width",
  12778. "text-indent",
  12779. "padding-left",
  12780. "padding-right",
  12781. "border-width",
  12782. "box-sizing"
  12783. ];
  12784. function calculateNodeStyling(targetElement) {
  12785. const style = window.getComputedStyle(targetElement);
  12786. const boxSizing = style.getPropertyValue("box-sizing");
  12787. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  12788. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  12789. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  12790. return { contextStyle, paddingSize, borderSize, boxSizing };
  12791. }
  12792. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  12793. var _a;
  12794. if (!hiddenTextarea) {
  12795. hiddenTextarea = document.createElement("textarea");
  12796. document.body.appendChild(hiddenTextarea);
  12797. }
  12798. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  12799. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  12800. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  12801. let height = hiddenTextarea.scrollHeight;
  12802. const result = {};
  12803. if (boxSizing === "border-box") {
  12804. height = height + borderSize;
  12805. } else if (boxSizing === "content-box") {
  12806. height = height - paddingSize;
  12807. }
  12808. hiddenTextarea.value = "";
  12809. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  12810. if (isNumber(minRows)) {
  12811. let minHeight = singleRowHeight * minRows;
  12812. if (boxSizing === "border-box") {
  12813. minHeight = minHeight + paddingSize + borderSize;
  12814. }
  12815. height = Math.max(minHeight, height);
  12816. result.minHeight = `${minHeight}px`;
  12817. }
  12818. if (isNumber(maxRows)) {
  12819. let maxHeight = singleRowHeight * maxRows;
  12820. if (boxSizing === "border-box") {
  12821. maxHeight = maxHeight + paddingSize + borderSize;
  12822. }
  12823. height = Math.min(maxHeight, height);
  12824. }
  12825. result.height = `${height}px`;
  12826. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  12827. hiddenTextarea = void 0;
  12828. return result;
  12829. }
  12830. const inputProps = buildProps({
  12831. id: {
  12832. type: String,
  12833. default: void 0
  12834. },
  12835. size: useSizeProp,
  12836. disabled: Boolean,
  12837. modelValue: {
  12838. type: definePropType([
  12839. String,
  12840. Number,
  12841. Object
  12842. ]),
  12843. default: ""
  12844. },
  12845. maxlength: {
  12846. type: [String, Number]
  12847. },
  12848. minlength: {
  12849. type: [String, Number]
  12850. },
  12851. type: {
  12852. type: String,
  12853. default: "text"
  12854. },
  12855. resize: {
  12856. type: String,
  12857. values: ["none", "both", "horizontal", "vertical"]
  12858. },
  12859. autosize: {
  12860. type: definePropType([Boolean, Object]),
  12861. default: false
  12862. },
  12863. autocomplete: {
  12864. type: String,
  12865. default: "off"
  12866. },
  12867. formatter: {
  12868. type: Function
  12869. },
  12870. parser: {
  12871. type: Function
  12872. },
  12873. placeholder: {
  12874. type: String
  12875. },
  12876. form: {
  12877. type: String
  12878. },
  12879. readonly: Boolean,
  12880. clearable: Boolean,
  12881. showPassword: Boolean,
  12882. showWordLimit: Boolean,
  12883. suffixIcon: {
  12884. type: iconPropType
  12885. },
  12886. prefixIcon: {
  12887. type: iconPropType
  12888. },
  12889. containerRole: {
  12890. type: String,
  12891. default: void 0
  12892. },
  12893. tabindex: {
  12894. type: [String, Number],
  12895. default: 0
  12896. },
  12897. validateEvent: {
  12898. type: Boolean,
  12899. default: true
  12900. },
  12901. inputStyle: {
  12902. type: definePropType([Object, Array, String]),
  12903. default: () => mutable({})
  12904. },
  12905. autofocus: Boolean,
  12906. rows: {
  12907. type: Number,
  12908. default: 2
  12909. },
  12910. ...useAriaProps(["ariaLabel"])
  12911. });
  12912. const inputEmits = {
  12913. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  12914. input: (value) => isString$1(value),
  12915. change: (value) => isString$1(value),
  12916. focus: (evt) => evt instanceof FocusEvent,
  12917. blur: (evt) => evt instanceof FocusEvent,
  12918. clear: () => true,
  12919. mouseleave: (evt) => evt instanceof MouseEvent,
  12920. mouseenter: (evt) => evt instanceof MouseEvent,
  12921. keydown: (evt) => evt instanceof Event,
  12922. compositionstart: (evt) => evt instanceof CompositionEvent,
  12923. compositionupdate: (evt) => evt instanceof CompositionEvent,
  12924. compositionend: (evt) => evt instanceof CompositionEvent
  12925. };
  12926. const __default__$1J = vue.defineComponent({
  12927. name: "ElInput",
  12928. inheritAttrs: false
  12929. });
  12930. const _sfc_main$2p = /* @__PURE__ */ vue.defineComponent({
  12931. ...__default__$1J,
  12932. props: inputProps,
  12933. emits: inputEmits,
  12934. setup(__props, { expose, emit }) {
  12935. const props = __props;
  12936. const rawAttrs = vue.useAttrs();
  12937. const slots = vue.useSlots();
  12938. const containerAttrs = vue.computed(() => {
  12939. const comboBoxAttrs = {};
  12940. if (props.containerRole === "combobox") {
  12941. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  12942. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  12943. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  12944. }
  12945. return comboBoxAttrs;
  12946. });
  12947. const containerKls = vue.computed(() => [
  12948. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  12949. nsInput.m(inputSize.value),
  12950. nsInput.is("disabled", inputDisabled.value),
  12951. nsInput.is("exceed", inputExceed.value),
  12952. {
  12953. [nsInput.b("group")]: slots.prepend || slots.append,
  12954. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  12955. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  12956. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  12957. [nsInput.b("hidden")]: props.type === "hidden"
  12958. },
  12959. rawAttrs.class
  12960. ]);
  12961. const wrapperKls = vue.computed(() => [
  12962. nsInput.e("wrapper"),
  12963. nsInput.is("focus", isFocused.value)
  12964. ]);
  12965. const attrs = useAttrs({
  12966. excludeKeys: vue.computed(() => {
  12967. return Object.keys(containerAttrs.value);
  12968. })
  12969. });
  12970. const { form: elForm, formItem: elFormItem } = useFormItem();
  12971. const { inputId } = useFormItemInputId(props, {
  12972. formItemContext: elFormItem
  12973. });
  12974. const inputSize = useFormSize();
  12975. const inputDisabled = useFormDisabled();
  12976. const nsInput = useNamespace("input");
  12977. const nsTextarea = useNamespace("textarea");
  12978. const input = vue.shallowRef();
  12979. const textarea = vue.shallowRef();
  12980. const hovering = vue.ref(false);
  12981. const passwordVisible = vue.ref(false);
  12982. const countStyle = vue.ref();
  12983. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  12984. const _ref = vue.computed(() => input.value || textarea.value);
  12985. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  12986. beforeFocus() {
  12987. return inputDisabled.value;
  12988. },
  12989. afterBlur() {
  12990. var _a;
  12991. if (props.validateEvent) {
  12992. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  12993. }
  12994. }
  12995. });
  12996. const needStatusIcon = vue.computed(() => {
  12997. var _a;
  12998. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  12999. });
  13000. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  13001. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  13002. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  13003. const containerStyle = vue.computed(() => [
  13004. rawAttrs.style
  13005. ]);
  13006. const textareaStyle = vue.computed(() => [
  13007. props.inputStyle,
  13008. textareaCalcStyle.value,
  13009. { resize: props.resize }
  13010. ]);
  13011. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  13012. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  13013. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || isFocused.value));
  13014. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  13015. const textLength = vue.computed(() => nativeInputValue.value.length);
  13016. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  13017. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  13018. const [recordCursor, setCursor] = useCursor(input);
  13019. useResizeObserver(textarea, (entries) => {
  13020. onceInitSizeTextarea();
  13021. if (!isWordLimitVisible.value || props.resize !== "both")
  13022. return;
  13023. const entry = entries[0];
  13024. const { width } = entry.contentRect;
  13025. countStyle.value = {
  13026. right: `calc(100% - ${width + 15 + 6}px)`
  13027. };
  13028. });
  13029. const resizeTextarea = () => {
  13030. const { type, autosize } = props;
  13031. if (!isClient || type !== "textarea" || !textarea.value)
  13032. return;
  13033. if (autosize) {
  13034. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  13035. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  13036. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  13037. textareaCalcStyle.value = {
  13038. overflowY: "hidden",
  13039. ...textareaStyle2
  13040. };
  13041. vue.nextTick(() => {
  13042. textarea.value.offsetHeight;
  13043. textareaCalcStyle.value = textareaStyle2;
  13044. });
  13045. } else {
  13046. textareaCalcStyle.value = {
  13047. minHeight: calcTextareaHeight(textarea.value).minHeight
  13048. };
  13049. }
  13050. };
  13051. const createOnceInitResize = (resizeTextarea2) => {
  13052. let isInit = false;
  13053. return () => {
  13054. var _a;
  13055. if (isInit || !props.autosize)
  13056. return;
  13057. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  13058. if (!isElHidden) {
  13059. resizeTextarea2();
  13060. isInit = true;
  13061. }
  13062. };
  13063. };
  13064. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  13065. const setNativeInputValue = () => {
  13066. const input2 = _ref.value;
  13067. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  13068. if (!input2 || input2.value === formatterValue)
  13069. return;
  13070. input2.value = formatterValue;
  13071. };
  13072. const handleInput = async (event) => {
  13073. recordCursor();
  13074. let { value } = event.target;
  13075. if (props.formatter) {
  13076. value = props.parser ? props.parser(value) : value;
  13077. }
  13078. if (isComposing.value)
  13079. return;
  13080. if (value === nativeInputValue.value) {
  13081. setNativeInputValue();
  13082. return;
  13083. }
  13084. emit(UPDATE_MODEL_EVENT, value);
  13085. emit("input", value);
  13086. await vue.nextTick();
  13087. setNativeInputValue();
  13088. setCursor();
  13089. };
  13090. const handleChange = (event) => {
  13091. emit("change", event.target.value);
  13092. };
  13093. const {
  13094. isComposing,
  13095. handleCompositionStart,
  13096. handleCompositionUpdate,
  13097. handleCompositionEnd
  13098. } = useComposition({ emit, afterComposition: handleInput });
  13099. const handlePasswordVisible = () => {
  13100. passwordVisible.value = !passwordVisible.value;
  13101. focus();
  13102. };
  13103. const focus = async () => {
  13104. var _a;
  13105. await vue.nextTick();
  13106. (_a = _ref.value) == null ? void 0 : _a.focus();
  13107. };
  13108. const blur = () => {
  13109. var _a;
  13110. return (_a = _ref.value) == null ? void 0 : _a.blur();
  13111. };
  13112. const handleMouseLeave = (evt) => {
  13113. hovering.value = false;
  13114. emit("mouseleave", evt);
  13115. };
  13116. const handleMouseEnter = (evt) => {
  13117. hovering.value = true;
  13118. emit("mouseenter", evt);
  13119. };
  13120. const handleKeydown = (evt) => {
  13121. emit("keydown", evt);
  13122. };
  13123. const select = () => {
  13124. var _a;
  13125. (_a = _ref.value) == null ? void 0 : _a.select();
  13126. };
  13127. const clear = () => {
  13128. emit(UPDATE_MODEL_EVENT, "");
  13129. emit("change", "");
  13130. emit("clear");
  13131. emit("input", "");
  13132. };
  13133. vue.watch(() => props.modelValue, () => {
  13134. var _a;
  13135. vue.nextTick(() => resizeTextarea());
  13136. if (props.validateEvent) {
  13137. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  13138. }
  13139. });
  13140. vue.watch(nativeInputValue, () => setNativeInputValue());
  13141. vue.watch(() => props.type, async () => {
  13142. await vue.nextTick();
  13143. setNativeInputValue();
  13144. resizeTextarea();
  13145. });
  13146. vue.onMounted(() => {
  13147. if (!props.formatter && props.parser) ;
  13148. setNativeInputValue();
  13149. vue.nextTick(resizeTextarea);
  13150. });
  13151. expose({
  13152. input,
  13153. textarea,
  13154. ref: _ref,
  13155. textareaStyle,
  13156. autosize: vue.toRef(props, "autosize"),
  13157. isComposing,
  13158. focus,
  13159. blur,
  13160. select,
  13161. clear,
  13162. resizeTextarea
  13163. });
  13164. return (_ctx, _cache) => {
  13165. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(vue.unref(containerAttrs), {
  13166. class: [
  13167. vue.unref(containerKls),
  13168. {
  13169. [vue.unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  13170. [vue.unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  13171. }
  13172. ],
  13173. style: vue.unref(containerStyle),
  13174. role: _ctx.containerRole,
  13175. onMouseenter: handleMouseEnter,
  13176. onMouseleave: handleMouseLeave
  13177. }), [
  13178. vue.createCommentVNode(" input "),
  13179. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13180. vue.createCommentVNode(" prepend slot "),
  13181. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  13182. key: 0,
  13183. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  13184. }, [
  13185. vue.renderSlot(_ctx.$slots, "prepend")
  13186. ], 2)) : vue.createCommentVNode("v-if", true),
  13187. vue.createElementVNode("div", {
  13188. ref_key: "wrapperRef",
  13189. ref: wrapperRef,
  13190. class: vue.normalizeClass(vue.unref(wrapperKls))
  13191. }, [
  13192. vue.createCommentVNode(" prefix slot "),
  13193. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  13194. key: 0,
  13195. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  13196. }, [
  13197. vue.createElementVNode("span", {
  13198. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner"))
  13199. }, [
  13200. vue.renderSlot(_ctx.$slots, "prefix"),
  13201. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13202. key: 0,
  13203. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13204. }, {
  13205. default: vue.withCtx(() => [
  13206. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  13207. ]),
  13208. _: 1
  13209. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13210. ], 2)
  13211. ], 2)) : vue.createCommentVNode("v-if", true),
  13212. vue.createElementVNode("input", vue.mergeProps({
  13213. id: vue.unref(inputId),
  13214. ref_key: "input",
  13215. ref: input,
  13216. class: vue.unref(nsInput).e("inner")
  13217. }, vue.unref(attrs), {
  13218. minlength: _ctx.minlength,
  13219. maxlength: _ctx.maxlength,
  13220. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  13221. disabled: vue.unref(inputDisabled),
  13222. readonly: _ctx.readonly,
  13223. autocomplete: _ctx.autocomplete,
  13224. tabindex: _ctx.tabindex,
  13225. "aria-label": _ctx.ariaLabel,
  13226. placeholder: _ctx.placeholder,
  13227. style: _ctx.inputStyle,
  13228. form: _ctx.form,
  13229. autofocus: _ctx.autofocus,
  13230. onCompositionstart: vue.unref(handleCompositionStart),
  13231. onCompositionupdate: vue.unref(handleCompositionUpdate),
  13232. onCompositionend: vue.unref(handleCompositionEnd),
  13233. onInput: handleInput,
  13234. onChange: handleChange,
  13235. onKeydown: handleKeydown
  13236. }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  13237. vue.createCommentVNode(" suffix slot "),
  13238. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13239. key: 1,
  13240. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  13241. }, [
  13242. vue.createElementVNode("span", {
  13243. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner"))
  13244. }, [
  13245. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13246. vue.renderSlot(_ctx.$slots, "suffix"),
  13247. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13248. key: 0,
  13249. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13250. }, {
  13251. default: vue.withCtx(() => [
  13252. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  13253. ]),
  13254. _: 1
  13255. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13256. ], 64)) : vue.createCommentVNode("v-if", true),
  13257. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13258. key: 1,
  13259. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  13260. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  13261. onClick: clear
  13262. }, {
  13263. default: vue.withCtx(() => [
  13264. vue.createVNode(vue.unref(circle_close_default))
  13265. ]),
  13266. _: 1
  13267. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  13268. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13269. key: 2,
  13270. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  13271. onClick: handlePasswordVisible
  13272. }, {
  13273. default: vue.withCtx(() => [
  13274. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  13275. ]),
  13276. _: 1
  13277. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  13278. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13279. key: 3,
  13280. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13281. }, [
  13282. vue.createElementVNode("span", {
  13283. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  13284. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 3)
  13285. ], 2)) : vue.createCommentVNode("v-if", true),
  13286. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13287. key: 4,
  13288. class: vue.normalizeClass([
  13289. vue.unref(nsInput).e("icon"),
  13290. vue.unref(nsInput).e("validateIcon"),
  13291. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  13292. ])
  13293. }, {
  13294. default: vue.withCtx(() => [
  13295. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  13296. ]),
  13297. _: 1
  13298. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13299. ], 2)
  13300. ], 2)) : vue.createCommentVNode("v-if", true)
  13301. ], 2),
  13302. vue.createCommentVNode(" append slot "),
  13303. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  13304. key: 1,
  13305. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  13306. }, [
  13307. vue.renderSlot(_ctx.$slots, "append")
  13308. ], 2)) : vue.createCommentVNode("v-if", true)
  13309. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  13310. vue.createCommentVNode(" textarea "),
  13311. vue.createElementVNode("textarea", vue.mergeProps({
  13312. id: vue.unref(inputId),
  13313. ref_key: "textarea",
  13314. ref: textarea,
  13315. class: [vue.unref(nsTextarea).e("inner"), vue.unref(nsInput).is("focus", vue.unref(isFocused))]
  13316. }, vue.unref(attrs), {
  13317. minlength: _ctx.minlength,
  13318. maxlength: _ctx.maxlength,
  13319. tabindex: _ctx.tabindex,
  13320. disabled: vue.unref(inputDisabled),
  13321. readonly: _ctx.readonly,
  13322. autocomplete: _ctx.autocomplete,
  13323. style: vue.unref(textareaStyle),
  13324. "aria-label": _ctx.ariaLabel,
  13325. placeholder: _ctx.placeholder,
  13326. form: _ctx.form,
  13327. autofocus: _ctx.autofocus,
  13328. rows: _ctx.rows,
  13329. onCompositionstart: vue.unref(handleCompositionStart),
  13330. onCompositionupdate: vue.unref(handleCompositionUpdate),
  13331. onCompositionend: vue.unref(handleCompositionEnd),
  13332. onInput: handleInput,
  13333. onFocus: vue.unref(handleFocus),
  13334. onBlur: vue.unref(handleBlur),
  13335. onChange: handleChange,
  13336. onKeydown: handleKeydown
  13337. }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
  13338. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13339. key: 0,
  13340. style: vue.normalizeStyle(countStyle.value),
  13341. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13342. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 7)) : vue.createCommentVNode("v-if", true)
  13343. ], 64))
  13344. ], 16, ["role"]);
  13345. };
  13346. }
  13347. });
  13348. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "input.vue"]]);
  13349. const ElInput = withInstall(Input);
  13350. const GAP = 4;
  13351. const BAR_MAP = {
  13352. vertical: {
  13353. offset: "offsetHeight",
  13354. scroll: "scrollTop",
  13355. scrollSize: "scrollHeight",
  13356. size: "height",
  13357. key: "vertical",
  13358. axis: "Y",
  13359. client: "clientY",
  13360. direction: "top"
  13361. },
  13362. horizontal: {
  13363. offset: "offsetWidth",
  13364. scroll: "scrollLeft",
  13365. scrollSize: "scrollWidth",
  13366. size: "width",
  13367. key: "horizontal",
  13368. axis: "X",
  13369. client: "clientX",
  13370. direction: "left"
  13371. }
  13372. };
  13373. const renderThumbStyle$1 = ({
  13374. move,
  13375. size,
  13376. bar
  13377. }) => ({
  13378. [bar.size]: size,
  13379. transform: `translate${bar.axis}(${move}%)`
  13380. });
  13381. const scrollbarContextKey = Symbol("scrollbarContextKey");
  13382. const thumbProps = buildProps({
  13383. vertical: Boolean,
  13384. size: String,
  13385. move: Number,
  13386. ratio: {
  13387. type: Number,
  13388. required: true
  13389. },
  13390. always: Boolean
  13391. });
  13392. const COMPONENT_NAME$k = "Thumb";
  13393. const _sfc_main$2o = /* @__PURE__ */ vue.defineComponent({
  13394. __name: "thumb",
  13395. props: thumbProps,
  13396. setup(__props) {
  13397. const props = __props;
  13398. const scrollbar = vue.inject(scrollbarContextKey);
  13399. const ns = useNamespace("scrollbar");
  13400. if (!scrollbar)
  13401. throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
  13402. const instance = vue.ref();
  13403. const thumb = vue.ref();
  13404. const thumbState = vue.ref({});
  13405. const visible = vue.ref(false);
  13406. let cursorDown = false;
  13407. let cursorLeave = false;
  13408. let originalOnSelectStart = isClient ? document.onselectstart : null;
  13409. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  13410. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  13411. size: props.size,
  13412. move: props.move,
  13413. bar: bar.value
  13414. }));
  13415. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  13416. const clickThumbHandler = (e) => {
  13417. var _a;
  13418. e.stopPropagation();
  13419. if (e.ctrlKey || [1, 2].includes(e.button))
  13420. return;
  13421. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  13422. startDrag(e);
  13423. const el = e.currentTarget;
  13424. if (!el)
  13425. return;
  13426. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  13427. };
  13428. const clickTrackHandler = (e) => {
  13429. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  13430. return;
  13431. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  13432. const thumbHalf = thumb.value[bar.value.offset] / 2;
  13433. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13434. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13435. };
  13436. const startDrag = (e) => {
  13437. e.stopImmediatePropagation();
  13438. cursorDown = true;
  13439. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  13440. document.addEventListener("mouseup", mouseUpDocumentHandler);
  13441. originalOnSelectStart = document.onselectstart;
  13442. document.onselectstart = () => false;
  13443. };
  13444. const mouseMoveDocumentHandler = (e) => {
  13445. if (!instance.value || !thumb.value)
  13446. return;
  13447. if (cursorDown === false)
  13448. return;
  13449. const prevPage = thumbState.value[bar.value.axis];
  13450. if (!prevPage)
  13451. return;
  13452. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  13453. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  13454. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13455. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13456. };
  13457. const mouseUpDocumentHandler = () => {
  13458. cursorDown = false;
  13459. thumbState.value[bar.value.axis] = 0;
  13460. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  13461. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13462. restoreOnselectstart();
  13463. if (cursorLeave)
  13464. visible.value = false;
  13465. };
  13466. const mouseMoveScrollbarHandler = () => {
  13467. cursorLeave = false;
  13468. visible.value = !!props.size;
  13469. };
  13470. const mouseLeaveScrollbarHandler = () => {
  13471. cursorLeave = true;
  13472. visible.value = cursorDown;
  13473. };
  13474. vue.onBeforeUnmount(() => {
  13475. restoreOnselectstart();
  13476. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13477. });
  13478. const restoreOnselectstart = () => {
  13479. if (document.onselectstart !== originalOnSelectStart)
  13480. document.onselectstart = originalOnSelectStart;
  13481. };
  13482. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  13483. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  13484. return (_ctx, _cache) => {
  13485. return vue.openBlock(), vue.createBlock(vue.Transition, {
  13486. name: vue.unref(ns).b("fade"),
  13487. persisted: ""
  13488. }, {
  13489. default: vue.withCtx(() => [
  13490. vue.withDirectives(vue.createElementVNode("div", {
  13491. ref_key: "instance",
  13492. ref: instance,
  13493. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  13494. onMousedown: clickTrackHandler
  13495. }, [
  13496. vue.createElementVNode("div", {
  13497. ref_key: "thumb",
  13498. ref: thumb,
  13499. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  13500. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  13501. onMousedown: clickThumbHandler
  13502. }, null, 38)
  13503. ], 34), [
  13504. [vue.vShow, _ctx.always || visible.value]
  13505. ])
  13506. ]),
  13507. _: 1
  13508. }, 8, ["name"]);
  13509. };
  13510. }
  13511. });
  13512. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "thumb.vue"]]);
  13513. const barProps = buildProps({
  13514. always: {
  13515. type: Boolean,
  13516. default: true
  13517. },
  13518. minSize: {
  13519. type: Number,
  13520. required: true
  13521. }
  13522. });
  13523. const _sfc_main$2n = /* @__PURE__ */ vue.defineComponent({
  13524. __name: "bar",
  13525. props: barProps,
  13526. setup(__props, { expose }) {
  13527. const props = __props;
  13528. const scrollbar = vue.inject(scrollbarContextKey);
  13529. const moveX = vue.ref(0);
  13530. const moveY = vue.ref(0);
  13531. const sizeWidth = vue.ref("");
  13532. const sizeHeight = vue.ref("");
  13533. const ratioY = vue.ref(1);
  13534. const ratioX = vue.ref(1);
  13535. const handleScroll = (wrap) => {
  13536. if (wrap) {
  13537. const offsetHeight = wrap.offsetHeight - GAP;
  13538. const offsetWidth = wrap.offsetWidth - GAP;
  13539. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  13540. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  13541. }
  13542. };
  13543. const update = () => {
  13544. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  13545. if (!wrap)
  13546. return;
  13547. const offsetHeight = wrap.offsetHeight - GAP;
  13548. const offsetWidth = wrap.offsetWidth - GAP;
  13549. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  13550. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  13551. const height = Math.max(originalHeight, props.minSize);
  13552. const width = Math.max(originalWidth, props.minSize);
  13553. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  13554. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  13555. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  13556. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  13557. };
  13558. expose({
  13559. handleScroll,
  13560. update
  13561. });
  13562. return (_ctx, _cache) => {
  13563. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  13564. vue.createVNode(Thumb, {
  13565. move: moveX.value,
  13566. ratio: ratioX.value,
  13567. size: sizeWidth.value,
  13568. always: _ctx.always
  13569. }, null, 8, ["move", "ratio", "size", "always"]),
  13570. vue.createVNode(Thumb, {
  13571. move: moveY.value,
  13572. ratio: ratioY.value,
  13573. size: sizeHeight.value,
  13574. vertical: "",
  13575. always: _ctx.always
  13576. }, null, 8, ["move", "ratio", "size", "always"])
  13577. ], 64);
  13578. };
  13579. }
  13580. });
  13581. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "bar.vue"]]);
  13582. const scrollbarProps = buildProps({
  13583. height: {
  13584. type: [String, Number],
  13585. default: ""
  13586. },
  13587. maxHeight: {
  13588. type: [String, Number],
  13589. default: ""
  13590. },
  13591. native: {
  13592. type: Boolean,
  13593. default: false
  13594. },
  13595. wrapStyle: {
  13596. type: definePropType([String, Object, Array]),
  13597. default: ""
  13598. },
  13599. wrapClass: {
  13600. type: [String, Array],
  13601. default: ""
  13602. },
  13603. viewClass: {
  13604. type: [String, Array],
  13605. default: ""
  13606. },
  13607. viewStyle: {
  13608. type: [String, Array, Object],
  13609. default: ""
  13610. },
  13611. noresize: Boolean,
  13612. tag: {
  13613. type: String,
  13614. default: "div"
  13615. },
  13616. always: Boolean,
  13617. minSize: {
  13618. type: Number,
  13619. default: 20
  13620. },
  13621. id: String,
  13622. role: String,
  13623. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  13624. });
  13625. const scrollbarEmits = {
  13626. scroll: ({
  13627. scrollTop,
  13628. scrollLeft
  13629. }) => [scrollTop, scrollLeft].every(isNumber)
  13630. };
  13631. const COMPONENT_NAME$j = "ElScrollbar";
  13632. const __default__$1I = vue.defineComponent({
  13633. name: COMPONENT_NAME$j
  13634. });
  13635. const _sfc_main$2m = /* @__PURE__ */ vue.defineComponent({
  13636. ...__default__$1I,
  13637. props: scrollbarProps,
  13638. emits: scrollbarEmits,
  13639. setup(__props, { expose, emit }) {
  13640. const props = __props;
  13641. const ns = useNamespace("scrollbar");
  13642. let stopResizeObserver = void 0;
  13643. let stopResizeListener = void 0;
  13644. let wrapScrollTop = 0;
  13645. let wrapScrollLeft = 0;
  13646. const scrollbarRef = vue.ref();
  13647. const wrapRef = vue.ref();
  13648. const resizeRef = vue.ref();
  13649. const barRef = vue.ref();
  13650. const wrapStyle = vue.computed(() => {
  13651. const style = {};
  13652. if (props.height)
  13653. style.height = addUnit(props.height);
  13654. if (props.maxHeight)
  13655. style.maxHeight = addUnit(props.maxHeight);
  13656. return [props.wrapStyle, style];
  13657. });
  13658. const wrapKls = vue.computed(() => {
  13659. return [
  13660. props.wrapClass,
  13661. ns.e("wrap"),
  13662. { [ns.em("wrap", "hidden-default")]: !props.native }
  13663. ];
  13664. });
  13665. const resizeKls = vue.computed(() => {
  13666. return [ns.e("view"), props.viewClass];
  13667. });
  13668. const handleScroll = () => {
  13669. var _a;
  13670. if (wrapRef.value) {
  13671. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13672. wrapScrollTop = wrapRef.value.scrollTop;
  13673. wrapScrollLeft = wrapRef.value.scrollLeft;
  13674. emit("scroll", {
  13675. scrollTop: wrapRef.value.scrollTop,
  13676. scrollLeft: wrapRef.value.scrollLeft
  13677. });
  13678. }
  13679. };
  13680. function scrollTo(arg1, arg2) {
  13681. if (isObject$1(arg1)) {
  13682. wrapRef.value.scrollTo(arg1);
  13683. } else if (isNumber(arg1) && isNumber(arg2)) {
  13684. wrapRef.value.scrollTo(arg1, arg2);
  13685. }
  13686. }
  13687. const setScrollTop = (value) => {
  13688. if (!isNumber(value)) {
  13689. return;
  13690. }
  13691. wrapRef.value.scrollTop = value;
  13692. };
  13693. const setScrollLeft = (value) => {
  13694. if (!isNumber(value)) {
  13695. return;
  13696. }
  13697. wrapRef.value.scrollLeft = value;
  13698. };
  13699. const update = () => {
  13700. var _a;
  13701. (_a = barRef.value) == null ? void 0 : _a.update();
  13702. };
  13703. vue.watch(() => props.noresize, (noresize) => {
  13704. if (noresize) {
  13705. stopResizeObserver == null ? void 0 : stopResizeObserver();
  13706. stopResizeListener == null ? void 0 : stopResizeListener();
  13707. } else {
  13708. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  13709. stopResizeListener = useEventListener("resize", update);
  13710. }
  13711. }, { immediate: true });
  13712. vue.watch(() => [props.maxHeight, props.height], () => {
  13713. if (!props.native)
  13714. vue.nextTick(() => {
  13715. var _a;
  13716. update();
  13717. if (wrapRef.value) {
  13718. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13719. }
  13720. });
  13721. });
  13722. vue.provide(scrollbarContextKey, vue.reactive({
  13723. scrollbarElement: scrollbarRef,
  13724. wrapElement: wrapRef
  13725. }));
  13726. vue.onActivated(() => {
  13727. wrapRef.value.scrollTop = wrapScrollTop;
  13728. wrapRef.value.scrollLeft = wrapScrollLeft;
  13729. });
  13730. vue.onMounted(() => {
  13731. if (!props.native)
  13732. vue.nextTick(() => {
  13733. update();
  13734. });
  13735. });
  13736. vue.onUpdated(() => update());
  13737. expose({
  13738. wrapRef,
  13739. update,
  13740. scrollTo,
  13741. setScrollTop,
  13742. setScrollLeft,
  13743. handleScroll
  13744. });
  13745. return (_ctx, _cache) => {
  13746. return vue.openBlock(), vue.createElementBlock("div", {
  13747. ref_key: "scrollbarRef",
  13748. ref: scrollbarRef,
  13749. class: vue.normalizeClass(vue.unref(ns).b())
  13750. }, [
  13751. vue.createElementVNode("div", {
  13752. ref_key: "wrapRef",
  13753. ref: wrapRef,
  13754. class: vue.normalizeClass(vue.unref(wrapKls)),
  13755. style: vue.normalizeStyle(vue.unref(wrapStyle)),
  13756. onScroll: handleScroll
  13757. }, [
  13758. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  13759. id: _ctx.id,
  13760. ref_key: "resizeRef",
  13761. ref: resizeRef,
  13762. class: vue.normalizeClass(vue.unref(resizeKls)),
  13763. style: vue.normalizeStyle(_ctx.viewStyle),
  13764. role: _ctx.role,
  13765. "aria-label": _ctx.ariaLabel,
  13766. "aria-orientation": _ctx.ariaOrientation
  13767. }, {
  13768. default: vue.withCtx(() => [
  13769. vue.renderSlot(_ctx.$slots, "default")
  13770. ]),
  13771. _: 3
  13772. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  13773. ], 38),
  13774. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  13775. key: 0,
  13776. ref_key: "barRef",
  13777. ref: barRef,
  13778. always: _ctx.always,
  13779. "min-size": _ctx.minSize
  13780. }, null, 8, ["always", "min-size"])) : vue.createCommentVNode("v-if", true)
  13781. ], 2);
  13782. };
  13783. }
  13784. });
  13785. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "scrollbar.vue"]]);
  13786. const ElScrollbar = withInstall(Scrollbar$1);
  13787. const POPPER_INJECTION_KEY = Symbol("popper");
  13788. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  13789. const Effect = {
  13790. LIGHT: "light",
  13791. DARK: "dark"
  13792. };
  13793. const roleTypes = [
  13794. "dialog",
  13795. "grid",
  13796. "group",
  13797. "listbox",
  13798. "menu",
  13799. "navigation",
  13800. "tooltip",
  13801. "tree"
  13802. ];
  13803. const popperProps = buildProps({
  13804. role: {
  13805. type: String,
  13806. values: roleTypes,
  13807. default: "tooltip"
  13808. }
  13809. });
  13810. const usePopperProps = popperProps;
  13811. const __default__$1H = vue.defineComponent({
  13812. name: "ElPopper",
  13813. inheritAttrs: false
  13814. });
  13815. const _sfc_main$2l = /* @__PURE__ */ vue.defineComponent({
  13816. ...__default__$1H,
  13817. props: popperProps,
  13818. setup(__props, { expose }) {
  13819. const props = __props;
  13820. const triggerRef = vue.ref();
  13821. const popperInstanceRef = vue.ref();
  13822. const contentRef = vue.ref();
  13823. const referenceRef = vue.ref();
  13824. const role = vue.computed(() => props.role);
  13825. const popperProvides = {
  13826. triggerRef,
  13827. popperInstanceRef,
  13828. contentRef,
  13829. referenceRef,
  13830. role
  13831. };
  13832. expose(popperProvides);
  13833. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  13834. return (_ctx, _cache) => {
  13835. return vue.renderSlot(_ctx.$slots, "default");
  13836. };
  13837. }
  13838. });
  13839. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["__file", "popper.vue"]]);
  13840. const popperArrowProps = buildProps({
  13841. arrowOffset: {
  13842. type: Number,
  13843. default: 5
  13844. }
  13845. });
  13846. const usePopperArrowProps = popperArrowProps;
  13847. const __default__$1G = vue.defineComponent({
  13848. name: "ElPopperArrow",
  13849. inheritAttrs: false
  13850. });
  13851. const _sfc_main$2k = /* @__PURE__ */ vue.defineComponent({
  13852. ...__default__$1G,
  13853. props: popperArrowProps,
  13854. setup(__props, { expose }) {
  13855. const props = __props;
  13856. const ns = useNamespace("popper");
  13857. const { arrowOffset, arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  13858. vue.watch(() => props.arrowOffset, (val) => {
  13859. arrowOffset.value = val;
  13860. });
  13861. vue.onBeforeUnmount(() => {
  13862. arrowRef.value = void 0;
  13863. });
  13864. expose({
  13865. arrowRef
  13866. });
  13867. return (_ctx, _cache) => {
  13868. return vue.openBlock(), vue.createElementBlock("span", {
  13869. ref_key: "arrowRef",
  13870. ref: arrowRef,
  13871. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  13872. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  13873. "data-popper-arrow": ""
  13874. }, null, 6);
  13875. };
  13876. }
  13877. });
  13878. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "arrow.vue"]]);
  13879. const NAME = "ElOnlyChild";
  13880. const OnlyChild = vue.defineComponent({
  13881. name: NAME,
  13882. setup(_, {
  13883. slots,
  13884. attrs
  13885. }) {
  13886. var _a;
  13887. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  13888. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  13889. return () => {
  13890. var _a2;
  13891. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  13892. if (!defaultSlot)
  13893. return null;
  13894. if (defaultSlot.length > 1) {
  13895. return null;
  13896. }
  13897. const firstLegitNode = findFirstLegitChild(defaultSlot);
  13898. if (!firstLegitNode) {
  13899. return null;
  13900. }
  13901. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  13902. };
  13903. }
  13904. });
  13905. function findFirstLegitChild(node) {
  13906. if (!node)
  13907. return null;
  13908. const children = node;
  13909. for (const child of children) {
  13910. if (isObject$1(child)) {
  13911. switch (child.type) {
  13912. case vue.Comment:
  13913. continue;
  13914. case vue.Text:
  13915. case "svg":
  13916. return wrapTextContent(child);
  13917. case vue.Fragment:
  13918. return findFirstLegitChild(child.children);
  13919. default:
  13920. return child;
  13921. }
  13922. }
  13923. return wrapTextContent(child);
  13924. }
  13925. return null;
  13926. }
  13927. function wrapTextContent(s) {
  13928. const ns = useNamespace("only-child");
  13929. return vue.createVNode("span", {
  13930. "class": ns.e("content")
  13931. }, [s]);
  13932. }
  13933. const popperTriggerProps = buildProps({
  13934. virtualRef: {
  13935. type: definePropType(Object)
  13936. },
  13937. virtualTriggering: Boolean,
  13938. onMouseenter: {
  13939. type: definePropType(Function)
  13940. },
  13941. onMouseleave: {
  13942. type: definePropType(Function)
  13943. },
  13944. onClick: {
  13945. type: definePropType(Function)
  13946. },
  13947. onKeydown: {
  13948. type: definePropType(Function)
  13949. },
  13950. onFocus: {
  13951. type: definePropType(Function)
  13952. },
  13953. onBlur: {
  13954. type: definePropType(Function)
  13955. },
  13956. onContextmenu: {
  13957. type: definePropType(Function)
  13958. },
  13959. id: String,
  13960. open: Boolean
  13961. });
  13962. const usePopperTriggerProps = popperTriggerProps;
  13963. const __default__$1F = vue.defineComponent({
  13964. name: "ElPopperTrigger",
  13965. inheritAttrs: false
  13966. });
  13967. const _sfc_main$2j = /* @__PURE__ */ vue.defineComponent({
  13968. ...__default__$1F,
  13969. props: popperTriggerProps,
  13970. setup(__props, { expose }) {
  13971. const props = __props;
  13972. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  13973. useForwardRef(triggerRef);
  13974. const ariaControls = vue.computed(() => {
  13975. return ariaHaspopup.value ? props.id : void 0;
  13976. });
  13977. const ariaDescribedby = vue.computed(() => {
  13978. if (role && role.value === "tooltip") {
  13979. return props.open && props.id ? props.id : void 0;
  13980. }
  13981. return void 0;
  13982. });
  13983. const ariaHaspopup = vue.computed(() => {
  13984. if (role && role.value !== "tooltip") {
  13985. return role.value;
  13986. }
  13987. return void 0;
  13988. });
  13989. const ariaExpanded = vue.computed(() => {
  13990. return ariaHaspopup.value ? `${props.open}` : void 0;
  13991. });
  13992. let virtualTriggerAriaStopWatch = void 0;
  13993. const TRIGGER_ELE_EVENTS = [
  13994. "onMouseenter",
  13995. "onMouseleave",
  13996. "onClick",
  13997. "onKeydown",
  13998. "onFocus",
  13999. "onBlur",
  14000. "onContextmenu"
  14001. ];
  14002. vue.onMounted(() => {
  14003. vue.watch(() => props.virtualRef, (virtualEl) => {
  14004. if (virtualEl) {
  14005. triggerRef.value = unrefElement(virtualEl);
  14006. }
  14007. }, {
  14008. immediate: true
  14009. });
  14010. vue.watch(triggerRef, (el, prevEl) => {
  14011. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14012. virtualTriggerAriaStopWatch = void 0;
  14013. if (isElement$1(el)) {
  14014. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14015. var _a;
  14016. const handler = props[eventName];
  14017. if (handler) {
  14018. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  14019. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  14020. }
  14021. });
  14022. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  14023. [
  14024. "aria-controls",
  14025. "aria-describedby",
  14026. "aria-haspopup",
  14027. "aria-expanded"
  14028. ].forEach((key, idx) => {
  14029. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14030. });
  14031. }, { immediate: true });
  14032. }
  14033. if (isElement$1(prevEl)) {
  14034. [
  14035. "aria-controls",
  14036. "aria-describedby",
  14037. "aria-haspopup",
  14038. "aria-expanded"
  14039. ].forEach((key) => prevEl.removeAttribute(key));
  14040. }
  14041. }, {
  14042. immediate: true
  14043. });
  14044. });
  14045. vue.onBeforeUnmount(() => {
  14046. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14047. virtualTriggerAriaStopWatch = void 0;
  14048. if (triggerRef.value && isElement$1(triggerRef.value)) {
  14049. const el = triggerRef.value;
  14050. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14051. const handler = props[eventName];
  14052. if (handler) {
  14053. el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
  14054. }
  14055. });
  14056. triggerRef.value = void 0;
  14057. }
  14058. });
  14059. expose({
  14060. triggerRef
  14061. });
  14062. return (_ctx, _cache) => {
  14063. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  14064. "aria-controls": vue.unref(ariaControls),
  14065. "aria-describedby": vue.unref(ariaDescribedby),
  14066. "aria-expanded": vue.unref(ariaExpanded),
  14067. "aria-haspopup": vue.unref(ariaHaspopup)
  14068. }), {
  14069. default: vue.withCtx(() => [
  14070. vue.renderSlot(_ctx.$slots, "default")
  14071. ]),
  14072. _: 3
  14073. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  14074. };
  14075. }
  14076. });
  14077. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["__file", "trigger.vue"]]);
  14078. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  14079. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  14080. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  14081. const FOCUS_AFTER_TRAPPED_OPTS = {
  14082. cancelable: true,
  14083. bubbles: false
  14084. };
  14085. const FOCUSOUT_PREVENTED_OPTS = {
  14086. cancelable: true,
  14087. bubbles: false
  14088. };
  14089. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  14090. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  14091. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  14092. const focusReason = vue.ref();
  14093. const lastUserFocusTimestamp = vue.ref(0);
  14094. const lastAutomatedFocusTimestamp = vue.ref(0);
  14095. let focusReasonUserCount = 0;
  14096. const obtainAllFocusableElements = (element) => {
  14097. const nodes = [];
  14098. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  14099. acceptNode: (node) => {
  14100. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  14101. if (node.disabled || node.hidden || isHiddenInput)
  14102. return NodeFilter.FILTER_SKIP;
  14103. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  14104. }
  14105. });
  14106. while (walker.nextNode())
  14107. nodes.push(walker.currentNode);
  14108. return nodes;
  14109. };
  14110. const getVisibleElement = (elements, container) => {
  14111. for (const element of elements) {
  14112. if (!isHidden(element, container))
  14113. return element;
  14114. }
  14115. };
  14116. const isHidden = (element, container) => {
  14117. if (getComputedStyle(element).visibility === "hidden")
  14118. return true;
  14119. while (element) {
  14120. if (container && element === container)
  14121. return false;
  14122. if (getComputedStyle(element).display === "none")
  14123. return true;
  14124. element = element.parentElement;
  14125. }
  14126. return false;
  14127. };
  14128. const getEdges = (container) => {
  14129. const focusable = obtainAllFocusableElements(container);
  14130. const first = getVisibleElement(focusable, container);
  14131. const last = getVisibleElement(focusable.reverse(), container);
  14132. return [first, last];
  14133. };
  14134. const isSelectable = (element) => {
  14135. return element instanceof HTMLInputElement && "select" in element;
  14136. };
  14137. const tryFocus = (element, shouldSelect) => {
  14138. if (element && element.focus) {
  14139. const prevFocusedElement = document.activeElement;
  14140. element.focus({ preventScroll: true });
  14141. lastAutomatedFocusTimestamp.value = window.performance.now();
  14142. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  14143. element.select();
  14144. }
  14145. }
  14146. };
  14147. function removeFromStack(list, item) {
  14148. const copy = [...list];
  14149. const idx = list.indexOf(item);
  14150. if (idx !== -1) {
  14151. copy.splice(idx, 1);
  14152. }
  14153. return copy;
  14154. }
  14155. const createFocusableStack = () => {
  14156. let stack = [];
  14157. const push = (layer) => {
  14158. const currentLayer = stack[0];
  14159. if (currentLayer && layer !== currentLayer) {
  14160. currentLayer.pause();
  14161. }
  14162. stack = removeFromStack(stack, layer);
  14163. stack.unshift(layer);
  14164. };
  14165. const remove = (layer) => {
  14166. var _a, _b;
  14167. stack = removeFromStack(stack, layer);
  14168. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  14169. };
  14170. return {
  14171. push,
  14172. remove
  14173. };
  14174. };
  14175. const focusFirstDescendant = (elements, shouldSelect = false) => {
  14176. const prevFocusedElement = document.activeElement;
  14177. for (const element of elements) {
  14178. tryFocus(element, shouldSelect);
  14179. if (document.activeElement !== prevFocusedElement)
  14180. return;
  14181. }
  14182. };
  14183. const focusableStack = createFocusableStack();
  14184. const isFocusCausedByUserEvent = () => {
  14185. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  14186. };
  14187. const notifyFocusReasonPointer = () => {
  14188. focusReason.value = "pointer";
  14189. lastUserFocusTimestamp.value = window.performance.now();
  14190. };
  14191. const notifyFocusReasonKeydown = () => {
  14192. focusReason.value = "keyboard";
  14193. lastUserFocusTimestamp.value = window.performance.now();
  14194. };
  14195. const useFocusReason = () => {
  14196. vue.onMounted(() => {
  14197. if (focusReasonUserCount === 0) {
  14198. document.addEventListener("mousedown", notifyFocusReasonPointer);
  14199. document.addEventListener("touchstart", notifyFocusReasonPointer);
  14200. document.addEventListener("keydown", notifyFocusReasonKeydown);
  14201. }
  14202. focusReasonUserCount++;
  14203. });
  14204. vue.onBeforeUnmount(() => {
  14205. focusReasonUserCount--;
  14206. if (focusReasonUserCount <= 0) {
  14207. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  14208. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  14209. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  14210. }
  14211. });
  14212. return {
  14213. focusReason,
  14214. lastUserFocusTimestamp,
  14215. lastAutomatedFocusTimestamp
  14216. };
  14217. };
  14218. const createFocusOutPreventedEvent = (detail) => {
  14219. return new CustomEvent(FOCUSOUT_PREVENTED, {
  14220. ...FOCUSOUT_PREVENTED_OPTS,
  14221. detail
  14222. });
  14223. };
  14224. const _sfc_main$2i = vue.defineComponent({
  14225. name: "ElFocusTrap",
  14226. inheritAttrs: false,
  14227. props: {
  14228. loop: Boolean,
  14229. trapped: Boolean,
  14230. focusTrapEl: Object,
  14231. focusStartEl: {
  14232. type: [Object, String],
  14233. default: "first"
  14234. }
  14235. },
  14236. emits: [
  14237. ON_TRAP_FOCUS_EVT,
  14238. ON_RELEASE_FOCUS_EVT,
  14239. "focusin",
  14240. "focusout",
  14241. "focusout-prevented",
  14242. "release-requested"
  14243. ],
  14244. setup(props, { emit }) {
  14245. const forwardRef = vue.ref();
  14246. let lastFocusBeforeTrapped;
  14247. let lastFocusAfterTrapped;
  14248. const { focusReason } = useFocusReason();
  14249. useEscapeKeydown((event) => {
  14250. if (props.trapped && !focusLayer.paused) {
  14251. emit("release-requested", event);
  14252. }
  14253. });
  14254. const focusLayer = {
  14255. paused: false,
  14256. pause() {
  14257. this.paused = true;
  14258. },
  14259. resume() {
  14260. this.paused = false;
  14261. }
  14262. };
  14263. const onKeydown = (e) => {
  14264. if (!props.loop && !props.trapped)
  14265. return;
  14266. if (focusLayer.paused)
  14267. return;
  14268. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  14269. const { loop } = props;
  14270. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  14271. const currentFocusingEl = document.activeElement;
  14272. if (isTabbing && currentFocusingEl) {
  14273. const container = currentTarget;
  14274. const [first, last] = getEdges(container);
  14275. const isTabbable = first && last;
  14276. if (!isTabbable) {
  14277. if (currentFocusingEl === container) {
  14278. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14279. focusReason: focusReason.value
  14280. });
  14281. emit("focusout-prevented", focusoutPreventedEvent);
  14282. if (!focusoutPreventedEvent.defaultPrevented) {
  14283. e.preventDefault();
  14284. }
  14285. }
  14286. } else {
  14287. if (!shiftKey && currentFocusingEl === last) {
  14288. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14289. focusReason: focusReason.value
  14290. });
  14291. emit("focusout-prevented", focusoutPreventedEvent);
  14292. if (!focusoutPreventedEvent.defaultPrevented) {
  14293. e.preventDefault();
  14294. if (loop)
  14295. tryFocus(first, true);
  14296. }
  14297. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  14298. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14299. focusReason: focusReason.value
  14300. });
  14301. emit("focusout-prevented", focusoutPreventedEvent);
  14302. if (!focusoutPreventedEvent.defaultPrevented) {
  14303. e.preventDefault();
  14304. if (loop)
  14305. tryFocus(last, true);
  14306. }
  14307. }
  14308. }
  14309. }
  14310. };
  14311. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  14312. focusTrapRef: forwardRef,
  14313. onKeydown
  14314. });
  14315. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  14316. if (focusTrapEl) {
  14317. forwardRef.value = focusTrapEl;
  14318. }
  14319. }, { immediate: true });
  14320. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  14321. if (forwardRef2) {
  14322. forwardRef2.addEventListener("keydown", onKeydown);
  14323. forwardRef2.addEventListener("focusin", onFocusIn);
  14324. forwardRef2.addEventListener("focusout", onFocusOut);
  14325. }
  14326. if (oldForwardRef) {
  14327. oldForwardRef.removeEventListener("keydown", onKeydown);
  14328. oldForwardRef.removeEventListener("focusin", onFocusIn);
  14329. oldForwardRef.removeEventListener("focusout", onFocusOut);
  14330. }
  14331. });
  14332. const trapOnFocus = (e) => {
  14333. emit(ON_TRAP_FOCUS_EVT, e);
  14334. };
  14335. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  14336. const onFocusIn = (e) => {
  14337. const trapContainer = vue.unref(forwardRef);
  14338. if (!trapContainer)
  14339. return;
  14340. const target = e.target;
  14341. const relatedTarget = e.relatedTarget;
  14342. const isFocusedInTrap = target && trapContainer.contains(target);
  14343. if (!props.trapped) {
  14344. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  14345. if (!isPrevFocusedInTrap) {
  14346. lastFocusBeforeTrapped = relatedTarget;
  14347. }
  14348. }
  14349. if (isFocusedInTrap)
  14350. emit("focusin", e);
  14351. if (focusLayer.paused)
  14352. return;
  14353. if (props.trapped) {
  14354. if (isFocusedInTrap) {
  14355. lastFocusAfterTrapped = target;
  14356. } else {
  14357. tryFocus(lastFocusAfterTrapped, true);
  14358. }
  14359. }
  14360. };
  14361. const onFocusOut = (e) => {
  14362. const trapContainer = vue.unref(forwardRef);
  14363. if (focusLayer.paused || !trapContainer)
  14364. return;
  14365. if (props.trapped) {
  14366. const relatedTarget = e.relatedTarget;
  14367. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  14368. setTimeout(() => {
  14369. if (!focusLayer.paused && props.trapped) {
  14370. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14371. focusReason: focusReason.value
  14372. });
  14373. emit("focusout-prevented", focusoutPreventedEvent);
  14374. if (!focusoutPreventedEvent.defaultPrevented) {
  14375. tryFocus(lastFocusAfterTrapped, true);
  14376. }
  14377. }
  14378. }, 0);
  14379. }
  14380. } else {
  14381. const target = e.target;
  14382. const isFocusedInTrap = target && trapContainer.contains(target);
  14383. if (!isFocusedInTrap)
  14384. emit("focusout", e);
  14385. }
  14386. };
  14387. async function startTrap() {
  14388. await vue.nextTick();
  14389. const trapContainer = vue.unref(forwardRef);
  14390. if (trapContainer) {
  14391. focusableStack.push(focusLayer);
  14392. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  14393. lastFocusBeforeTrapped = prevFocusedElement;
  14394. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  14395. if (!isPrevFocusContained) {
  14396. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  14397. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14398. trapContainer.dispatchEvent(focusEvent);
  14399. if (!focusEvent.defaultPrevented) {
  14400. vue.nextTick(() => {
  14401. let focusStartEl = props.focusStartEl;
  14402. if (!isString$1(focusStartEl)) {
  14403. tryFocus(focusStartEl);
  14404. if (document.activeElement !== focusStartEl) {
  14405. focusStartEl = "first";
  14406. }
  14407. }
  14408. if (focusStartEl === "first") {
  14409. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  14410. }
  14411. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  14412. tryFocus(trapContainer);
  14413. }
  14414. });
  14415. }
  14416. }
  14417. }
  14418. }
  14419. function stopTrap() {
  14420. const trapContainer = vue.unref(forwardRef);
  14421. if (trapContainer) {
  14422. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14423. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  14424. ...FOCUS_AFTER_TRAPPED_OPTS,
  14425. detail: {
  14426. focusReason: focusReason.value
  14427. }
  14428. });
  14429. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14430. trapContainer.dispatchEvent(releasedEvent);
  14431. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  14432. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  14433. }
  14434. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14435. focusableStack.remove(focusLayer);
  14436. }
  14437. }
  14438. vue.onMounted(() => {
  14439. if (props.trapped) {
  14440. startTrap();
  14441. }
  14442. vue.watch(() => props.trapped, (trapped) => {
  14443. if (trapped) {
  14444. startTrap();
  14445. } else {
  14446. stopTrap();
  14447. }
  14448. });
  14449. });
  14450. vue.onBeforeUnmount(() => {
  14451. if (props.trapped) {
  14452. stopTrap();
  14453. }
  14454. if (forwardRef.value) {
  14455. forwardRef.value.removeEventListener("keydown", onKeydown);
  14456. forwardRef.value.removeEventListener("focusin", onFocusIn);
  14457. forwardRef.value.removeEventListener("focusout", onFocusOut);
  14458. forwardRef.value = void 0;
  14459. }
  14460. });
  14461. return {
  14462. onKeydown
  14463. };
  14464. }
  14465. });
  14466. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  14467. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  14468. }
  14469. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["render", _sfc_render$u], ["__file", "focus-trap.vue"]]);
  14470. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  14471. const popperCoreConfigProps = buildProps({
  14472. boundariesPadding: {
  14473. type: Number,
  14474. default: 0
  14475. },
  14476. fallbackPlacements: {
  14477. type: definePropType(Array),
  14478. default: void 0
  14479. },
  14480. gpuAcceleration: {
  14481. type: Boolean,
  14482. default: true
  14483. },
  14484. offset: {
  14485. type: Number,
  14486. default: 12
  14487. },
  14488. placement: {
  14489. type: String,
  14490. values: Ee,
  14491. default: "bottom"
  14492. },
  14493. popperOptions: {
  14494. type: definePropType(Object),
  14495. default: () => ({})
  14496. },
  14497. strategy: {
  14498. type: String,
  14499. values: POSITIONING_STRATEGIES,
  14500. default: "absolute"
  14501. }
  14502. });
  14503. const popperContentProps = buildProps({
  14504. ...popperCoreConfigProps,
  14505. id: String,
  14506. style: {
  14507. type: definePropType([String, Array, Object])
  14508. },
  14509. className: {
  14510. type: definePropType([String, Array, Object])
  14511. },
  14512. effect: {
  14513. type: definePropType(String),
  14514. default: "dark"
  14515. },
  14516. visible: Boolean,
  14517. enterable: {
  14518. type: Boolean,
  14519. default: true
  14520. },
  14521. pure: Boolean,
  14522. focusOnShow: {
  14523. type: Boolean,
  14524. default: false
  14525. },
  14526. trapping: {
  14527. type: Boolean,
  14528. default: false
  14529. },
  14530. popperClass: {
  14531. type: definePropType([String, Array, Object])
  14532. },
  14533. popperStyle: {
  14534. type: definePropType([String, Array, Object])
  14535. },
  14536. referenceEl: {
  14537. type: definePropType(Object)
  14538. },
  14539. triggerTargetEl: {
  14540. type: definePropType(Object)
  14541. },
  14542. stopPopperMouseEvent: {
  14543. type: Boolean,
  14544. default: true
  14545. },
  14546. virtualTriggering: Boolean,
  14547. zIndex: Number,
  14548. ...useAriaProps(["ariaLabel"])
  14549. });
  14550. const popperContentEmits = {
  14551. mouseenter: (evt) => evt instanceof MouseEvent,
  14552. mouseleave: (evt) => evt instanceof MouseEvent,
  14553. focus: () => true,
  14554. blur: () => true,
  14555. close: () => true
  14556. };
  14557. const usePopperCoreConfigProps = popperCoreConfigProps;
  14558. const usePopperContentProps = popperContentProps;
  14559. const usePopperContentEmits = popperContentEmits;
  14560. const buildPopperOptions = (props, modifiers = []) => {
  14561. const { placement, strategy, popperOptions } = props;
  14562. const options = {
  14563. placement,
  14564. strategy,
  14565. ...popperOptions,
  14566. modifiers: [...genModifiers(props), ...modifiers]
  14567. };
  14568. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  14569. return options;
  14570. };
  14571. const unwrapMeasurableEl = ($el) => {
  14572. if (!isClient)
  14573. return;
  14574. return unrefElement($el);
  14575. };
  14576. function genModifiers(options) {
  14577. const { offset, gpuAcceleration, fallbackPlacements } = options;
  14578. return [
  14579. {
  14580. name: "offset",
  14581. options: {
  14582. offset: [0, offset != null ? offset : 12]
  14583. }
  14584. },
  14585. {
  14586. name: "preventOverflow",
  14587. options: {
  14588. padding: {
  14589. top: 2,
  14590. bottom: 2,
  14591. left: 5,
  14592. right: 5
  14593. }
  14594. }
  14595. },
  14596. {
  14597. name: "flip",
  14598. options: {
  14599. padding: 5,
  14600. fallbackPlacements
  14601. }
  14602. },
  14603. {
  14604. name: "computeStyles",
  14605. options: {
  14606. gpuAcceleration
  14607. }
  14608. }
  14609. ];
  14610. }
  14611. function deriveExtraModifiers(options, modifiers) {
  14612. if (modifiers) {
  14613. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  14614. }
  14615. }
  14616. const DEFAULT_ARROW_OFFSET = 0;
  14617. const usePopperContent = (props) => {
  14618. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  14619. const arrowRef = vue.ref();
  14620. const arrowOffset = vue.ref();
  14621. const eventListenerModifier = vue.computed(() => {
  14622. return {
  14623. name: "eventListeners",
  14624. enabled: !!props.visible
  14625. };
  14626. });
  14627. const arrowModifier = vue.computed(() => {
  14628. var _a;
  14629. const arrowEl = vue.unref(arrowRef);
  14630. const offset = (_a = vue.unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  14631. return {
  14632. name: "arrow",
  14633. enabled: !isUndefined$1(arrowEl),
  14634. options: {
  14635. element: arrowEl,
  14636. padding: offset
  14637. }
  14638. };
  14639. });
  14640. const options = vue.computed(() => {
  14641. return {
  14642. onFirstUpdate: () => {
  14643. update();
  14644. },
  14645. ...buildPopperOptions(props, [
  14646. vue.unref(arrowModifier),
  14647. vue.unref(eventListenerModifier)
  14648. ])
  14649. };
  14650. });
  14651. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  14652. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  14653. vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  14654. vue.onMounted(() => {
  14655. vue.watch(() => {
  14656. var _a;
  14657. return (_a = vue.unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
  14658. }, () => {
  14659. update();
  14660. });
  14661. });
  14662. return {
  14663. attributes,
  14664. arrowRef,
  14665. contentRef,
  14666. instanceRef,
  14667. state,
  14668. styles,
  14669. role,
  14670. forceUpdate,
  14671. update
  14672. };
  14673. };
  14674. const usePopperContentDOM = (props, {
  14675. attributes,
  14676. styles,
  14677. role
  14678. }) => {
  14679. const { nextZIndex } = useZIndex();
  14680. const ns = useNamespace("popper");
  14681. const contentAttrs = vue.computed(() => vue.unref(attributes).popper);
  14682. const contentZIndex = vue.ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  14683. const contentClass = vue.computed(() => [
  14684. ns.b(),
  14685. ns.is("pure", props.pure),
  14686. ns.is(props.effect),
  14687. props.popperClass
  14688. ]);
  14689. const contentStyle = vue.computed(() => {
  14690. return [
  14691. { zIndex: vue.unref(contentZIndex) },
  14692. vue.unref(styles).popper,
  14693. props.popperStyle || {}
  14694. ];
  14695. });
  14696. const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0);
  14697. const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {});
  14698. const updateZIndex = () => {
  14699. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  14700. };
  14701. return {
  14702. ariaModal,
  14703. arrowStyle,
  14704. contentAttrs,
  14705. contentClass,
  14706. contentStyle,
  14707. contentZIndex,
  14708. updateZIndex
  14709. };
  14710. };
  14711. const usePopperContentFocusTrap = (props, emit) => {
  14712. const trapped = vue.ref(false);
  14713. const focusStartRef = vue.ref();
  14714. const onFocusAfterTrapped = () => {
  14715. emit("focus");
  14716. };
  14717. const onFocusAfterReleased = (event) => {
  14718. var _a;
  14719. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  14720. focusStartRef.value = "first";
  14721. emit("blur");
  14722. }
  14723. };
  14724. const onFocusInTrap = (event) => {
  14725. if (props.visible && !trapped.value) {
  14726. if (event.target) {
  14727. focusStartRef.value = event.target;
  14728. }
  14729. trapped.value = true;
  14730. }
  14731. };
  14732. const onFocusoutPrevented = (event) => {
  14733. if (!props.trapping) {
  14734. if (event.detail.focusReason === "pointer") {
  14735. event.preventDefault();
  14736. }
  14737. trapped.value = false;
  14738. }
  14739. };
  14740. const onReleaseRequested = () => {
  14741. trapped.value = false;
  14742. emit("close");
  14743. };
  14744. return {
  14745. focusStartRef,
  14746. trapped,
  14747. onFocusAfterReleased,
  14748. onFocusAfterTrapped,
  14749. onFocusInTrap,
  14750. onFocusoutPrevented,
  14751. onReleaseRequested
  14752. };
  14753. };
  14754. const __default__$1E = vue.defineComponent({
  14755. name: "ElPopperContent"
  14756. });
  14757. const _sfc_main$2h = /* @__PURE__ */ vue.defineComponent({
  14758. ...__default__$1E,
  14759. props: popperContentProps,
  14760. emits: popperContentEmits,
  14761. setup(__props, { expose, emit }) {
  14762. const props = __props;
  14763. const {
  14764. focusStartRef,
  14765. trapped,
  14766. onFocusAfterReleased,
  14767. onFocusAfterTrapped,
  14768. onFocusInTrap,
  14769. onFocusoutPrevented,
  14770. onReleaseRequested
  14771. } = usePopperContentFocusTrap(props, emit);
  14772. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  14773. const {
  14774. ariaModal,
  14775. arrowStyle,
  14776. contentAttrs,
  14777. contentClass,
  14778. contentStyle,
  14779. updateZIndex
  14780. } = usePopperContentDOM(props, {
  14781. styles,
  14782. attributes,
  14783. role
  14784. });
  14785. const formItemContext = vue.inject(formItemContextKey, void 0);
  14786. const arrowOffset = vue.ref();
  14787. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  14788. arrowStyle,
  14789. arrowRef,
  14790. arrowOffset
  14791. });
  14792. if (formItemContext) {
  14793. vue.provide(formItemContextKey, {
  14794. ...formItemContext,
  14795. addInputId: NOOP,
  14796. removeInputId: NOOP
  14797. });
  14798. }
  14799. let triggerTargetAriaStopWatch = void 0;
  14800. const updatePopper = (shouldUpdateZIndex = true) => {
  14801. update();
  14802. shouldUpdateZIndex && updateZIndex();
  14803. };
  14804. const togglePopperAlive = () => {
  14805. updatePopper(false);
  14806. if (props.visible && props.focusOnShow) {
  14807. trapped.value = true;
  14808. } else if (props.visible === false) {
  14809. trapped.value = false;
  14810. }
  14811. };
  14812. vue.onMounted(() => {
  14813. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  14814. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14815. triggerTargetAriaStopWatch = void 0;
  14816. const el = vue.unref(triggerTargetEl || contentRef.value);
  14817. const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value);
  14818. if (isElement$1(el)) {
  14819. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  14820. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  14821. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14822. });
  14823. }, { immediate: true });
  14824. }
  14825. if (prevEl !== el && isElement$1(prevEl)) {
  14826. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  14827. prevEl.removeAttribute(key);
  14828. });
  14829. }
  14830. }, { immediate: true });
  14831. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  14832. });
  14833. vue.onBeforeUnmount(() => {
  14834. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14835. triggerTargetAriaStopWatch = void 0;
  14836. });
  14837. expose({
  14838. popperContentRef: contentRef,
  14839. popperInstanceRef: instanceRef,
  14840. updatePopper,
  14841. contentStyle
  14842. });
  14843. return (_ctx, _cache) => {
  14844. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  14845. ref_key: "contentRef",
  14846. ref: contentRef
  14847. }, vue.unref(contentAttrs), {
  14848. style: vue.unref(contentStyle),
  14849. class: vue.unref(contentClass),
  14850. tabindex: "-1",
  14851. onMouseenter: (e) => _ctx.$emit("mouseenter", e),
  14852. onMouseleave: (e) => _ctx.$emit("mouseleave", e)
  14853. }), [
  14854. vue.createVNode(vue.unref(ElFocusTrap), {
  14855. trapped: vue.unref(trapped),
  14856. "trap-on-focus-in": true,
  14857. "focus-trap-el": vue.unref(contentRef),
  14858. "focus-start-el": vue.unref(focusStartRef),
  14859. onFocusAfterTrapped: vue.unref(onFocusAfterTrapped),
  14860. onFocusAfterReleased: vue.unref(onFocusAfterReleased),
  14861. onFocusin: vue.unref(onFocusInTrap),
  14862. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  14863. onReleaseRequested: vue.unref(onReleaseRequested)
  14864. }, {
  14865. default: vue.withCtx(() => [
  14866. vue.renderSlot(_ctx.$slots, "default")
  14867. ]),
  14868. _: 3
  14869. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  14870. ], 16, ["onMouseenter", "onMouseleave"]);
  14871. };
  14872. }
  14873. });
  14874. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "content.vue"]]);
  14875. const ElPopper = withInstall(Popper);
  14876. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  14877. const useTooltipContentProps = buildProps({
  14878. ...useDelayedToggleProps,
  14879. ...popperContentProps,
  14880. appendTo: {
  14881. type: definePropType([String, Object])
  14882. },
  14883. content: {
  14884. type: String,
  14885. default: ""
  14886. },
  14887. rawContent: Boolean,
  14888. persistent: Boolean,
  14889. visible: {
  14890. type: definePropType(Boolean),
  14891. default: null
  14892. },
  14893. transition: String,
  14894. teleported: {
  14895. type: Boolean,
  14896. default: true
  14897. },
  14898. disabled: Boolean,
  14899. ...useAriaProps(["ariaLabel"])
  14900. });
  14901. const useTooltipTriggerProps = buildProps({
  14902. ...popperTriggerProps,
  14903. disabled: Boolean,
  14904. trigger: {
  14905. type: definePropType([String, Array]),
  14906. default: "hover"
  14907. },
  14908. triggerKeys: {
  14909. type: definePropType(Array),
  14910. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  14911. }
  14912. });
  14913. const {
  14914. useModelToggleProps: useTooltipModelToggleProps,
  14915. useModelToggleEmits: useTooltipModelToggleEmits,
  14916. useModelToggle: useTooltipModelToggle
  14917. } = createModelToggleComposable("visible");
  14918. const useTooltipProps = buildProps({
  14919. ...popperProps,
  14920. ...useTooltipModelToggleProps,
  14921. ...useTooltipContentProps,
  14922. ...useTooltipTriggerProps,
  14923. ...popperArrowProps,
  14924. showArrow: {
  14925. type: Boolean,
  14926. default: true
  14927. }
  14928. });
  14929. const tooltipEmits = [
  14930. ...useTooltipModelToggleEmits,
  14931. "before-show",
  14932. "before-hide",
  14933. "show",
  14934. "hide",
  14935. "open",
  14936. "close"
  14937. ];
  14938. const isTriggerType = (trigger, type) => {
  14939. if (isArray$1(trigger)) {
  14940. return trigger.includes(type);
  14941. }
  14942. return trigger === type;
  14943. };
  14944. const whenTrigger = (trigger, type, handler) => {
  14945. return (e) => {
  14946. isTriggerType(vue.unref(trigger), type) && handler(e);
  14947. };
  14948. };
  14949. const __default__$1D = vue.defineComponent({
  14950. name: "ElTooltipTrigger"
  14951. });
  14952. const _sfc_main$2g = /* @__PURE__ */ vue.defineComponent({
  14953. ...__default__$1D,
  14954. props: useTooltipTriggerProps,
  14955. setup(__props, { expose }) {
  14956. const props = __props;
  14957. const ns = useNamespace("tooltip");
  14958. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  14959. const triggerRef = vue.ref(null);
  14960. const stopWhenControlledOrDisabled = () => {
  14961. if (vue.unref(controlled) || props.disabled) {
  14962. return true;
  14963. }
  14964. };
  14965. const trigger = vue.toRef(props, "trigger");
  14966. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  14967. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  14968. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  14969. if (e.button === 0) {
  14970. onToggle(e);
  14971. }
  14972. }));
  14973. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  14974. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  14975. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  14976. e.preventDefault();
  14977. onToggle(e);
  14978. }));
  14979. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  14980. const { code } = e;
  14981. if (props.triggerKeys.includes(code)) {
  14982. e.preventDefault();
  14983. onToggle(e);
  14984. }
  14985. });
  14986. expose({
  14987. triggerRef
  14988. });
  14989. return (_ctx, _cache) => {
  14990. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  14991. id: vue.unref(id),
  14992. "virtual-ref": _ctx.virtualRef,
  14993. open: vue.unref(open),
  14994. "virtual-triggering": _ctx.virtualTriggering,
  14995. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  14996. onBlur: vue.unref(onBlur),
  14997. onClick: vue.unref(onClick),
  14998. onContextmenu: vue.unref(onContextMenu),
  14999. onFocus: vue.unref(onFocus),
  15000. onMouseenter: vue.unref(onMouseenter),
  15001. onMouseleave: vue.unref(onMouseleave),
  15002. onKeydown: vue.unref(onKeydown)
  15003. }, {
  15004. default: vue.withCtx(() => [
  15005. vue.renderSlot(_ctx.$slots, "default")
  15006. ]),
  15007. _: 3
  15008. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  15009. };
  15010. }
  15011. });
  15012. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "trigger.vue"]]);
  15013. const teleportProps = buildProps({
  15014. to: {
  15015. type: definePropType([String, Object]),
  15016. required: true
  15017. },
  15018. disabled: Boolean
  15019. });
  15020. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  15021. __name: "teleport",
  15022. props: teleportProps,
  15023. setup(__props) {
  15024. return (_ctx, _cache) => {
  15025. return _ctx.disabled ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.Teleport, {
  15026. key: 1,
  15027. to: _ctx.to
  15028. }, [
  15029. vue.renderSlot(_ctx.$slots, "default")
  15030. ], 8, ["to"]));
  15031. };
  15032. }
  15033. });
  15034. var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "teleport.vue"]]);
  15035. const ElTeleport = withInstall(Teleport);
  15036. var ElTeleport$1 = ElTeleport;
  15037. const __default__$1C = vue.defineComponent({
  15038. name: "ElTooltipContent",
  15039. inheritAttrs: false
  15040. });
  15041. const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({
  15042. ...__default__$1C,
  15043. props: useTooltipContentProps,
  15044. setup(__props, { expose }) {
  15045. const props = __props;
  15046. const { selector } = usePopperContainerId();
  15047. const ns = useNamespace("tooltip");
  15048. const contentRef = vue.ref(null);
  15049. let stopHandle;
  15050. const {
  15051. controlled,
  15052. id,
  15053. open,
  15054. trigger,
  15055. onClose,
  15056. onOpen,
  15057. onShow,
  15058. onHide,
  15059. onBeforeShow,
  15060. onBeforeHide
  15061. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  15062. const transitionClass = vue.computed(() => {
  15063. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  15064. });
  15065. const persistentRef = vue.computed(() => {
  15066. return props.persistent;
  15067. });
  15068. vue.onBeforeUnmount(() => {
  15069. stopHandle == null ? void 0 : stopHandle();
  15070. });
  15071. const shouldRender = vue.computed(() => {
  15072. return vue.unref(persistentRef) ? true : vue.unref(open);
  15073. });
  15074. const shouldShow = vue.computed(() => {
  15075. return props.disabled ? false : vue.unref(open);
  15076. });
  15077. const appendTo = vue.computed(() => {
  15078. return props.appendTo || selector.value;
  15079. });
  15080. const contentStyle = vue.computed(() => {
  15081. var _a;
  15082. return (_a = props.style) != null ? _a : {};
  15083. });
  15084. const ariaHidden = vue.computed(() => !vue.unref(open));
  15085. const onTransitionLeave = () => {
  15086. onHide();
  15087. };
  15088. const stopWhenControlled = () => {
  15089. if (vue.unref(controlled))
  15090. return true;
  15091. };
  15092. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  15093. if (props.enterable && vue.unref(trigger) === "hover") {
  15094. onOpen();
  15095. }
  15096. });
  15097. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  15098. if (vue.unref(trigger) === "hover") {
  15099. onClose();
  15100. }
  15101. });
  15102. const onBeforeEnter = () => {
  15103. var _a, _b;
  15104. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15105. onBeforeShow == null ? void 0 : onBeforeShow();
  15106. };
  15107. const onBeforeLeave = () => {
  15108. onBeforeHide == null ? void 0 : onBeforeHide();
  15109. };
  15110. const onAfterShow = () => {
  15111. onShow();
  15112. stopHandle = onClickOutside(vue.computed(() => {
  15113. var _a;
  15114. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15115. }), () => {
  15116. if (vue.unref(controlled))
  15117. return;
  15118. const $trigger = vue.unref(trigger);
  15119. if ($trigger !== "hover") {
  15120. onClose();
  15121. }
  15122. });
  15123. };
  15124. const onBlur = () => {
  15125. if (!props.virtualTriggering) {
  15126. onClose();
  15127. }
  15128. };
  15129. vue.watch(() => vue.unref(open), (val) => {
  15130. if (!val) {
  15131. stopHandle == null ? void 0 : stopHandle();
  15132. }
  15133. }, {
  15134. flush: "post"
  15135. });
  15136. vue.watch(() => props.content, () => {
  15137. var _a, _b;
  15138. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15139. });
  15140. expose({
  15141. contentRef
  15142. });
  15143. return (_ctx, _cache) => {
  15144. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  15145. disabled: !_ctx.teleported,
  15146. to: vue.unref(appendTo)
  15147. }, {
  15148. default: vue.withCtx(() => [
  15149. vue.createVNode(vue.Transition, {
  15150. name: vue.unref(transitionClass),
  15151. onAfterLeave: onTransitionLeave,
  15152. onBeforeEnter,
  15153. onAfterEnter: onAfterShow,
  15154. onBeforeLeave
  15155. }, {
  15156. default: vue.withCtx(() => [
  15157. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  15158. key: 0,
  15159. id: vue.unref(id),
  15160. ref_key: "contentRef",
  15161. ref: contentRef
  15162. }, _ctx.$attrs, {
  15163. "aria-label": _ctx.ariaLabel,
  15164. "aria-hidden": vue.unref(ariaHidden),
  15165. "boundaries-padding": _ctx.boundariesPadding,
  15166. "fallback-placements": _ctx.fallbackPlacements,
  15167. "gpu-acceleration": _ctx.gpuAcceleration,
  15168. offset: _ctx.offset,
  15169. placement: _ctx.placement,
  15170. "popper-options": _ctx.popperOptions,
  15171. strategy: _ctx.strategy,
  15172. effect: _ctx.effect,
  15173. enterable: _ctx.enterable,
  15174. pure: _ctx.pure,
  15175. "popper-class": _ctx.popperClass,
  15176. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  15177. "reference-el": _ctx.referenceEl,
  15178. "trigger-target-el": _ctx.triggerTargetEl,
  15179. visible: vue.unref(shouldShow),
  15180. "z-index": _ctx.zIndex,
  15181. onMouseenter: vue.unref(onContentEnter),
  15182. onMouseleave: vue.unref(onContentLeave),
  15183. onBlur,
  15184. onClose: vue.unref(onClose)
  15185. }), {
  15186. default: vue.withCtx(() => [
  15187. vue.renderSlot(_ctx.$slots, "default")
  15188. ]),
  15189. _: 3
  15190. }, 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"])), [
  15191. [vue.vShow, vue.unref(shouldShow)]
  15192. ]) : vue.createCommentVNode("v-if", true)
  15193. ]),
  15194. _: 3
  15195. }, 8, ["name"])
  15196. ]),
  15197. _: 3
  15198. }, 8, ["disabled", "to"]);
  15199. };
  15200. }
  15201. });
  15202. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "content.vue"]]);
  15203. const __default__$1B = vue.defineComponent({
  15204. name: "ElTooltip"
  15205. });
  15206. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  15207. ...__default__$1B,
  15208. props: useTooltipProps,
  15209. emits: tooltipEmits,
  15210. setup(__props, { expose, emit }) {
  15211. const props = __props;
  15212. usePopperContainer();
  15213. const id = useId();
  15214. const popperRef = vue.ref();
  15215. const contentRef = vue.ref();
  15216. const updatePopper = () => {
  15217. var _a;
  15218. const popperComponent = vue.unref(popperRef);
  15219. if (popperComponent) {
  15220. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  15221. }
  15222. };
  15223. const open = vue.ref(false);
  15224. const toggleReason = vue.ref();
  15225. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  15226. indicator: open,
  15227. toggleReason
  15228. });
  15229. const { onOpen, onClose } = useDelayedToggle({
  15230. showAfter: vue.toRef(props, "showAfter"),
  15231. hideAfter: vue.toRef(props, "hideAfter"),
  15232. autoClose: vue.toRef(props, "autoClose"),
  15233. open: show,
  15234. close: hide
  15235. });
  15236. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  15237. vue.provide(TOOLTIP_INJECTION_KEY, {
  15238. controlled,
  15239. id,
  15240. open: vue.readonly(open),
  15241. trigger: vue.toRef(props, "trigger"),
  15242. onOpen: (event) => {
  15243. onOpen(event);
  15244. },
  15245. onClose: (event) => {
  15246. onClose(event);
  15247. },
  15248. onToggle: (event) => {
  15249. if (vue.unref(open)) {
  15250. onClose(event);
  15251. } else {
  15252. onOpen(event);
  15253. }
  15254. },
  15255. onShow: () => {
  15256. emit("show", toggleReason.value);
  15257. },
  15258. onHide: () => {
  15259. emit("hide", toggleReason.value);
  15260. },
  15261. onBeforeShow: () => {
  15262. emit("before-show", toggleReason.value);
  15263. },
  15264. onBeforeHide: () => {
  15265. emit("before-hide", toggleReason.value);
  15266. },
  15267. updatePopper
  15268. });
  15269. vue.watch(() => props.disabled, (disabled) => {
  15270. if (disabled && open.value) {
  15271. open.value = false;
  15272. }
  15273. });
  15274. const isFocusInsideContent = (event) => {
  15275. var _a, _b;
  15276. const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
  15277. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  15278. return popperContent && popperContent.contains(activeElement);
  15279. };
  15280. vue.onDeactivated(() => open.value && hide());
  15281. expose({
  15282. popperRef,
  15283. contentRef,
  15284. isFocusInsideContent,
  15285. updatePopper,
  15286. onOpen,
  15287. onClose,
  15288. hide
  15289. });
  15290. return (_ctx, _cache) => {
  15291. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  15292. ref_key: "popperRef",
  15293. ref: popperRef,
  15294. role: _ctx.role
  15295. }, {
  15296. default: vue.withCtx(() => [
  15297. vue.createVNode(ElTooltipTrigger, {
  15298. disabled: _ctx.disabled,
  15299. trigger: _ctx.trigger,
  15300. "trigger-keys": _ctx.triggerKeys,
  15301. "virtual-ref": _ctx.virtualRef,
  15302. "virtual-triggering": _ctx.virtualTriggering
  15303. }, {
  15304. default: vue.withCtx(() => [
  15305. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  15306. ]),
  15307. _: 3
  15308. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  15309. vue.createVNode(ElTooltipContent, {
  15310. ref_key: "contentRef",
  15311. ref: contentRef,
  15312. "aria-label": _ctx.ariaLabel,
  15313. "boundaries-padding": _ctx.boundariesPadding,
  15314. content: _ctx.content,
  15315. disabled: _ctx.disabled,
  15316. effect: _ctx.effect,
  15317. enterable: _ctx.enterable,
  15318. "fallback-placements": _ctx.fallbackPlacements,
  15319. "hide-after": _ctx.hideAfter,
  15320. "gpu-acceleration": _ctx.gpuAcceleration,
  15321. offset: _ctx.offset,
  15322. persistent: _ctx.persistent,
  15323. "popper-class": _ctx.popperClass,
  15324. "popper-style": _ctx.popperStyle,
  15325. placement: _ctx.placement,
  15326. "popper-options": _ctx.popperOptions,
  15327. pure: _ctx.pure,
  15328. "raw-content": _ctx.rawContent,
  15329. "reference-el": _ctx.referenceEl,
  15330. "trigger-target-el": _ctx.triggerTargetEl,
  15331. "show-after": _ctx.showAfter,
  15332. strategy: _ctx.strategy,
  15333. teleported: _ctx.teleported,
  15334. transition: _ctx.transition,
  15335. "virtual-triggering": _ctx.virtualTriggering,
  15336. "z-index": _ctx.zIndex,
  15337. "append-to": _ctx.appendTo
  15338. }, {
  15339. default: vue.withCtx(() => [
  15340. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  15341. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  15342. key: 0,
  15343. innerHTML: _ctx.content
  15344. }, null, 8, ["innerHTML"])) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.content), 1))
  15345. ]),
  15346. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  15347. key: 0,
  15348. "arrow-offset": _ctx.arrowOffset
  15349. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  15350. ]),
  15351. _: 3
  15352. }, 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"])
  15353. ]),
  15354. _: 3
  15355. }, 8, ["role"]);
  15356. };
  15357. }
  15358. });
  15359. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "tooltip.vue"]]);
  15360. const ElTooltip = withInstall(Tooltip);
  15361. const autocompleteProps = buildProps({
  15362. valueKey: {
  15363. type: String,
  15364. default: "value"
  15365. },
  15366. modelValue: {
  15367. type: [String, Number],
  15368. default: ""
  15369. },
  15370. debounce: {
  15371. type: Number,
  15372. default: 300
  15373. },
  15374. placement: {
  15375. type: definePropType(String),
  15376. values: [
  15377. "top",
  15378. "top-start",
  15379. "top-end",
  15380. "bottom",
  15381. "bottom-start",
  15382. "bottom-end"
  15383. ],
  15384. default: "bottom-start"
  15385. },
  15386. fetchSuggestions: {
  15387. type: definePropType([Function, Array]),
  15388. default: NOOP
  15389. },
  15390. popperClass: {
  15391. type: String,
  15392. default: ""
  15393. },
  15394. triggerOnFocus: {
  15395. type: Boolean,
  15396. default: true
  15397. },
  15398. selectWhenUnmatched: {
  15399. type: Boolean,
  15400. default: false
  15401. },
  15402. hideLoading: {
  15403. type: Boolean,
  15404. default: false
  15405. },
  15406. teleported: useTooltipContentProps.teleported,
  15407. highlightFirstItem: {
  15408. type: Boolean,
  15409. default: false
  15410. },
  15411. fitInputWidth: {
  15412. type: Boolean,
  15413. default: false
  15414. },
  15415. clearable: {
  15416. type: Boolean,
  15417. default: false
  15418. },
  15419. disabled: {
  15420. type: Boolean,
  15421. default: false
  15422. },
  15423. name: String,
  15424. ...useAriaProps(["ariaLabel"])
  15425. });
  15426. const autocompleteEmits = {
  15427. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  15428. [INPUT_EVENT]: (value) => isString$1(value),
  15429. [CHANGE_EVENT]: (value) => isString$1(value),
  15430. focus: (evt) => evt instanceof FocusEvent,
  15431. blur: (evt) => evt instanceof FocusEvent,
  15432. clear: () => true,
  15433. select: (item) => isObject$1(item)
  15434. };
  15435. const COMPONENT_NAME$i = "ElAutocomplete";
  15436. const __default__$1A = vue.defineComponent({
  15437. name: COMPONENT_NAME$i,
  15438. inheritAttrs: false
  15439. });
  15440. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  15441. ...__default__$1A,
  15442. props: autocompleteProps,
  15443. emits: autocompleteEmits,
  15444. setup(__props, { expose, emit }) {
  15445. const props = __props;
  15446. const attrs = useAttrs();
  15447. const rawAttrs = vue.useAttrs();
  15448. const disabled = useFormDisabled();
  15449. const ns = useNamespace("autocomplete");
  15450. const inputRef = vue.ref();
  15451. const regionRef = vue.ref();
  15452. const popperRef = vue.ref();
  15453. const listboxRef = vue.ref();
  15454. let readonly = false;
  15455. let ignoreFocusEvent = false;
  15456. const suggestions = vue.ref([]);
  15457. const highlightedIndex = vue.ref(-1);
  15458. const dropdownWidth = vue.ref("");
  15459. const activated = vue.ref(false);
  15460. const suggestionDisabled = vue.ref(false);
  15461. const loading = vue.ref(false);
  15462. const listboxId = useId();
  15463. const styles = vue.computed(() => rawAttrs.style);
  15464. const suggestionVisible = vue.computed(() => {
  15465. const isValidData = suggestions.value.length > 0;
  15466. return (isValidData || loading.value) && activated.value;
  15467. });
  15468. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  15469. const refInput = vue.computed(() => {
  15470. if (inputRef.value) {
  15471. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15472. }
  15473. return [];
  15474. });
  15475. const onSuggestionShow = () => {
  15476. if (suggestionVisible.value) {
  15477. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  15478. }
  15479. };
  15480. const onHide = () => {
  15481. highlightedIndex.value = -1;
  15482. };
  15483. const getData = async (queryString) => {
  15484. if (suggestionDisabled.value)
  15485. return;
  15486. const cb = (suggestionList) => {
  15487. loading.value = false;
  15488. if (suggestionDisabled.value)
  15489. return;
  15490. if (isArray$1(suggestionList)) {
  15491. suggestions.value = suggestionList;
  15492. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  15493. } else {
  15494. throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array");
  15495. }
  15496. };
  15497. loading.value = true;
  15498. if (isArray$1(props.fetchSuggestions)) {
  15499. cb(props.fetchSuggestions);
  15500. } else {
  15501. const result = await props.fetchSuggestions(queryString, cb);
  15502. if (isArray$1(result))
  15503. cb(result);
  15504. }
  15505. };
  15506. const debouncedGetData = debounce(getData, props.debounce);
  15507. const handleInput = (value) => {
  15508. const valuePresented = !!value;
  15509. emit(INPUT_EVENT, value);
  15510. emit(UPDATE_MODEL_EVENT, value);
  15511. suggestionDisabled.value = false;
  15512. activated.value || (activated.value = valuePresented);
  15513. if (!props.triggerOnFocus && !value) {
  15514. suggestionDisabled.value = true;
  15515. suggestions.value = [];
  15516. return;
  15517. }
  15518. debouncedGetData(value);
  15519. };
  15520. const handleMouseDown = (event) => {
  15521. var _a;
  15522. if (disabled.value)
  15523. return;
  15524. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15525. activated.value = true;
  15526. }
  15527. };
  15528. const handleChange = (value) => {
  15529. emit(CHANGE_EVENT, value);
  15530. };
  15531. const handleFocus = (evt) => {
  15532. if (!ignoreFocusEvent) {
  15533. activated.value = true;
  15534. emit("focus", evt);
  15535. if (props.triggerOnFocus && !readonly) {
  15536. debouncedGetData(String(props.modelValue));
  15537. }
  15538. } else {
  15539. ignoreFocusEvent = false;
  15540. }
  15541. };
  15542. const handleBlur = (evt) => {
  15543. setTimeout(() => {
  15544. var _a;
  15545. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  15546. ignoreFocusEvent = true;
  15547. return;
  15548. }
  15549. activated.value && close();
  15550. emit("blur", evt);
  15551. });
  15552. };
  15553. const handleClear = () => {
  15554. activated.value = false;
  15555. emit(UPDATE_MODEL_EVENT, "");
  15556. emit("clear");
  15557. };
  15558. const handleKeyEnter = async () => {
  15559. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  15560. handleSelect(suggestions.value[highlightedIndex.value]);
  15561. } else if (props.selectWhenUnmatched) {
  15562. emit("select", { value: props.modelValue });
  15563. suggestions.value = [];
  15564. highlightedIndex.value = -1;
  15565. }
  15566. };
  15567. const handleKeyEscape = (evt) => {
  15568. if (suggestionVisible.value) {
  15569. evt.preventDefault();
  15570. evt.stopPropagation();
  15571. close();
  15572. }
  15573. };
  15574. const close = () => {
  15575. activated.value = false;
  15576. };
  15577. const focus = () => {
  15578. var _a;
  15579. (_a = inputRef.value) == null ? void 0 : _a.focus();
  15580. };
  15581. const blur = () => {
  15582. var _a;
  15583. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15584. };
  15585. const handleSelect = async (item) => {
  15586. emit(INPUT_EVENT, item[props.valueKey]);
  15587. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  15588. emit("select", item);
  15589. suggestions.value = [];
  15590. highlightedIndex.value = -1;
  15591. };
  15592. const highlight = (index) => {
  15593. if (!suggestionVisible.value || loading.value)
  15594. return;
  15595. if (index < 0) {
  15596. highlightedIndex.value = -1;
  15597. return;
  15598. }
  15599. if (index >= suggestions.value.length) {
  15600. index = suggestions.value.length - 1;
  15601. }
  15602. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15603. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  15604. const highlightItem = suggestionList[index];
  15605. const scrollTop = suggestion.scrollTop;
  15606. const { offsetTop, scrollHeight } = highlightItem;
  15607. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  15608. suggestion.scrollTop += scrollHeight;
  15609. }
  15610. if (offsetTop < scrollTop) {
  15611. suggestion.scrollTop -= scrollHeight;
  15612. }
  15613. highlightedIndex.value = index;
  15614. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15615. };
  15616. const stopHandle = onClickOutside(listboxRef, () => {
  15617. suggestionVisible.value && close();
  15618. });
  15619. vue.onBeforeUnmount(() => {
  15620. stopHandle == null ? void 0 : stopHandle();
  15621. });
  15622. vue.onMounted(() => {
  15623. inputRef.value.ref.setAttribute("role", "textbox");
  15624. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  15625. inputRef.value.ref.setAttribute("aria-controls", "id");
  15626. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15627. readonly = inputRef.value.ref.hasAttribute("readonly");
  15628. });
  15629. expose({
  15630. highlightedIndex,
  15631. activated,
  15632. loading,
  15633. inputRef,
  15634. popperRef,
  15635. suggestions,
  15636. handleSelect,
  15637. handleKeyEnter,
  15638. focus,
  15639. blur,
  15640. close,
  15641. highlight
  15642. });
  15643. return (_ctx, _cache) => {
  15644. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  15645. ref_key: "popperRef",
  15646. ref: popperRef,
  15647. visible: vue.unref(suggestionVisible),
  15648. placement: _ctx.placement,
  15649. "fallback-placements": ["bottom-start", "top-start"],
  15650. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  15651. teleported: _ctx.teleported,
  15652. "gpu-acceleration": false,
  15653. pure: "",
  15654. "manual-mode": "",
  15655. effect: "light",
  15656. trigger: "click",
  15657. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  15658. persistent: "",
  15659. role: "listbox",
  15660. onBeforeShow: onSuggestionShow,
  15661. onHide
  15662. }, {
  15663. content: vue.withCtx(() => [
  15664. vue.createElementVNode("div", {
  15665. ref_key: "regionRef",
  15666. ref: regionRef,
  15667. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  15668. style: vue.normalizeStyle({
  15669. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15670. outline: "none"
  15671. }),
  15672. role: "region"
  15673. }, [
  15674. vue.createVNode(vue.unref(ElScrollbar), {
  15675. id: vue.unref(listboxId),
  15676. tag: "ul",
  15677. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  15678. "view-class": vue.unref(ns).be("suggestion", "list"),
  15679. role: "listbox"
  15680. }, {
  15681. default: vue.withCtx(() => [
  15682. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", { key: 0 }, [
  15683. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  15684. vue.createVNode(vue.unref(ElIcon), {
  15685. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  15686. }, {
  15687. default: vue.withCtx(() => [
  15688. vue.createVNode(vue.unref(loading_default))
  15689. ]),
  15690. _: 1
  15691. }, 8, ["class"])
  15692. ])
  15693. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  15694. return vue.openBlock(), vue.createElementBlock("li", {
  15695. id: `${vue.unref(listboxId)}-item-${index}`,
  15696. key: index,
  15697. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  15698. role: "option",
  15699. "aria-selected": highlightedIndex.value === index,
  15700. onClick: ($event) => handleSelect(item)
  15701. }, [
  15702. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  15703. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  15704. ])
  15705. ], 10, ["id", "aria-selected", "onClick"]);
  15706. }), 128))
  15707. ]),
  15708. _: 3
  15709. }, 8, ["id", "wrap-class", "view-class"])
  15710. ], 6)
  15711. ]),
  15712. default: vue.withCtx(() => [
  15713. vue.createElementVNode("div", {
  15714. ref_key: "listboxRef",
  15715. ref: listboxRef,
  15716. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  15717. style: vue.normalizeStyle(vue.unref(styles)),
  15718. role: "combobox",
  15719. "aria-haspopup": "listbox",
  15720. "aria-expanded": vue.unref(suggestionVisible),
  15721. "aria-owns": vue.unref(listboxId)
  15722. }, [
  15723. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  15724. ref_key: "inputRef",
  15725. ref: inputRef
  15726. }, vue.unref(attrs), {
  15727. clearable: _ctx.clearable,
  15728. disabled: vue.unref(disabled),
  15729. name: _ctx.name,
  15730. "model-value": _ctx.modelValue,
  15731. "aria-label": _ctx.ariaLabel,
  15732. onInput: handleInput,
  15733. onChange: handleChange,
  15734. onFocus: handleFocus,
  15735. onBlur: handleBlur,
  15736. onClear: handleClear,
  15737. onKeydown: [
  15738. vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"]),
  15739. vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"]),
  15740. vue.withKeys(handleKeyEnter, ["enter"]),
  15741. vue.withKeys(close, ["tab"]),
  15742. vue.withKeys(handleKeyEscape, ["esc"])
  15743. ],
  15744. onMousedown: handleMouseDown
  15745. }), vue.createSlots({ _: 2 }, [
  15746. _ctx.$slots.prepend ? {
  15747. name: "prepend",
  15748. fn: vue.withCtx(() => [
  15749. vue.renderSlot(_ctx.$slots, "prepend")
  15750. ])
  15751. } : void 0,
  15752. _ctx.$slots.append ? {
  15753. name: "append",
  15754. fn: vue.withCtx(() => [
  15755. vue.renderSlot(_ctx.$slots, "append")
  15756. ])
  15757. } : void 0,
  15758. _ctx.$slots.prefix ? {
  15759. name: "prefix",
  15760. fn: vue.withCtx(() => [
  15761. vue.renderSlot(_ctx.$slots, "prefix")
  15762. ])
  15763. } : void 0,
  15764. _ctx.$slots.suffix ? {
  15765. name: "suffix",
  15766. fn: vue.withCtx(() => [
  15767. vue.renderSlot(_ctx.$slots, "suffix")
  15768. ])
  15769. } : void 0
  15770. ]), 1040, ["clearable", "disabled", "name", "model-value", "aria-label", "onKeydown"])
  15771. ], 14, ["aria-expanded", "aria-owns"])
  15772. ]),
  15773. _: 3
  15774. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  15775. };
  15776. }
  15777. });
  15778. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "autocomplete.vue"]]);
  15779. const ElAutocomplete = withInstall(Autocomplete);
  15780. const avatarProps = buildProps({
  15781. size: {
  15782. type: [Number, String],
  15783. values: componentSizes,
  15784. default: "",
  15785. validator: (val) => isNumber(val)
  15786. },
  15787. shape: {
  15788. type: String,
  15789. values: ["circle", "square"],
  15790. default: "circle"
  15791. },
  15792. icon: {
  15793. type: iconPropType
  15794. },
  15795. src: {
  15796. type: String,
  15797. default: ""
  15798. },
  15799. alt: String,
  15800. srcSet: String,
  15801. fit: {
  15802. type: definePropType(String),
  15803. default: "cover"
  15804. }
  15805. });
  15806. const avatarEmits = {
  15807. error: (evt) => evt instanceof Event
  15808. };
  15809. const __default__$1z = vue.defineComponent({
  15810. name: "ElAvatar"
  15811. });
  15812. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  15813. ...__default__$1z,
  15814. props: avatarProps,
  15815. emits: avatarEmits,
  15816. setup(__props, { emit }) {
  15817. const props = __props;
  15818. const ns = useNamespace("avatar");
  15819. const hasLoadError = vue.ref(false);
  15820. const avatarClass = vue.computed(() => {
  15821. const { size, icon, shape } = props;
  15822. const classList = [ns.b()];
  15823. if (isString$1(size))
  15824. classList.push(ns.m(size));
  15825. if (icon)
  15826. classList.push(ns.m("icon"));
  15827. if (shape)
  15828. classList.push(ns.m(shape));
  15829. return classList;
  15830. });
  15831. const sizeStyle = vue.computed(() => {
  15832. const { size } = props;
  15833. return isNumber(size) ? ns.cssVarBlock({
  15834. size: addUnit(size) || ""
  15835. }) : void 0;
  15836. });
  15837. const fitStyle = vue.computed(() => ({
  15838. objectFit: props.fit
  15839. }));
  15840. vue.watch(() => props.src, () => hasLoadError.value = false);
  15841. function handleError(e) {
  15842. hasLoadError.value = true;
  15843. emit("error", e);
  15844. }
  15845. return (_ctx, _cache) => {
  15846. return vue.openBlock(), vue.createElementBlock("span", {
  15847. class: vue.normalizeClass(vue.unref(avatarClass)),
  15848. style: vue.normalizeStyle(vue.unref(sizeStyle))
  15849. }, [
  15850. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  15851. key: 0,
  15852. src: _ctx.src,
  15853. alt: _ctx.alt,
  15854. srcset: _ctx.srcSet,
  15855. style: vue.normalizeStyle(vue.unref(fitStyle)),
  15856. onError: handleError
  15857. }, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  15858. default: vue.withCtx(() => [
  15859. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  15860. ]),
  15861. _: 1
  15862. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  15863. ], 6);
  15864. };
  15865. }
  15866. });
  15867. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "avatar.vue"]]);
  15868. const ElAvatar = withInstall(Avatar);
  15869. const backtopProps = {
  15870. visibilityHeight: {
  15871. type: Number,
  15872. default: 200
  15873. },
  15874. target: {
  15875. type: String,
  15876. default: ""
  15877. },
  15878. right: {
  15879. type: Number,
  15880. default: 40
  15881. },
  15882. bottom: {
  15883. type: Number,
  15884. default: 40
  15885. }
  15886. };
  15887. const backtopEmits = {
  15888. click: (evt) => evt instanceof MouseEvent
  15889. };
  15890. const useBackTop = (props, emit, componentName) => {
  15891. const el = vue.shallowRef();
  15892. const container = vue.shallowRef();
  15893. const visible = vue.ref(false);
  15894. const handleScroll = () => {
  15895. if (el.value)
  15896. visible.value = el.value.scrollTop >= props.visibilityHeight;
  15897. };
  15898. const handleClick = (event) => {
  15899. var _a;
  15900. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  15901. emit("click", event);
  15902. };
  15903. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  15904. useEventListener(container, "scroll", handleScrollThrottled);
  15905. vue.onMounted(() => {
  15906. var _a;
  15907. container.value = document;
  15908. el.value = document.documentElement;
  15909. if (props.target) {
  15910. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  15911. if (!el.value) {
  15912. throwError(componentName, `target does not exist: ${props.target}`);
  15913. }
  15914. container.value = el.value;
  15915. }
  15916. handleScroll();
  15917. });
  15918. return {
  15919. visible,
  15920. handleClick
  15921. };
  15922. };
  15923. const COMPONENT_NAME$h = "ElBacktop";
  15924. const __default__$1y = vue.defineComponent({
  15925. name: COMPONENT_NAME$h
  15926. });
  15927. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  15928. ...__default__$1y,
  15929. props: backtopProps,
  15930. emits: backtopEmits,
  15931. setup(__props, { emit }) {
  15932. const props = __props;
  15933. const ns = useNamespace("backtop");
  15934. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$h);
  15935. const backTopStyle = vue.computed(() => ({
  15936. right: `${props.right}px`,
  15937. bottom: `${props.bottom}px`
  15938. }));
  15939. return (_ctx, _cache) => {
  15940. return vue.openBlock(), vue.createBlock(vue.Transition, {
  15941. name: `${vue.unref(ns).namespace.value}-fade-in`
  15942. }, {
  15943. default: vue.withCtx(() => [
  15944. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  15945. key: 0,
  15946. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  15947. class: vue.normalizeClass(vue.unref(ns).b()),
  15948. onClick: vue.withModifiers(vue.unref(handleClick), ["stop"])
  15949. }, [
  15950. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  15951. vue.createVNode(vue.unref(ElIcon), {
  15952. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  15953. }, {
  15954. default: vue.withCtx(() => [
  15955. vue.createVNode(vue.unref(caret_top_default))
  15956. ]),
  15957. _: 1
  15958. }, 8, ["class"])
  15959. ])
  15960. ], 14, ["onClick"])) : vue.createCommentVNode("v-if", true)
  15961. ]),
  15962. _: 3
  15963. }, 8, ["name"]);
  15964. };
  15965. }
  15966. });
  15967. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "backtop.vue"]]);
  15968. const ElBacktop = withInstall(Backtop);
  15969. const badgeProps = buildProps({
  15970. value: {
  15971. type: [String, Number],
  15972. default: ""
  15973. },
  15974. max: {
  15975. type: Number,
  15976. default: 99
  15977. },
  15978. isDot: Boolean,
  15979. hidden: Boolean,
  15980. type: {
  15981. type: String,
  15982. values: ["primary", "success", "warning", "info", "danger"],
  15983. default: "danger"
  15984. },
  15985. showZero: {
  15986. type: Boolean,
  15987. default: true
  15988. },
  15989. color: String,
  15990. badgeStyle: {
  15991. type: definePropType([String, Object, Array])
  15992. },
  15993. offset: {
  15994. type: definePropType(Array),
  15995. default: [0, 0]
  15996. },
  15997. badgeClass: {
  15998. type: String
  15999. }
  16000. });
  16001. const __default__$1x = vue.defineComponent({
  16002. name: "ElBadge"
  16003. });
  16004. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  16005. ...__default__$1x,
  16006. props: badgeProps,
  16007. setup(__props, { expose }) {
  16008. const props = __props;
  16009. const ns = useNamespace("badge");
  16010. const content = vue.computed(() => {
  16011. if (props.isDot)
  16012. return "";
  16013. if (isNumber(props.value) && isNumber(props.max)) {
  16014. if (props.max < props.value) {
  16015. return `${props.max}+`;
  16016. }
  16017. return props.value === 0 && !props.showZero ? "" : `${props.value}`;
  16018. }
  16019. return `${props.value}`;
  16020. });
  16021. const style = vue.computed(() => {
  16022. var _a, _b, _c, _d, _e;
  16023. return [
  16024. {
  16025. backgroundColor: props.color,
  16026. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  16027. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  16028. },
  16029. (_e = props.badgeStyle) != null ? _e : {}
  16030. ];
  16031. });
  16032. expose({
  16033. content
  16034. });
  16035. return (_ctx, _cache) => {
  16036. return vue.openBlock(), vue.createElementBlock("div", {
  16037. class: vue.normalizeClass(vue.unref(ns).b())
  16038. }, [
  16039. vue.renderSlot(_ctx.$slots, "default"),
  16040. vue.createVNode(vue.Transition, {
  16041. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  16042. persisted: ""
  16043. }, {
  16044. default: vue.withCtx(() => [
  16045. vue.withDirectives(vue.createElementVNode("sup", {
  16046. class: vue.normalizeClass([
  16047. vue.unref(ns).e("content"),
  16048. vue.unref(ns).em("content", _ctx.type),
  16049. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  16050. vue.unref(ns).is("dot", _ctx.isDot),
  16051. _ctx.badgeClass
  16052. ]),
  16053. style: vue.normalizeStyle(vue.unref(style)),
  16054. textContent: vue.toDisplayString(vue.unref(content))
  16055. }, null, 14, ["textContent"]), [
  16056. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)]
  16057. ])
  16058. ]),
  16059. _: 1
  16060. }, 8, ["name"])
  16061. ], 2);
  16062. };
  16063. }
  16064. });
  16065. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "badge.vue"]]);
  16066. const ElBadge = withInstall(Badge);
  16067. const breadcrumbKey = Symbol("breadcrumbKey");
  16068. const breadcrumbProps = buildProps({
  16069. separator: {
  16070. type: String,
  16071. default: "/"
  16072. },
  16073. separatorIcon: {
  16074. type: iconPropType
  16075. }
  16076. });
  16077. const __default__$1w = vue.defineComponent({
  16078. name: "ElBreadcrumb"
  16079. });
  16080. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  16081. ...__default__$1w,
  16082. props: breadcrumbProps,
  16083. setup(__props) {
  16084. const props = __props;
  16085. const { t } = useLocale();
  16086. const ns = useNamespace("breadcrumb");
  16087. const breadcrumb = vue.ref();
  16088. vue.provide(breadcrumbKey, props);
  16089. vue.onMounted(() => {
  16090. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  16091. if (items.length) {
  16092. items[items.length - 1].setAttribute("aria-current", "page");
  16093. }
  16094. });
  16095. return (_ctx, _cache) => {
  16096. return vue.openBlock(), vue.createElementBlock("div", {
  16097. ref_key: "breadcrumb",
  16098. ref: breadcrumb,
  16099. class: vue.normalizeClass(vue.unref(ns).b()),
  16100. "aria-label": vue.unref(t)("el.breadcrumb.label"),
  16101. role: "navigation"
  16102. }, [
  16103. vue.renderSlot(_ctx.$slots, "default")
  16104. ], 10, ["aria-label"]);
  16105. };
  16106. }
  16107. });
  16108. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "breadcrumb.vue"]]);
  16109. const breadcrumbItemProps = buildProps({
  16110. to: {
  16111. type: definePropType([String, Object]),
  16112. default: ""
  16113. },
  16114. replace: Boolean
  16115. });
  16116. const __default__$1v = vue.defineComponent({
  16117. name: "ElBreadcrumbItem"
  16118. });
  16119. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  16120. ...__default__$1v,
  16121. props: breadcrumbItemProps,
  16122. setup(__props) {
  16123. const props = __props;
  16124. const instance = vue.getCurrentInstance();
  16125. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  16126. const ns = useNamespace("breadcrumb");
  16127. const router = instance.appContext.config.globalProperties.$router;
  16128. const link = vue.ref();
  16129. const onClick = () => {
  16130. if (!props.to || !router)
  16131. return;
  16132. props.replace ? router.replace(props.to) : router.push(props.to);
  16133. };
  16134. return (_ctx, _cache) => {
  16135. var _a, _b;
  16136. return vue.openBlock(), vue.createElementBlock("span", {
  16137. class: vue.normalizeClass(vue.unref(ns).e("item"))
  16138. }, [
  16139. vue.createElementVNode("span", {
  16140. ref_key: "link",
  16141. ref: link,
  16142. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  16143. role: "link",
  16144. onClick
  16145. }, [
  16146. vue.renderSlot(_ctx.$slots, "default")
  16147. ], 2),
  16148. ((_a = vue.unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16149. key: 0,
  16150. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  16151. }, {
  16152. default: vue.withCtx(() => [
  16153. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(breadcrumbContext).separatorIcon)))
  16154. ]),
  16155. _: 1
  16156. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  16157. key: 1,
  16158. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  16159. role: "presentation"
  16160. }, vue.toDisplayString((_b = vue.unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  16161. ], 2);
  16162. };
  16163. }
  16164. });
  16165. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "breadcrumb-item.vue"]]);
  16166. const ElBreadcrumb = withInstall(Breadcrumb, {
  16167. BreadcrumbItem
  16168. });
  16169. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  16170. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  16171. const useButton = (props, emit) => {
  16172. useDeprecated({
  16173. from: "type.text",
  16174. replacement: "link",
  16175. version: "3.0.0",
  16176. scope: "props",
  16177. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  16178. }, vue.computed(() => props.type === "text"));
  16179. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  16180. const globalConfig = useGlobalConfig("button");
  16181. const { form } = useFormItem();
  16182. const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  16183. const _disabled = useFormDisabled();
  16184. const _ref = vue.ref();
  16185. const slots = vue.useSlots();
  16186. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  16187. const autoInsertSpace = vue.computed(() => {
  16188. var _a, _b, _c;
  16189. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  16190. });
  16191. const _props = vue.computed(() => {
  16192. if (props.tag === "button") {
  16193. return {
  16194. ariaDisabled: _disabled.value || props.loading,
  16195. disabled: _disabled.value || props.loading,
  16196. autofocus: props.autofocus,
  16197. type: props.nativeType
  16198. };
  16199. }
  16200. return {};
  16201. });
  16202. const shouldAddSpace = vue.computed(() => {
  16203. var _a;
  16204. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  16205. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  16206. const slot = defaultSlot[0];
  16207. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  16208. const text = slot.children;
  16209. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  16210. }
  16211. }
  16212. return false;
  16213. });
  16214. const handleClick = (evt) => {
  16215. if (_disabled.value || props.loading) {
  16216. evt.stopPropagation();
  16217. return;
  16218. }
  16219. if (props.nativeType === "reset") {
  16220. form == null ? void 0 : form.resetFields();
  16221. }
  16222. emit("click", evt);
  16223. };
  16224. return {
  16225. _disabled,
  16226. _size,
  16227. _type,
  16228. _ref,
  16229. _props,
  16230. shouldAddSpace,
  16231. handleClick
  16232. };
  16233. };
  16234. const buttonTypes = [
  16235. "default",
  16236. "primary",
  16237. "success",
  16238. "warning",
  16239. "info",
  16240. "danger",
  16241. "text",
  16242. ""
  16243. ];
  16244. const buttonNativeTypes = ["button", "submit", "reset"];
  16245. const buttonProps = buildProps({
  16246. size: useSizeProp,
  16247. disabled: Boolean,
  16248. type: {
  16249. type: String,
  16250. values: buttonTypes,
  16251. default: ""
  16252. },
  16253. icon: {
  16254. type: iconPropType
  16255. },
  16256. nativeType: {
  16257. type: String,
  16258. values: buttonNativeTypes,
  16259. default: "button"
  16260. },
  16261. loading: Boolean,
  16262. loadingIcon: {
  16263. type: iconPropType,
  16264. default: () => loading_default
  16265. },
  16266. plain: Boolean,
  16267. text: Boolean,
  16268. link: Boolean,
  16269. bg: Boolean,
  16270. autofocus: Boolean,
  16271. round: Boolean,
  16272. circle: Boolean,
  16273. color: String,
  16274. dark: Boolean,
  16275. autoInsertSpace: {
  16276. type: Boolean,
  16277. default: void 0
  16278. },
  16279. tag: {
  16280. type: definePropType([String, Object]),
  16281. default: "button"
  16282. }
  16283. });
  16284. const buttonEmits = {
  16285. click: (evt) => evt instanceof MouseEvent
  16286. };
  16287. function bound01$1(n, max) {
  16288. if (isOnePointZero$1(n)) {
  16289. n = "100%";
  16290. }
  16291. var isPercent = isPercentage$1(n);
  16292. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  16293. if (isPercent) {
  16294. n = parseInt(String(n * max), 10) / 100;
  16295. }
  16296. if (Math.abs(n - max) < 1e-6) {
  16297. return 1;
  16298. }
  16299. if (max === 360) {
  16300. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  16301. } else {
  16302. n = n % max / parseFloat(String(max));
  16303. }
  16304. return n;
  16305. }
  16306. function clamp01(val) {
  16307. return Math.min(1, Math.max(0, val));
  16308. }
  16309. function isOnePointZero$1(n) {
  16310. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  16311. }
  16312. function isPercentage$1(n) {
  16313. return typeof n === "string" && n.indexOf("%") !== -1;
  16314. }
  16315. function boundAlpha(a) {
  16316. a = parseFloat(a);
  16317. if (isNaN(a) || a < 0 || a > 1) {
  16318. a = 1;
  16319. }
  16320. return a;
  16321. }
  16322. function convertToPercentage(n) {
  16323. if (n <= 1) {
  16324. return "".concat(Number(n) * 100, "%");
  16325. }
  16326. return n;
  16327. }
  16328. function pad2(c) {
  16329. return c.length === 1 ? "0" + c : String(c);
  16330. }
  16331. function rgbToRgb(r, g, b) {
  16332. return {
  16333. r: bound01$1(r, 255) * 255,
  16334. g: bound01$1(g, 255) * 255,
  16335. b: bound01$1(b, 255) * 255
  16336. };
  16337. }
  16338. function rgbToHsl(r, g, b) {
  16339. r = bound01$1(r, 255);
  16340. g = bound01$1(g, 255);
  16341. b = bound01$1(b, 255);
  16342. var max = Math.max(r, g, b);
  16343. var min = Math.min(r, g, b);
  16344. var h = 0;
  16345. var s = 0;
  16346. var l = (max + min) / 2;
  16347. if (max === min) {
  16348. s = 0;
  16349. h = 0;
  16350. } else {
  16351. var d = max - min;
  16352. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  16353. switch (max) {
  16354. case r:
  16355. h = (g - b) / d + (g < b ? 6 : 0);
  16356. break;
  16357. case g:
  16358. h = (b - r) / d + 2;
  16359. break;
  16360. case b:
  16361. h = (r - g) / d + 4;
  16362. break;
  16363. }
  16364. h /= 6;
  16365. }
  16366. return { h, s, l };
  16367. }
  16368. function hue2rgb(p, q, t) {
  16369. if (t < 0) {
  16370. t += 1;
  16371. }
  16372. if (t > 1) {
  16373. t -= 1;
  16374. }
  16375. if (t < 1 / 6) {
  16376. return p + (q - p) * (6 * t);
  16377. }
  16378. if (t < 1 / 2) {
  16379. return q;
  16380. }
  16381. if (t < 2 / 3) {
  16382. return p + (q - p) * (2 / 3 - t) * 6;
  16383. }
  16384. return p;
  16385. }
  16386. function hslToRgb(h, s, l) {
  16387. var r;
  16388. var g;
  16389. var b;
  16390. h = bound01$1(h, 360);
  16391. s = bound01$1(s, 100);
  16392. l = bound01$1(l, 100);
  16393. if (s === 0) {
  16394. g = l;
  16395. b = l;
  16396. r = l;
  16397. } else {
  16398. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  16399. var p = 2 * l - q;
  16400. r = hue2rgb(p, q, h + 1 / 3);
  16401. g = hue2rgb(p, q, h);
  16402. b = hue2rgb(p, q, h - 1 / 3);
  16403. }
  16404. return { r: r * 255, g: g * 255, b: b * 255 };
  16405. }
  16406. function rgbToHsv(r, g, b) {
  16407. r = bound01$1(r, 255);
  16408. g = bound01$1(g, 255);
  16409. b = bound01$1(b, 255);
  16410. var max = Math.max(r, g, b);
  16411. var min = Math.min(r, g, b);
  16412. var h = 0;
  16413. var v = max;
  16414. var d = max - min;
  16415. var s = max === 0 ? 0 : d / max;
  16416. if (max === min) {
  16417. h = 0;
  16418. } else {
  16419. switch (max) {
  16420. case r:
  16421. h = (g - b) / d + (g < b ? 6 : 0);
  16422. break;
  16423. case g:
  16424. h = (b - r) / d + 2;
  16425. break;
  16426. case b:
  16427. h = (r - g) / d + 4;
  16428. break;
  16429. }
  16430. h /= 6;
  16431. }
  16432. return { h, s, v };
  16433. }
  16434. function hsvToRgb(h, s, v) {
  16435. h = bound01$1(h, 360) * 6;
  16436. s = bound01$1(s, 100);
  16437. v = bound01$1(v, 100);
  16438. var i = Math.floor(h);
  16439. var f = h - i;
  16440. var p = v * (1 - s);
  16441. var q = v * (1 - f * s);
  16442. var t = v * (1 - (1 - f) * s);
  16443. var mod = i % 6;
  16444. var r = [v, q, p, p, t, v][mod];
  16445. var g = [t, v, v, q, p, p][mod];
  16446. var b = [p, p, t, v, v, q][mod];
  16447. return { r: r * 255, g: g * 255, b: b * 255 };
  16448. }
  16449. function rgbToHex(r, g, b, allow3Char) {
  16450. var hex = [
  16451. pad2(Math.round(r).toString(16)),
  16452. pad2(Math.round(g).toString(16)),
  16453. pad2(Math.round(b).toString(16))
  16454. ];
  16455. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  16456. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16457. }
  16458. return hex.join("");
  16459. }
  16460. function rgbaToHex(r, g, b, a, allow4Char) {
  16461. var hex = [
  16462. pad2(Math.round(r).toString(16)),
  16463. pad2(Math.round(g).toString(16)),
  16464. pad2(Math.round(b).toString(16)),
  16465. pad2(convertDecimalToHex(a))
  16466. ];
  16467. 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))) {
  16468. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16469. }
  16470. return hex.join("");
  16471. }
  16472. function convertDecimalToHex(d) {
  16473. return Math.round(parseFloat(d) * 255).toString(16);
  16474. }
  16475. function convertHexToDecimal(h) {
  16476. return parseIntFromHex(h) / 255;
  16477. }
  16478. function parseIntFromHex(val) {
  16479. return parseInt(val, 16);
  16480. }
  16481. function numberInputToObject(color) {
  16482. return {
  16483. r: color >> 16,
  16484. g: (color & 65280) >> 8,
  16485. b: color & 255
  16486. };
  16487. }
  16488. var names = {
  16489. aliceblue: "#f0f8ff",
  16490. antiquewhite: "#faebd7",
  16491. aqua: "#00ffff",
  16492. aquamarine: "#7fffd4",
  16493. azure: "#f0ffff",
  16494. beige: "#f5f5dc",
  16495. bisque: "#ffe4c4",
  16496. black: "#000000",
  16497. blanchedalmond: "#ffebcd",
  16498. blue: "#0000ff",
  16499. blueviolet: "#8a2be2",
  16500. brown: "#a52a2a",
  16501. burlywood: "#deb887",
  16502. cadetblue: "#5f9ea0",
  16503. chartreuse: "#7fff00",
  16504. chocolate: "#d2691e",
  16505. coral: "#ff7f50",
  16506. cornflowerblue: "#6495ed",
  16507. cornsilk: "#fff8dc",
  16508. crimson: "#dc143c",
  16509. cyan: "#00ffff",
  16510. darkblue: "#00008b",
  16511. darkcyan: "#008b8b",
  16512. darkgoldenrod: "#b8860b",
  16513. darkgray: "#a9a9a9",
  16514. darkgreen: "#006400",
  16515. darkgrey: "#a9a9a9",
  16516. darkkhaki: "#bdb76b",
  16517. darkmagenta: "#8b008b",
  16518. darkolivegreen: "#556b2f",
  16519. darkorange: "#ff8c00",
  16520. darkorchid: "#9932cc",
  16521. darkred: "#8b0000",
  16522. darksalmon: "#e9967a",
  16523. darkseagreen: "#8fbc8f",
  16524. darkslateblue: "#483d8b",
  16525. darkslategray: "#2f4f4f",
  16526. darkslategrey: "#2f4f4f",
  16527. darkturquoise: "#00ced1",
  16528. darkviolet: "#9400d3",
  16529. deeppink: "#ff1493",
  16530. deepskyblue: "#00bfff",
  16531. dimgray: "#696969",
  16532. dimgrey: "#696969",
  16533. dodgerblue: "#1e90ff",
  16534. firebrick: "#b22222",
  16535. floralwhite: "#fffaf0",
  16536. forestgreen: "#228b22",
  16537. fuchsia: "#ff00ff",
  16538. gainsboro: "#dcdcdc",
  16539. ghostwhite: "#f8f8ff",
  16540. goldenrod: "#daa520",
  16541. gold: "#ffd700",
  16542. gray: "#808080",
  16543. green: "#008000",
  16544. greenyellow: "#adff2f",
  16545. grey: "#808080",
  16546. honeydew: "#f0fff0",
  16547. hotpink: "#ff69b4",
  16548. indianred: "#cd5c5c",
  16549. indigo: "#4b0082",
  16550. ivory: "#fffff0",
  16551. khaki: "#f0e68c",
  16552. lavenderblush: "#fff0f5",
  16553. lavender: "#e6e6fa",
  16554. lawngreen: "#7cfc00",
  16555. lemonchiffon: "#fffacd",
  16556. lightblue: "#add8e6",
  16557. lightcoral: "#f08080",
  16558. lightcyan: "#e0ffff",
  16559. lightgoldenrodyellow: "#fafad2",
  16560. lightgray: "#d3d3d3",
  16561. lightgreen: "#90ee90",
  16562. lightgrey: "#d3d3d3",
  16563. lightpink: "#ffb6c1",
  16564. lightsalmon: "#ffa07a",
  16565. lightseagreen: "#20b2aa",
  16566. lightskyblue: "#87cefa",
  16567. lightslategray: "#778899",
  16568. lightslategrey: "#778899",
  16569. lightsteelblue: "#b0c4de",
  16570. lightyellow: "#ffffe0",
  16571. lime: "#00ff00",
  16572. limegreen: "#32cd32",
  16573. linen: "#faf0e6",
  16574. magenta: "#ff00ff",
  16575. maroon: "#800000",
  16576. mediumaquamarine: "#66cdaa",
  16577. mediumblue: "#0000cd",
  16578. mediumorchid: "#ba55d3",
  16579. mediumpurple: "#9370db",
  16580. mediumseagreen: "#3cb371",
  16581. mediumslateblue: "#7b68ee",
  16582. mediumspringgreen: "#00fa9a",
  16583. mediumturquoise: "#48d1cc",
  16584. mediumvioletred: "#c71585",
  16585. midnightblue: "#191970",
  16586. mintcream: "#f5fffa",
  16587. mistyrose: "#ffe4e1",
  16588. moccasin: "#ffe4b5",
  16589. navajowhite: "#ffdead",
  16590. navy: "#000080",
  16591. oldlace: "#fdf5e6",
  16592. olive: "#808000",
  16593. olivedrab: "#6b8e23",
  16594. orange: "#ffa500",
  16595. orangered: "#ff4500",
  16596. orchid: "#da70d6",
  16597. palegoldenrod: "#eee8aa",
  16598. palegreen: "#98fb98",
  16599. paleturquoise: "#afeeee",
  16600. palevioletred: "#db7093",
  16601. papayawhip: "#ffefd5",
  16602. peachpuff: "#ffdab9",
  16603. peru: "#cd853f",
  16604. pink: "#ffc0cb",
  16605. plum: "#dda0dd",
  16606. powderblue: "#b0e0e6",
  16607. purple: "#800080",
  16608. rebeccapurple: "#663399",
  16609. red: "#ff0000",
  16610. rosybrown: "#bc8f8f",
  16611. royalblue: "#4169e1",
  16612. saddlebrown: "#8b4513",
  16613. salmon: "#fa8072",
  16614. sandybrown: "#f4a460",
  16615. seagreen: "#2e8b57",
  16616. seashell: "#fff5ee",
  16617. sienna: "#a0522d",
  16618. silver: "#c0c0c0",
  16619. skyblue: "#87ceeb",
  16620. slateblue: "#6a5acd",
  16621. slategray: "#708090",
  16622. slategrey: "#708090",
  16623. snow: "#fffafa",
  16624. springgreen: "#00ff7f",
  16625. steelblue: "#4682b4",
  16626. tan: "#d2b48c",
  16627. teal: "#008080",
  16628. thistle: "#d8bfd8",
  16629. tomato: "#ff6347",
  16630. turquoise: "#40e0d0",
  16631. violet: "#ee82ee",
  16632. wheat: "#f5deb3",
  16633. white: "#ffffff",
  16634. whitesmoke: "#f5f5f5",
  16635. yellow: "#ffff00",
  16636. yellowgreen: "#9acd32"
  16637. };
  16638. function inputToRGB(color) {
  16639. var rgb = { r: 0, g: 0, b: 0 };
  16640. var a = 1;
  16641. var s = null;
  16642. var v = null;
  16643. var l = null;
  16644. var ok = false;
  16645. var format = false;
  16646. if (typeof color === "string") {
  16647. color = stringInputToObject(color);
  16648. }
  16649. if (typeof color === "object") {
  16650. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16651. rgb = rgbToRgb(color.r, color.g, color.b);
  16652. ok = true;
  16653. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16654. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16655. s = convertToPercentage(color.s);
  16656. v = convertToPercentage(color.v);
  16657. rgb = hsvToRgb(color.h, s, v);
  16658. ok = true;
  16659. format = "hsv";
  16660. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16661. s = convertToPercentage(color.s);
  16662. l = convertToPercentage(color.l);
  16663. rgb = hslToRgb(color.h, s, l);
  16664. ok = true;
  16665. format = "hsl";
  16666. }
  16667. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  16668. a = color.a;
  16669. }
  16670. }
  16671. a = boundAlpha(a);
  16672. return {
  16673. ok,
  16674. format: color.format || format,
  16675. r: Math.min(255, Math.max(rgb.r, 0)),
  16676. g: Math.min(255, Math.max(rgb.g, 0)),
  16677. b: Math.min(255, Math.max(rgb.b, 0)),
  16678. a
  16679. };
  16680. }
  16681. var CSS_INTEGER = "[-\\+]?\\d+%?";
  16682. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  16683. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  16684. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16685. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16686. var matchers = {
  16687. CSS_UNIT: new RegExp(CSS_UNIT),
  16688. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16689. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16690. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16691. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16692. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16693. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16694. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16695. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16696. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16697. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16698. };
  16699. function stringInputToObject(color) {
  16700. color = color.trim().toLowerCase();
  16701. if (color.length === 0) {
  16702. return false;
  16703. }
  16704. var named = false;
  16705. if (names[color]) {
  16706. color = names[color];
  16707. named = true;
  16708. } else if (color === "transparent") {
  16709. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  16710. }
  16711. var match = matchers.rgb.exec(color);
  16712. if (match) {
  16713. return { r: match[1], g: match[2], b: match[3] };
  16714. }
  16715. match = matchers.rgba.exec(color);
  16716. if (match) {
  16717. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  16718. }
  16719. match = matchers.hsl.exec(color);
  16720. if (match) {
  16721. return { h: match[1], s: match[2], l: match[3] };
  16722. }
  16723. match = matchers.hsla.exec(color);
  16724. if (match) {
  16725. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  16726. }
  16727. match = matchers.hsv.exec(color);
  16728. if (match) {
  16729. return { h: match[1], s: match[2], v: match[3] };
  16730. }
  16731. match = matchers.hsva.exec(color);
  16732. if (match) {
  16733. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  16734. }
  16735. match = matchers.hex8.exec(color);
  16736. if (match) {
  16737. return {
  16738. r: parseIntFromHex(match[1]),
  16739. g: parseIntFromHex(match[2]),
  16740. b: parseIntFromHex(match[3]),
  16741. a: convertHexToDecimal(match[4]),
  16742. format: named ? "name" : "hex8"
  16743. };
  16744. }
  16745. match = matchers.hex6.exec(color);
  16746. if (match) {
  16747. return {
  16748. r: parseIntFromHex(match[1]),
  16749. g: parseIntFromHex(match[2]),
  16750. b: parseIntFromHex(match[3]),
  16751. format: named ? "name" : "hex"
  16752. };
  16753. }
  16754. match = matchers.hex4.exec(color);
  16755. if (match) {
  16756. return {
  16757. r: parseIntFromHex(match[1] + match[1]),
  16758. g: parseIntFromHex(match[2] + match[2]),
  16759. b: parseIntFromHex(match[3] + match[3]),
  16760. a: convertHexToDecimal(match[4] + match[4]),
  16761. format: named ? "name" : "hex8"
  16762. };
  16763. }
  16764. match = matchers.hex3.exec(color);
  16765. if (match) {
  16766. return {
  16767. r: parseIntFromHex(match[1] + match[1]),
  16768. g: parseIntFromHex(match[2] + match[2]),
  16769. b: parseIntFromHex(match[3] + match[3]),
  16770. format: named ? "name" : "hex"
  16771. };
  16772. }
  16773. return false;
  16774. }
  16775. function isValidCSSUnit(color) {
  16776. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  16777. }
  16778. var TinyColor = function() {
  16779. function TinyColor2(color, opts) {
  16780. if (color === void 0) {
  16781. color = "";
  16782. }
  16783. if (opts === void 0) {
  16784. opts = {};
  16785. }
  16786. var _a;
  16787. if (color instanceof TinyColor2) {
  16788. return color;
  16789. }
  16790. if (typeof color === "number") {
  16791. color = numberInputToObject(color);
  16792. }
  16793. this.originalInput = color;
  16794. var rgb = inputToRGB(color);
  16795. this.originalInput = color;
  16796. this.r = rgb.r;
  16797. this.g = rgb.g;
  16798. this.b = rgb.b;
  16799. this.a = rgb.a;
  16800. this.roundA = Math.round(100 * this.a) / 100;
  16801. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  16802. this.gradientType = opts.gradientType;
  16803. if (this.r < 1) {
  16804. this.r = Math.round(this.r);
  16805. }
  16806. if (this.g < 1) {
  16807. this.g = Math.round(this.g);
  16808. }
  16809. if (this.b < 1) {
  16810. this.b = Math.round(this.b);
  16811. }
  16812. this.isValid = rgb.ok;
  16813. }
  16814. TinyColor2.prototype.isDark = function() {
  16815. return this.getBrightness() < 128;
  16816. };
  16817. TinyColor2.prototype.isLight = function() {
  16818. return !this.isDark();
  16819. };
  16820. TinyColor2.prototype.getBrightness = function() {
  16821. var rgb = this.toRgb();
  16822. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16823. };
  16824. TinyColor2.prototype.getLuminance = function() {
  16825. var rgb = this.toRgb();
  16826. var R;
  16827. var G;
  16828. var B;
  16829. var RsRGB = rgb.r / 255;
  16830. var GsRGB = rgb.g / 255;
  16831. var BsRGB = rgb.b / 255;
  16832. if (RsRGB <= 0.03928) {
  16833. R = RsRGB / 12.92;
  16834. } else {
  16835. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  16836. }
  16837. if (GsRGB <= 0.03928) {
  16838. G = GsRGB / 12.92;
  16839. } else {
  16840. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  16841. }
  16842. if (BsRGB <= 0.03928) {
  16843. B = BsRGB / 12.92;
  16844. } else {
  16845. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  16846. }
  16847. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  16848. };
  16849. TinyColor2.prototype.getAlpha = function() {
  16850. return this.a;
  16851. };
  16852. TinyColor2.prototype.setAlpha = function(alpha) {
  16853. this.a = boundAlpha(alpha);
  16854. this.roundA = Math.round(100 * this.a) / 100;
  16855. return this;
  16856. };
  16857. TinyColor2.prototype.toHsv = function() {
  16858. var hsv = rgbToHsv(this.r, this.g, this.b);
  16859. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  16860. };
  16861. TinyColor2.prototype.toHsvString = function() {
  16862. var hsv = rgbToHsv(this.r, this.g, this.b);
  16863. var h = Math.round(hsv.h * 360);
  16864. var s = Math.round(hsv.s * 100);
  16865. var v = Math.round(hsv.v * 100);
  16866. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  16867. };
  16868. TinyColor2.prototype.toHsl = function() {
  16869. var hsl = rgbToHsl(this.r, this.g, this.b);
  16870. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  16871. };
  16872. TinyColor2.prototype.toHslString = function() {
  16873. var hsl = rgbToHsl(this.r, this.g, this.b);
  16874. var h = Math.round(hsl.h * 360);
  16875. var s = Math.round(hsl.s * 100);
  16876. var l = Math.round(hsl.l * 100);
  16877. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  16878. };
  16879. TinyColor2.prototype.toHex = function(allow3Char) {
  16880. if (allow3Char === void 0) {
  16881. allow3Char = false;
  16882. }
  16883. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16884. };
  16885. TinyColor2.prototype.toHexString = function(allow3Char) {
  16886. if (allow3Char === void 0) {
  16887. allow3Char = false;
  16888. }
  16889. return "#" + this.toHex(allow3Char);
  16890. };
  16891. TinyColor2.prototype.toHex8 = function(allow4Char) {
  16892. if (allow4Char === void 0) {
  16893. allow4Char = false;
  16894. }
  16895. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16896. };
  16897. TinyColor2.prototype.toHex8String = function(allow4Char) {
  16898. if (allow4Char === void 0) {
  16899. allow4Char = false;
  16900. }
  16901. return "#" + this.toHex8(allow4Char);
  16902. };
  16903. TinyColor2.prototype.toRgb = function() {
  16904. return {
  16905. r: Math.round(this.r),
  16906. g: Math.round(this.g),
  16907. b: Math.round(this.b),
  16908. a: this.a
  16909. };
  16910. };
  16911. TinyColor2.prototype.toRgbString = function() {
  16912. var r = Math.round(this.r);
  16913. var g = Math.round(this.g);
  16914. var b = Math.round(this.b);
  16915. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  16916. };
  16917. TinyColor2.prototype.toPercentageRgb = function() {
  16918. var fmt = function(x) {
  16919. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  16920. };
  16921. return {
  16922. r: fmt(this.r),
  16923. g: fmt(this.g),
  16924. b: fmt(this.b),
  16925. a: this.a
  16926. };
  16927. };
  16928. TinyColor2.prototype.toPercentageRgbString = function() {
  16929. var rnd = function(x) {
  16930. return Math.round(bound01$1(x, 255) * 100);
  16931. };
  16932. 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, ")");
  16933. };
  16934. TinyColor2.prototype.toName = function() {
  16935. if (this.a === 0) {
  16936. return "transparent";
  16937. }
  16938. if (this.a < 1) {
  16939. return false;
  16940. }
  16941. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  16942. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  16943. var _b = _a[_i], key = _b[0], value = _b[1];
  16944. if (hex === value) {
  16945. return key;
  16946. }
  16947. }
  16948. return false;
  16949. };
  16950. TinyColor2.prototype.toString = function(format) {
  16951. var formatSet = Boolean(format);
  16952. format = format !== null && format !== void 0 ? format : this.format;
  16953. var formattedString = false;
  16954. var hasAlpha = this.a < 1 && this.a >= 0;
  16955. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  16956. if (needsAlphaFormat) {
  16957. if (format === "name" && this.a === 0) {
  16958. return this.toName();
  16959. }
  16960. return this.toRgbString();
  16961. }
  16962. if (format === "rgb") {
  16963. formattedString = this.toRgbString();
  16964. }
  16965. if (format === "prgb") {
  16966. formattedString = this.toPercentageRgbString();
  16967. }
  16968. if (format === "hex" || format === "hex6") {
  16969. formattedString = this.toHexString();
  16970. }
  16971. if (format === "hex3") {
  16972. formattedString = this.toHexString(true);
  16973. }
  16974. if (format === "hex4") {
  16975. formattedString = this.toHex8String(true);
  16976. }
  16977. if (format === "hex8") {
  16978. formattedString = this.toHex8String();
  16979. }
  16980. if (format === "name") {
  16981. formattedString = this.toName();
  16982. }
  16983. if (format === "hsl") {
  16984. formattedString = this.toHslString();
  16985. }
  16986. if (format === "hsv") {
  16987. formattedString = this.toHsvString();
  16988. }
  16989. return formattedString || this.toHexString();
  16990. };
  16991. TinyColor2.prototype.toNumber = function() {
  16992. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  16993. };
  16994. TinyColor2.prototype.clone = function() {
  16995. return new TinyColor2(this.toString());
  16996. };
  16997. TinyColor2.prototype.lighten = function(amount) {
  16998. if (amount === void 0) {
  16999. amount = 10;
  17000. }
  17001. var hsl = this.toHsl();
  17002. hsl.l += amount / 100;
  17003. hsl.l = clamp01(hsl.l);
  17004. return new TinyColor2(hsl);
  17005. };
  17006. TinyColor2.prototype.brighten = function(amount) {
  17007. if (amount === void 0) {
  17008. amount = 10;
  17009. }
  17010. var rgb = this.toRgb();
  17011. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  17012. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  17013. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  17014. return new TinyColor2(rgb);
  17015. };
  17016. TinyColor2.prototype.darken = function(amount) {
  17017. if (amount === void 0) {
  17018. amount = 10;
  17019. }
  17020. var hsl = this.toHsl();
  17021. hsl.l -= amount / 100;
  17022. hsl.l = clamp01(hsl.l);
  17023. return new TinyColor2(hsl);
  17024. };
  17025. TinyColor2.prototype.tint = function(amount) {
  17026. if (amount === void 0) {
  17027. amount = 10;
  17028. }
  17029. return this.mix("white", amount);
  17030. };
  17031. TinyColor2.prototype.shade = function(amount) {
  17032. if (amount === void 0) {
  17033. amount = 10;
  17034. }
  17035. return this.mix("black", amount);
  17036. };
  17037. TinyColor2.prototype.desaturate = function(amount) {
  17038. if (amount === void 0) {
  17039. amount = 10;
  17040. }
  17041. var hsl = this.toHsl();
  17042. hsl.s -= amount / 100;
  17043. hsl.s = clamp01(hsl.s);
  17044. return new TinyColor2(hsl);
  17045. };
  17046. TinyColor2.prototype.saturate = function(amount) {
  17047. if (amount === void 0) {
  17048. amount = 10;
  17049. }
  17050. var hsl = this.toHsl();
  17051. hsl.s += amount / 100;
  17052. hsl.s = clamp01(hsl.s);
  17053. return new TinyColor2(hsl);
  17054. };
  17055. TinyColor2.prototype.greyscale = function() {
  17056. return this.desaturate(100);
  17057. };
  17058. TinyColor2.prototype.spin = function(amount) {
  17059. var hsl = this.toHsl();
  17060. var hue = (hsl.h + amount) % 360;
  17061. hsl.h = hue < 0 ? 360 + hue : hue;
  17062. return new TinyColor2(hsl);
  17063. };
  17064. TinyColor2.prototype.mix = function(color, amount) {
  17065. if (amount === void 0) {
  17066. amount = 50;
  17067. }
  17068. var rgb1 = this.toRgb();
  17069. var rgb2 = new TinyColor2(color).toRgb();
  17070. var p = amount / 100;
  17071. var rgba = {
  17072. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  17073. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  17074. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  17075. a: (rgb2.a - rgb1.a) * p + rgb1.a
  17076. };
  17077. return new TinyColor2(rgba);
  17078. };
  17079. TinyColor2.prototype.analogous = function(results, slices) {
  17080. if (results === void 0) {
  17081. results = 6;
  17082. }
  17083. if (slices === void 0) {
  17084. slices = 30;
  17085. }
  17086. var hsl = this.toHsl();
  17087. var part = 360 / slices;
  17088. var ret = [this];
  17089. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  17090. hsl.h = (hsl.h + part) % 360;
  17091. ret.push(new TinyColor2(hsl));
  17092. }
  17093. return ret;
  17094. };
  17095. TinyColor2.prototype.complement = function() {
  17096. var hsl = this.toHsl();
  17097. hsl.h = (hsl.h + 180) % 360;
  17098. return new TinyColor2(hsl);
  17099. };
  17100. TinyColor2.prototype.monochromatic = function(results) {
  17101. if (results === void 0) {
  17102. results = 6;
  17103. }
  17104. var hsv = this.toHsv();
  17105. var h = hsv.h;
  17106. var s = hsv.s;
  17107. var v = hsv.v;
  17108. var res = [];
  17109. var modification = 1 / results;
  17110. while (results--) {
  17111. res.push(new TinyColor2({ h, s, v }));
  17112. v = (v + modification) % 1;
  17113. }
  17114. return res;
  17115. };
  17116. TinyColor2.prototype.splitcomplement = function() {
  17117. var hsl = this.toHsl();
  17118. var h = hsl.h;
  17119. return [
  17120. this,
  17121. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  17122. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  17123. ];
  17124. };
  17125. TinyColor2.prototype.onBackground = function(background) {
  17126. var fg = this.toRgb();
  17127. var bg = new TinyColor2(background).toRgb();
  17128. return new TinyColor2({
  17129. r: bg.r + (fg.r - bg.r) * fg.a,
  17130. g: bg.g + (fg.g - bg.g) * fg.a,
  17131. b: bg.b + (fg.b - bg.b) * fg.a
  17132. });
  17133. };
  17134. TinyColor2.prototype.triad = function() {
  17135. return this.polyad(3);
  17136. };
  17137. TinyColor2.prototype.tetrad = function() {
  17138. return this.polyad(4);
  17139. };
  17140. TinyColor2.prototype.polyad = function(n) {
  17141. var hsl = this.toHsl();
  17142. var h = hsl.h;
  17143. var result = [this];
  17144. var increment = 360 / n;
  17145. for (var i = 1; i < n; i++) {
  17146. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  17147. }
  17148. return result;
  17149. };
  17150. TinyColor2.prototype.equals = function(color) {
  17151. return this.toRgbString() === new TinyColor2(color).toRgbString();
  17152. };
  17153. return TinyColor2;
  17154. }();
  17155. function darken(color, amount = 20) {
  17156. return color.mix("#141414", amount).toString();
  17157. }
  17158. function useButtonCustomStyle(props) {
  17159. const _disabled = useFormDisabled();
  17160. const ns = useNamespace("button");
  17161. return vue.computed(() => {
  17162. let styles = {};
  17163. let buttonColor = props.color;
  17164. if (buttonColor) {
  17165. const match = buttonColor.match(/var\((.*?)\)/);
  17166. if (match) {
  17167. buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  17168. }
  17169. const color = new TinyColor(buttonColor);
  17170. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  17171. if (props.plain) {
  17172. styles = ns.cssVarBlock({
  17173. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  17174. "text-color": buttonColor,
  17175. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  17176. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  17177. "hover-bg-color": buttonColor,
  17178. "hover-border-color": buttonColor,
  17179. "active-bg-color": activeBgColor,
  17180. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  17181. "active-border-color": activeBgColor
  17182. });
  17183. if (_disabled.value) {
  17184. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  17185. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  17186. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  17187. }
  17188. } else {
  17189. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  17190. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  17191. styles = ns.cssVarBlock({
  17192. "bg-color": buttonColor,
  17193. "text-color": textColor,
  17194. "border-color": buttonColor,
  17195. "hover-bg-color": hoverBgColor,
  17196. "hover-text-color": textColor,
  17197. "hover-border-color": hoverBgColor,
  17198. "active-bg-color": activeBgColor,
  17199. "active-border-color": activeBgColor
  17200. });
  17201. if (_disabled.value) {
  17202. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  17203. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  17204. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  17205. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  17206. }
  17207. }
  17208. }
  17209. return styles;
  17210. });
  17211. }
  17212. const __default__$1u = vue.defineComponent({
  17213. name: "ElButton"
  17214. });
  17215. const _sfc_main$26 = /* @__PURE__ */ vue.defineComponent({
  17216. ...__default__$1u,
  17217. props: buttonProps,
  17218. emits: buttonEmits,
  17219. setup(__props, { expose, emit }) {
  17220. const props = __props;
  17221. const buttonStyle = useButtonCustomStyle(props);
  17222. const ns = useNamespace("button");
  17223. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  17224. const buttonKls = vue.computed(() => [
  17225. ns.b(),
  17226. ns.m(_type.value),
  17227. ns.m(_size.value),
  17228. ns.is("disabled", _disabled.value),
  17229. ns.is("loading", props.loading),
  17230. ns.is("plain", props.plain),
  17231. ns.is("round", props.round),
  17232. ns.is("circle", props.circle),
  17233. ns.is("text", props.text),
  17234. ns.is("link", props.link),
  17235. ns.is("has-bg", props.bg)
  17236. ]);
  17237. expose({
  17238. ref: _ref,
  17239. size: _size,
  17240. type: _type,
  17241. disabled: _disabled,
  17242. shouldAddSpace
  17243. });
  17244. return (_ctx, _cache) => {
  17245. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({
  17246. ref_key: "_ref",
  17247. ref: _ref
  17248. }, vue.unref(_props), {
  17249. class: vue.unref(buttonKls),
  17250. style: vue.unref(buttonStyle),
  17251. onClick: vue.unref(handleClick)
  17252. }), {
  17253. default: vue.withCtx(() => [
  17254. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  17255. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  17256. key: 1,
  17257. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  17258. }, {
  17259. default: vue.withCtx(() => [
  17260. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  17261. ]),
  17262. _: 1
  17263. }, 8, ["class"]))
  17264. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  17265. default: vue.withCtx(() => [
  17266. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  17267. ]),
  17268. _: 3
  17269. })) : vue.createCommentVNode("v-if", true),
  17270. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  17271. key: 2,
  17272. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  17273. }, [
  17274. vue.renderSlot(_ctx.$slots, "default")
  17275. ], 2)) : vue.createCommentVNode("v-if", true)
  17276. ]),
  17277. _: 3
  17278. }, 16, ["class", "style", "onClick"]);
  17279. };
  17280. }
  17281. });
  17282. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "button.vue"]]);
  17283. const buttonGroupProps = {
  17284. size: buttonProps.size,
  17285. type: buttonProps.type
  17286. };
  17287. const __default__$1t = vue.defineComponent({
  17288. name: "ElButtonGroup"
  17289. });
  17290. const _sfc_main$25 = /* @__PURE__ */ vue.defineComponent({
  17291. ...__default__$1t,
  17292. props: buttonGroupProps,
  17293. setup(__props) {
  17294. const props = __props;
  17295. vue.provide(buttonGroupContextKey, vue.reactive({
  17296. size: vue.toRef(props, "size"),
  17297. type: vue.toRef(props, "type")
  17298. }));
  17299. const ns = useNamespace("button");
  17300. return (_ctx, _cache) => {
  17301. return vue.openBlock(), vue.createElementBlock("div", {
  17302. class: vue.normalizeClass(vue.unref(ns).b("group"))
  17303. }, [
  17304. vue.renderSlot(_ctx.$slots, "default")
  17305. ], 2);
  17306. };
  17307. }
  17308. });
  17309. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "button-group.vue"]]);
  17310. const ElButton = withInstall(Button, {
  17311. ButtonGroup
  17312. });
  17313. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  17314. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17315. var dayjs_min = {exports: {}};
  17316. (function(module, exports) {
  17317. !function(t, e) {
  17318. module.exports = e() ;
  17319. }(commonjsGlobal, function() {
  17320. 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) {
  17321. var r2 = String(t2);
  17322. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  17323. }, g = { s: m, z: function(t2) {
  17324. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  17325. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  17326. }, m: function t2(e2, n2) {
  17327. if (e2.date() < n2.date())
  17328. return -t2(n2, e2);
  17329. 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);
  17330. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  17331. }, a: function(t2) {
  17332. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  17333. }, p: function(t2) {
  17334. 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$/, "");
  17335. }, u: function(t2) {
  17336. return t2 === void 0;
  17337. } }, v = "en", D = {};
  17338. D[v] = M;
  17339. var p = function(t2) {
  17340. return t2 instanceof _;
  17341. }, S = function t2(e2, n2, r2) {
  17342. var i2;
  17343. if (!e2)
  17344. return v;
  17345. if (typeof e2 == "string") {
  17346. var s2 = e2.toLowerCase();
  17347. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  17348. var u2 = e2.split("-");
  17349. if (!i2 && u2.length > 1)
  17350. return t2(u2[0]);
  17351. } else {
  17352. var a2 = e2.name;
  17353. D[a2] = e2, i2 = a2;
  17354. }
  17355. return !r2 && i2 && (v = i2), i2 || !r2 && v;
  17356. }, w = function(t2, e2) {
  17357. if (p(t2))
  17358. return t2.clone();
  17359. var n2 = typeof e2 == "object" ? e2 : {};
  17360. return n2.date = t2, n2.args = arguments, new _(n2);
  17361. }, O = g;
  17362. O.l = S, O.i = p, O.w = function(t2, e2) {
  17363. return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  17364. };
  17365. var _ = function() {
  17366. function M2(t2) {
  17367. this.$L = S(t2.locale, null, true), this.parse(t2);
  17368. }
  17369. var m2 = M2.prototype;
  17370. return m2.parse = function(t2) {
  17371. this.$d = function(t3) {
  17372. var e2 = t3.date, n2 = t3.utc;
  17373. if (e2 === null)
  17374. return new Date(NaN);
  17375. if (O.u(e2))
  17376. return new Date();
  17377. if (e2 instanceof Date)
  17378. return new Date(e2);
  17379. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  17380. var r2 = e2.match(l);
  17381. if (r2) {
  17382. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  17383. 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);
  17384. }
  17385. }
  17386. return new Date(e2);
  17387. }(t2), this.$x = t2.x || {}, this.init();
  17388. }, m2.init = function() {
  17389. var t2 = this.$d;
  17390. 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();
  17391. }, m2.$utils = function() {
  17392. return O;
  17393. }, m2.isValid = function() {
  17394. return !(this.$d.toString() === $);
  17395. }, m2.isSame = function(t2, e2) {
  17396. var n2 = w(t2);
  17397. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  17398. }, m2.isAfter = function(t2, e2) {
  17399. return w(t2) < this.startOf(e2);
  17400. }, m2.isBefore = function(t2, e2) {
  17401. return this.endOf(e2) < w(t2);
  17402. }, m2.$g = function(t2, e2, n2) {
  17403. return O.u(t2) ? this[e2] : this.set(n2, t2);
  17404. }, m2.unix = function() {
  17405. return Math.floor(this.valueOf() / 1e3);
  17406. }, m2.valueOf = function() {
  17407. return this.$d.getTime();
  17408. }, m2.startOf = function(t2, e2) {
  17409. var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
  17410. var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  17411. return r2 ? i2 : i2.endOf(a);
  17412. }, l2 = function(t3, e3) {
  17413. return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  17414. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  17415. switch (h2) {
  17416. case c:
  17417. return r2 ? $2(1, 0) : $2(31, 11);
  17418. case f:
  17419. return r2 ? $2(1, M3) : $2(0, M3 + 1);
  17420. case o:
  17421. var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2;
  17422. return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  17423. case a:
  17424. case d:
  17425. return l2(g2 + "Hours", 0);
  17426. case u:
  17427. return l2(g2 + "Minutes", 1);
  17428. case s:
  17429. return l2(g2 + "Seconds", 2);
  17430. case i:
  17431. return l2(g2 + "Milliseconds", 3);
  17432. default:
  17433. return this.clone();
  17434. }
  17435. }, m2.endOf = function(t2) {
  17436. return this.startOf(t2, false);
  17437. }, m2.$set = function(t2, e2) {
  17438. 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;
  17439. if (o2 === f || o2 === c) {
  17440. var y2 = this.clone().set(d, 1);
  17441. y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  17442. } else
  17443. $2 && this.$d[$2](l2);
  17444. return this.init(), this;
  17445. }, m2.set = function(t2, e2) {
  17446. return this.clone().$set(t2, e2);
  17447. }, m2.get = function(t2) {
  17448. return this[O.p(t2)]();
  17449. }, m2.add = function(r2, h2) {
  17450. var d2, $2 = this;
  17451. r2 = Number(r2);
  17452. var l2 = O.p(h2), y2 = function(t2) {
  17453. var e2 = w($2);
  17454. return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  17455. };
  17456. if (l2 === f)
  17457. return this.set(f, this.$M + r2);
  17458. if (l2 === c)
  17459. return this.set(c, this.$y + r2);
  17460. if (l2 === a)
  17461. return y2(1);
  17462. if (l2 === o)
  17463. return y2(7);
  17464. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
  17465. return O.w(m3, this);
  17466. }, m2.subtract = function(t2, e2) {
  17467. return this.add(-1 * t2, e2);
  17468. }, m2.format = function(t2) {
  17469. var e2 = this, n2 = this.$locale();
  17470. if (!this.isValid())
  17471. return n2.invalidDate || $;
  17472. 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) {
  17473. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  17474. }, c2 = function(t3) {
  17475. return O.s(s2 % 12 || 12, t3, "0");
  17476. }, d2 = n2.meridiem || function(t3, e3, n3) {
  17477. var r3 = t3 < 12 ? "AM" : "PM";
  17478. return n3 ? r3.toLowerCase() : r3;
  17479. }, 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 };
  17480. return r2.replace(y, function(t3, e3) {
  17481. return e3 || l2[t3] || i2.replace(":", "");
  17482. });
  17483. }, m2.utcOffset = function() {
  17484. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17485. }, m2.diff = function(r2, d2, $2) {
  17486. var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3);
  17487. 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);
  17488. }, m2.daysInMonth = function() {
  17489. return this.endOf(f).$D;
  17490. }, m2.$locale = function() {
  17491. return D[this.$L];
  17492. }, m2.locale = function(t2, e2) {
  17493. if (!t2)
  17494. return this.$L;
  17495. var n2 = this.clone(), r2 = S(t2, e2, true);
  17496. return r2 && (n2.$L = r2), n2;
  17497. }, m2.clone = function() {
  17498. return O.w(this.$d, this);
  17499. }, m2.toDate = function() {
  17500. return new Date(this.valueOf());
  17501. }, m2.toJSON = function() {
  17502. return this.isValid() ? this.toISOString() : null;
  17503. }, m2.toISOString = function() {
  17504. return this.$d.toISOString();
  17505. }, m2.toString = function() {
  17506. return this.$d.toUTCString();
  17507. }, M2;
  17508. }(), T = _.prototype;
  17509. return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
  17510. T[t2[1]] = function(e2) {
  17511. return this.$g(e2, t2[0], t2[1]);
  17512. };
  17513. }), w.extend = function(t2, e2) {
  17514. return t2.$i || (t2(e2, _, w), t2.$i = true), w;
  17515. }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
  17516. return w(1e3 * t2);
  17517. }, w.en = D[v], w.Ls = D, w.p = {}, w;
  17518. });
  17519. })(dayjs_min);
  17520. var dayjs = dayjs_min.exports;
  17521. var customParseFormat$1 = {exports: {}};
  17522. (function(module, exports) {
  17523. !function(e, t) {
  17524. module.exports = t() ;
  17525. }(commonjsGlobal, function() {
  17526. 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) {
  17527. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  17528. };
  17529. var a = function(e2) {
  17530. return function(t2) {
  17531. this[e2] = +t2;
  17532. };
  17533. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  17534. (this.zone || (this.zone = {})).offset = function(e3) {
  17535. if (!e3)
  17536. return 0;
  17537. if (e3 === "Z")
  17538. return 0;
  17539. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  17540. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  17541. }(e2);
  17542. }], h = function(e2) {
  17543. var t2 = o[e2];
  17544. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  17545. }, u = function(e2, t2) {
  17546. var n2, r2 = o.meridiem;
  17547. if (r2) {
  17548. for (var i2 = 1; i2 <= 24; i2 += 1)
  17549. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  17550. n2 = i2 > 12;
  17551. break;
  17552. }
  17553. } else
  17554. n2 = e2 === (t2 ? "pm" : "PM");
  17555. return n2;
  17556. }, d = { A: [i, function(e2) {
  17557. this.afternoon = u(e2, false);
  17558. }], a: [i, function(e2) {
  17559. this.afternoon = u(e2, true);
  17560. }], S: [/\d/, function(e2) {
  17561. this.milliseconds = 100 * +e2;
  17562. }], SS: [n, function(e2) {
  17563. this.milliseconds = 10 * +e2;
  17564. }], SSS: [/\d{3}/, function(e2) {
  17565. this.milliseconds = +e2;
  17566. }], 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) {
  17567. var t2 = o.ordinal, n2 = e2.match(/\d+/);
  17568. if (this.day = n2[0], t2)
  17569. for (var r2 = 1; r2 <= 31; r2 += 1)
  17570. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  17571. }], M: [r, a("month")], MM: [n, a("month")], MMM: [i, function(e2) {
  17572. var t2 = h("months"), n2 = (h("monthsShort") || t2.map(function(e3) {
  17573. return e3.slice(0, 3);
  17574. })).indexOf(e2) + 1;
  17575. if (n2 < 1)
  17576. throw new Error();
  17577. this.month = n2 % 12 || n2;
  17578. }], MMMM: [i, function(e2) {
  17579. var t2 = h("months").indexOf(e2) + 1;
  17580. if (t2 < 1)
  17581. throw new Error();
  17582. this.month = t2 % 12 || t2;
  17583. }], Y: [/[+-]?\d+/, a("year")], YY: [n, function(e2) {
  17584. this.year = s(e2);
  17585. }], YYYY: [/\d{4}/, a("year")], Z: f, ZZ: f };
  17586. function c(n2) {
  17587. var r2, i2;
  17588. r2 = n2, i2 = o && o.formats;
  17589. for (var s2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  17590. var o2 = r3 && r3.toUpperCase();
  17591. return n3 || i2[r3] || e[r3] || i2[o2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  17592. return t3 || n4.slice(1);
  17593. });
  17594. })).match(t), a2 = s2.length, f2 = 0; f2 < a2; f2 += 1) {
  17595. var h2 = s2[f2], u2 = d[h2], c2 = u2 && u2[0], l = u2 && u2[1];
  17596. s2[f2] = l ? { regex: c2, parser: l } : h2.replace(/^\[|\]$/g, "");
  17597. }
  17598. return function(e2) {
  17599. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  17600. var i3 = s2[n3];
  17601. if (typeof i3 == "string")
  17602. r3 += i3.length;
  17603. else {
  17604. var o2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = o2.exec(h3)[0];
  17605. f3.call(t2, u3), e2 = e2.replace(u3, "");
  17606. }
  17607. }
  17608. return function(e3) {
  17609. var t3 = e3.afternoon;
  17610. if (t3 !== void 0) {
  17611. var n4 = e3.hours;
  17612. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  17613. }
  17614. }(t2), t2;
  17615. };
  17616. }
  17617. return function(e2, t2, n2) {
  17618. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s = e2.parseTwoDigitYear);
  17619. var r2 = t2.prototype, i2 = r2.parse;
  17620. r2.parse = function(e3) {
  17621. var t3 = e3.date, r3 = e3.utc, s2 = e3.args;
  17622. this.$u = r3;
  17623. var a2 = s2[1];
  17624. if (typeof a2 == "string") {
  17625. var f2 = s2[2] === true, h2 = s2[3] === true, u2 = f2 || h2, d2 = s2[2];
  17626. h2 && (d2 = s2[2]), o = this.$locale(), !f2 && d2 && (o = n2.Ls[d2]), this.$d = function(e4, t4, n3) {
  17627. try {
  17628. if (["x", "X"].indexOf(t4) > -1)
  17629. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  17630. 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;
  17631. i3 && !o2 || (Y = o2 > 0 ? o2 - 1 : l2.getMonth());
  17632. var p = a3 || 0, v = f3 || 0, D = h3 || 0, g = u3 || 0;
  17633. 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);
  17634. } catch (e5) {
  17635. return new Date("");
  17636. }
  17637. }(t3, a2, r3), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), o = {};
  17638. } else if (a2 instanceof Array)
  17639. for (var l = a2.length, m = 1; m <= l; m += 1) {
  17640. s2[1] = a2[m - 1];
  17641. var M = n2.apply(this, s2);
  17642. if (M.isValid()) {
  17643. this.$d = M.$d, this.$L = M.$L, this.init();
  17644. break;
  17645. }
  17646. m === l && (this.$d = new Date(""));
  17647. }
  17648. else
  17649. i2.call(this, e3);
  17650. };
  17651. };
  17652. });
  17653. })(customParseFormat$1);
  17654. var customParseFormat = customParseFormat$1.exports;
  17655. const timeUnits$1 = ["hours", "minutes", "seconds"];
  17656. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17657. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17658. const DEFAULT_FORMATS_DATEPICKER = {
  17659. date: DEFAULT_FORMATS_DATE,
  17660. dates: DEFAULT_FORMATS_DATE,
  17661. week: "gggg[w]ww",
  17662. year: "YYYY",
  17663. years: "YYYY",
  17664. month: "YYYY-MM",
  17665. months: "YYYY-MM",
  17666. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17667. monthrange: "YYYY-MM",
  17668. yearrange: "YYYY",
  17669. daterange: DEFAULT_FORMATS_DATE,
  17670. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17671. };
  17672. const buildTimeList = (value, bound) => {
  17673. return [
  17674. value > 0 ? value - 1 : void 0,
  17675. value,
  17676. value < bound ? value + 1 : void 0
  17677. ];
  17678. };
  17679. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17680. const extractDateFormat = (format) => {
  17681. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17682. };
  17683. const extractTimeFormat = (format) => {
  17684. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17685. };
  17686. const dateEquals = function(a, b) {
  17687. const aIsDate = isDate$1(a);
  17688. const bIsDate = isDate$1(b);
  17689. if (aIsDate && bIsDate) {
  17690. return a.getTime() === b.getTime();
  17691. }
  17692. if (!aIsDate && !bIsDate) {
  17693. return a === b;
  17694. }
  17695. return false;
  17696. };
  17697. const valueEquals = function(a, b) {
  17698. const aIsArray = isArray$1(a);
  17699. const bIsArray = isArray$1(b);
  17700. if (aIsArray && bIsArray) {
  17701. if (a.length !== b.length) {
  17702. return false;
  17703. }
  17704. return a.every((item, index) => dateEquals(item, b[index]));
  17705. }
  17706. if (!aIsArray && !bIsArray) {
  17707. return dateEquals(a, b);
  17708. }
  17709. return false;
  17710. };
  17711. const parseDate = function(date, format, lang) {
  17712. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  17713. return day.isValid() ? day : void 0;
  17714. };
  17715. const formatter = function(date, format, lang) {
  17716. if (isEmpty(format))
  17717. return date;
  17718. if (format === "x")
  17719. return +date;
  17720. return dayjs(date).locale(lang).format(format);
  17721. };
  17722. const makeList = (total, method) => {
  17723. var _a;
  17724. const arr = [];
  17725. const disabledArr = method == null ? void 0 : method();
  17726. for (let i = 0; i < total; i++) {
  17727. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  17728. }
  17729. return arr;
  17730. };
  17731. const disabledTimeListsProps = buildProps({
  17732. disabledHours: {
  17733. type: definePropType(Function)
  17734. },
  17735. disabledMinutes: {
  17736. type: definePropType(Function)
  17737. },
  17738. disabledSeconds: {
  17739. type: definePropType(Function)
  17740. }
  17741. });
  17742. const timePanelSharedProps = buildProps({
  17743. visible: Boolean,
  17744. actualVisible: {
  17745. type: Boolean,
  17746. default: void 0
  17747. },
  17748. format: {
  17749. type: String,
  17750. default: ""
  17751. }
  17752. });
  17753. const timePickerDefaultProps = buildProps({
  17754. id: {
  17755. type: definePropType([Array, String])
  17756. },
  17757. name: {
  17758. type: definePropType([Array, String]),
  17759. default: ""
  17760. },
  17761. popperClass: {
  17762. type: String,
  17763. default: ""
  17764. },
  17765. format: String,
  17766. valueFormat: String,
  17767. dateFormat: String,
  17768. timeFormat: String,
  17769. type: {
  17770. type: String,
  17771. default: ""
  17772. },
  17773. clearable: {
  17774. type: Boolean,
  17775. default: true
  17776. },
  17777. clearIcon: {
  17778. type: definePropType([String, Object]),
  17779. default: circle_close_default
  17780. },
  17781. editable: {
  17782. type: Boolean,
  17783. default: true
  17784. },
  17785. prefixIcon: {
  17786. type: definePropType([String, Object]),
  17787. default: ""
  17788. },
  17789. size: useSizeProp,
  17790. readonly: Boolean,
  17791. disabled: Boolean,
  17792. placeholder: {
  17793. type: String,
  17794. default: ""
  17795. },
  17796. popperOptions: {
  17797. type: definePropType(Object),
  17798. default: () => ({})
  17799. },
  17800. modelValue: {
  17801. type: definePropType([Date, Array, String, Number]),
  17802. default: ""
  17803. },
  17804. rangeSeparator: {
  17805. type: String,
  17806. default: "-"
  17807. },
  17808. startPlaceholder: String,
  17809. endPlaceholder: String,
  17810. defaultValue: {
  17811. type: definePropType([Date, Array])
  17812. },
  17813. defaultTime: {
  17814. type: definePropType([Date, Array])
  17815. },
  17816. isRange: Boolean,
  17817. ...disabledTimeListsProps,
  17818. disabledDate: {
  17819. type: Function
  17820. },
  17821. cellClassName: {
  17822. type: Function
  17823. },
  17824. shortcuts: {
  17825. type: Array,
  17826. default: () => []
  17827. },
  17828. arrowControl: Boolean,
  17829. tabindex: {
  17830. type: definePropType([String, Number]),
  17831. default: 0
  17832. },
  17833. validateEvent: {
  17834. type: Boolean,
  17835. default: true
  17836. },
  17837. unlinkPanels: Boolean,
  17838. ...useEmptyValuesProps,
  17839. ...useAriaProps(["ariaLabel"])
  17840. });
  17841. const __default__$1s = vue.defineComponent({
  17842. name: "Picker"
  17843. });
  17844. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  17845. ...__default__$1s,
  17846. props: timePickerDefaultProps,
  17847. emits: [
  17848. "update:modelValue",
  17849. "change",
  17850. "focus",
  17851. "blur",
  17852. "clear",
  17853. "calendar-change",
  17854. "panel-change",
  17855. "visible-change",
  17856. "keydown"
  17857. ],
  17858. setup(__props, { expose, emit }) {
  17859. const props = __props;
  17860. const attrs = vue.useAttrs();
  17861. const { lang } = useLocale();
  17862. const nsDate = useNamespace("date");
  17863. const nsInput = useNamespace("input");
  17864. const nsRange = useNamespace("range");
  17865. const { form, formItem } = useFormItem();
  17866. const elPopperOptions = vue.inject("ElPopperOptions", {});
  17867. const { valueOnClear } = useEmptyValues(props, null);
  17868. const refPopper = vue.ref();
  17869. const inputRef = vue.ref();
  17870. const pickerVisible = vue.ref(false);
  17871. const pickerActualVisible = vue.ref(false);
  17872. const valueOnOpen = vue.ref(null);
  17873. let hasJustTabExitedInput = false;
  17874. let ignoreFocusEvent = false;
  17875. const rangeInputKls = vue.computed(() => [
  17876. nsDate.b("editor"),
  17877. nsDate.bm("editor", props.type),
  17878. nsInput.e("wrapper"),
  17879. nsDate.is("disabled", pickerDisabled.value),
  17880. nsDate.is("active", pickerVisible.value),
  17881. nsRange.b("editor"),
  17882. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  17883. attrs.class
  17884. ]);
  17885. const clearIconKls = vue.computed(() => [
  17886. nsInput.e("icon"),
  17887. nsRange.e("close-icon"),
  17888. !showClose.value ? nsRange.e("close-icon--hidden") : ""
  17889. ]);
  17890. vue.watch(pickerVisible, (val) => {
  17891. if (!val) {
  17892. userInput.value = null;
  17893. vue.nextTick(() => {
  17894. emitChange(props.modelValue);
  17895. });
  17896. } else {
  17897. vue.nextTick(() => {
  17898. if (val) {
  17899. valueOnOpen.value = props.modelValue;
  17900. }
  17901. });
  17902. }
  17903. });
  17904. const emitChange = (val, isClear) => {
  17905. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  17906. emit("change", val);
  17907. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  17908. }
  17909. };
  17910. const emitInput = (input) => {
  17911. if (!valueEquals(props.modelValue, input)) {
  17912. let formatted;
  17913. if (isArray$1(input)) {
  17914. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  17915. } else if (input) {
  17916. formatted = formatter(input, props.valueFormat, lang.value);
  17917. }
  17918. emit("update:modelValue", input ? formatted : input, lang.value);
  17919. }
  17920. };
  17921. const emitKeydown = (e) => {
  17922. emit("keydown", e);
  17923. };
  17924. const refInput = vue.computed(() => {
  17925. if (inputRef.value) {
  17926. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  17927. return Array.from(_r.querySelectorAll("input"));
  17928. }
  17929. return [];
  17930. });
  17931. const setSelectionRange = (start, end, pos) => {
  17932. const _inputs = refInput.value;
  17933. if (!_inputs.length)
  17934. return;
  17935. if (!pos || pos === "min") {
  17936. _inputs[0].setSelectionRange(start, end);
  17937. _inputs[0].focus();
  17938. } else if (pos === "max") {
  17939. _inputs[1].setSelectionRange(start, end);
  17940. _inputs[1].focus();
  17941. }
  17942. };
  17943. const focusOnInputBox = () => {
  17944. focus(true, true);
  17945. vue.nextTick(() => {
  17946. ignoreFocusEvent = false;
  17947. });
  17948. };
  17949. const onPick = (date = "", visible = false) => {
  17950. if (!visible) {
  17951. ignoreFocusEvent = true;
  17952. }
  17953. pickerVisible.value = visible;
  17954. let result;
  17955. if (isArray$1(date)) {
  17956. result = date.map((_) => _.toDate());
  17957. } else {
  17958. result = date ? date.toDate() : date;
  17959. }
  17960. userInput.value = null;
  17961. emitInput(result);
  17962. };
  17963. const onBeforeShow = () => {
  17964. pickerActualVisible.value = true;
  17965. };
  17966. const onShow = () => {
  17967. emit("visible-change", true);
  17968. };
  17969. const onKeydownPopperContent = (event) => {
  17970. if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) {
  17971. focus(true, true);
  17972. }
  17973. };
  17974. const onHide = () => {
  17975. pickerActualVisible.value = false;
  17976. pickerVisible.value = false;
  17977. ignoreFocusEvent = false;
  17978. emit("visible-change", false);
  17979. };
  17980. const handleOpen = () => {
  17981. pickerVisible.value = true;
  17982. };
  17983. const handleClose = () => {
  17984. pickerVisible.value = false;
  17985. };
  17986. const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => {
  17987. ignoreFocusEvent = isIgnoreFocusEvent;
  17988. const [leftInput, rightInput] = vue.unref(refInput);
  17989. let input = leftInput;
  17990. if (!focusStartInput && isRangeInput.value) {
  17991. input = rightInput;
  17992. }
  17993. if (input) {
  17994. input.focus();
  17995. }
  17996. };
  17997. const handleFocusInput = (e) => {
  17998. if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) {
  17999. return;
  18000. }
  18001. pickerVisible.value = true;
  18002. emit("focus", e);
  18003. };
  18004. let currentHandleBlurDeferCallback = void 0;
  18005. const handleBlurInput = (e) => {
  18006. const handleBlurDefer = async () => {
  18007. setTimeout(() => {
  18008. var _a;
  18009. if (currentHandleBlurDeferCallback === handleBlurDefer) {
  18010. if (!(((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((input) => {
  18011. return input.contains(document.activeElement);
  18012. }).length === 0) {
  18013. handleChange();
  18014. pickerVisible.value = false;
  18015. emit("blur", e);
  18016. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  18017. }
  18018. hasJustTabExitedInput = false;
  18019. }
  18020. }, 0);
  18021. };
  18022. currentHandleBlurDeferCallback = handleBlurDefer;
  18023. handleBlurDefer();
  18024. };
  18025. const pickerDisabled = vue.computed(() => {
  18026. return props.disabled || (form == null ? void 0 : form.disabled);
  18027. });
  18028. const parsedValue = vue.computed(() => {
  18029. let dayOrDays;
  18030. if (valueIsEmpty.value) {
  18031. if (pickerOptions.value.getDefaultValue) {
  18032. dayOrDays = pickerOptions.value.getDefaultValue();
  18033. }
  18034. } else {
  18035. if (isArray$1(props.modelValue)) {
  18036. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  18037. } else {
  18038. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  18039. }
  18040. }
  18041. if (pickerOptions.value.getRangeAvailableTime) {
  18042. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  18043. if (!isEqual$1(availableResult, dayOrDays)) {
  18044. dayOrDays = availableResult;
  18045. if (!valueIsEmpty.value) {
  18046. emitInput(isArray$1(dayOrDays) ? dayOrDays.map((_) => _.toDate()) : dayOrDays.toDate());
  18047. }
  18048. }
  18049. }
  18050. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  18051. dayOrDays = [];
  18052. }
  18053. return dayOrDays;
  18054. });
  18055. const displayValue = vue.computed(() => {
  18056. if (!pickerOptions.value.panelReady)
  18057. return "";
  18058. const formattedValue = formatDayjsToString(parsedValue.value);
  18059. if (isArray$1(userInput.value)) {
  18060. return [
  18061. userInput.value[0] || formattedValue && formattedValue[0] || "",
  18062. userInput.value[1] || formattedValue && formattedValue[1] || ""
  18063. ];
  18064. } else if (userInput.value !== null) {
  18065. return userInput.value;
  18066. }
  18067. if (!isTimePicker.value && valueIsEmpty.value)
  18068. return "";
  18069. if (!pickerVisible.value && valueIsEmpty.value)
  18070. return "";
  18071. if (formattedValue) {
  18072. return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  18073. }
  18074. return "";
  18075. });
  18076. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  18077. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  18078. const isDatesPicker = vue.computed(() => props.type === "dates");
  18079. const isMonthsPicker = vue.computed(() => props.type === "months");
  18080. const isYearsPicker = vue.computed(() => props.type === "years");
  18081. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  18082. const showClose = vue.ref(false);
  18083. const onClearIconClick = (event) => {
  18084. if (props.readonly || pickerDisabled.value)
  18085. return;
  18086. if (showClose.value) {
  18087. event.stopPropagation();
  18088. focusOnInputBox();
  18089. if (pickerOptions.value.handleClear) {
  18090. pickerOptions.value.handleClear();
  18091. } else {
  18092. emitInput(valueOnClear.value);
  18093. }
  18094. emitChange(valueOnClear.value, true);
  18095. showClose.value = false;
  18096. pickerVisible.value = false;
  18097. }
  18098. emit("clear");
  18099. };
  18100. const valueIsEmpty = vue.computed(() => {
  18101. const { modelValue } = props;
  18102. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  18103. });
  18104. const onMouseDownInput = async (event) => {
  18105. var _a;
  18106. if (props.readonly || pickerDisabled.value)
  18107. return;
  18108. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  18109. pickerVisible.value = true;
  18110. }
  18111. };
  18112. const onMouseEnter = () => {
  18113. if (props.readonly || pickerDisabled.value)
  18114. return;
  18115. if (!valueIsEmpty.value && props.clearable) {
  18116. showClose.value = true;
  18117. }
  18118. };
  18119. const onMouseLeave = () => {
  18120. showClose.value = false;
  18121. };
  18122. const onTouchStartInput = (event) => {
  18123. var _a;
  18124. if (props.readonly || pickerDisabled.value)
  18125. return;
  18126. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  18127. pickerVisible.value = true;
  18128. }
  18129. };
  18130. const isRangeInput = vue.computed(() => {
  18131. return props.type.includes("range");
  18132. });
  18133. const pickerSize = useFormSize();
  18134. const popperEl = vue.computed(() => {
  18135. var _a, _b;
  18136. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  18137. });
  18138. const actualInputRef = vue.computed(() => {
  18139. var _a;
  18140. if (vue.unref(isRangeInput)) {
  18141. return vue.unref(inputRef);
  18142. }
  18143. return (_a = vue.unref(inputRef)) == null ? void 0 : _a.$el;
  18144. });
  18145. const stophandle = onClickOutside(actualInputRef, (e) => {
  18146. const unrefedPopperEl = vue.unref(popperEl);
  18147. const inputEl = vue.unref(actualInputRef);
  18148. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  18149. return;
  18150. pickerVisible.value = false;
  18151. });
  18152. vue.onBeforeUnmount(() => {
  18153. stophandle == null ? void 0 : stophandle();
  18154. });
  18155. const userInput = vue.ref(null);
  18156. const handleChange = () => {
  18157. if (userInput.value) {
  18158. const value = parseUserInputToDayjs(displayValue.value);
  18159. if (value) {
  18160. if (isValidValue(value)) {
  18161. emitInput(isArray$1(value) ? value.map((_) => _.toDate()) : value.toDate());
  18162. userInput.value = null;
  18163. }
  18164. }
  18165. }
  18166. if (userInput.value === "") {
  18167. emitInput(valueOnClear.value);
  18168. emitChange(valueOnClear.value);
  18169. userInput.value = null;
  18170. }
  18171. };
  18172. const parseUserInputToDayjs = (value) => {
  18173. if (!value)
  18174. return null;
  18175. return pickerOptions.value.parseUserInput(value);
  18176. };
  18177. const formatDayjsToString = (value) => {
  18178. if (!value)
  18179. return null;
  18180. return pickerOptions.value.formatToString(value);
  18181. };
  18182. const isValidValue = (value) => {
  18183. return pickerOptions.value.isValidValue(value);
  18184. };
  18185. const handleKeydownInput = async (event) => {
  18186. if (props.readonly || pickerDisabled.value)
  18187. return;
  18188. const { code } = event;
  18189. emitKeydown(event);
  18190. if (code === EVENT_CODE.esc) {
  18191. if (pickerVisible.value === true) {
  18192. pickerVisible.value = false;
  18193. event.preventDefault();
  18194. event.stopPropagation();
  18195. }
  18196. return;
  18197. }
  18198. if (code === EVENT_CODE.down) {
  18199. if (pickerOptions.value.handleFocusPicker) {
  18200. event.preventDefault();
  18201. event.stopPropagation();
  18202. }
  18203. if (pickerVisible.value === false) {
  18204. pickerVisible.value = true;
  18205. await vue.nextTick();
  18206. }
  18207. if (pickerOptions.value.handleFocusPicker) {
  18208. pickerOptions.value.handleFocusPicker();
  18209. return;
  18210. }
  18211. }
  18212. if (code === EVENT_CODE.tab) {
  18213. hasJustTabExitedInput = true;
  18214. return;
  18215. }
  18216. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  18217. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  18218. handleChange();
  18219. pickerVisible.value = false;
  18220. }
  18221. event.stopPropagation();
  18222. return;
  18223. }
  18224. if (userInput.value) {
  18225. event.stopPropagation();
  18226. return;
  18227. }
  18228. if (pickerOptions.value.handleKeydownInput) {
  18229. pickerOptions.value.handleKeydownInput(event);
  18230. }
  18231. };
  18232. const onUserInput = (e) => {
  18233. userInput.value = e;
  18234. if (!pickerVisible.value) {
  18235. pickerVisible.value = true;
  18236. }
  18237. };
  18238. const handleStartInput = (event) => {
  18239. const target = event.target;
  18240. if (userInput.value) {
  18241. userInput.value = [target.value, userInput.value[1]];
  18242. } else {
  18243. userInput.value = [target.value, null];
  18244. }
  18245. };
  18246. const handleEndInput = (event) => {
  18247. const target = event.target;
  18248. if (userInput.value) {
  18249. userInput.value = [userInput.value[0], target.value];
  18250. } else {
  18251. userInput.value = [null, target.value];
  18252. }
  18253. };
  18254. const handleStartChange = () => {
  18255. var _a;
  18256. const values = userInput.value;
  18257. const value = parseUserInputToDayjs(values && values[0]);
  18258. const parsedVal = vue.unref(parsedValue);
  18259. if (value && value.isValid()) {
  18260. userInput.value = [
  18261. formatDayjsToString(value),
  18262. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  18263. ];
  18264. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  18265. if (isValidValue(newValue)) {
  18266. emitInput(newValue);
  18267. userInput.value = null;
  18268. }
  18269. }
  18270. };
  18271. const handleEndChange = () => {
  18272. var _a;
  18273. const values = vue.unref(userInput);
  18274. const value = parseUserInputToDayjs(values && values[1]);
  18275. const parsedVal = vue.unref(parsedValue);
  18276. if (value && value.isValid()) {
  18277. userInput.value = [
  18278. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  18279. formatDayjsToString(value)
  18280. ];
  18281. const newValue = [parsedVal && parsedVal[0], value];
  18282. if (isValidValue(newValue)) {
  18283. emitInput(newValue);
  18284. userInput.value = null;
  18285. }
  18286. }
  18287. };
  18288. const pickerOptions = vue.ref({});
  18289. const onSetPickerOption = (e) => {
  18290. pickerOptions.value[e[0]] = e[1];
  18291. pickerOptions.value.panelReady = true;
  18292. };
  18293. const onCalendarChange = (e) => {
  18294. emit("calendar-change", e);
  18295. };
  18296. const onPanelChange = (value, mode, view) => {
  18297. emit("panel-change", value, mode, view);
  18298. };
  18299. vue.provide("EP_PICKER_BASE", {
  18300. props
  18301. });
  18302. expose({
  18303. focus,
  18304. handleFocusInput,
  18305. handleBlurInput,
  18306. handleOpen,
  18307. handleClose,
  18308. onPick
  18309. });
  18310. return (_ctx, _cache) => {
  18311. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  18312. ref_key: "refPopper",
  18313. ref: refPopper,
  18314. visible: pickerVisible.value,
  18315. effect: "light",
  18316. pure: "",
  18317. trigger: "click"
  18318. }, _ctx.$attrs, {
  18319. role: "dialog",
  18320. teleported: "",
  18321. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  18322. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  18323. "popper-options": vue.unref(elPopperOptions),
  18324. "fallback-placements": ["bottom", "top", "right", "left"],
  18325. "gpu-acceleration": false,
  18326. "stop-popper-mouse-event": false,
  18327. "hide-after": 0,
  18328. persistent: "",
  18329. onBeforeShow,
  18330. onShow,
  18331. onHide
  18332. }), {
  18333. default: vue.withCtx(() => [
  18334. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  18335. key: 0,
  18336. id: _ctx.id,
  18337. ref_key: "inputRef",
  18338. ref: inputRef,
  18339. "container-role": "combobox",
  18340. "model-value": vue.unref(displayValue),
  18341. name: _ctx.name,
  18342. size: vue.unref(pickerSize),
  18343. disabled: vue.unref(pickerDisabled),
  18344. placeholder: _ctx.placeholder,
  18345. class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  18346. style: vue.normalizeStyle(_ctx.$attrs.style),
  18347. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || vue.unref(isMonthsPicker) || vue.unref(isYearsPicker) || _ctx.type === "week",
  18348. "aria-label": _ctx.ariaLabel,
  18349. tabindex: _ctx.tabindex,
  18350. "validate-event": false,
  18351. onInput: onUserInput,
  18352. onFocus: handleFocusInput,
  18353. onBlur: handleBlurInput,
  18354. onKeydown: handleKeydownInput,
  18355. onChange: handleChange,
  18356. onMousedown: onMouseDownInput,
  18357. onMouseenter: onMouseEnter,
  18358. onMouseleave: onMouseLeave,
  18359. onTouchstartPassive: onTouchStartInput,
  18360. onClick: vue.withModifiers(() => {
  18361. }, ["stop"])
  18362. }, {
  18363. prefix: vue.withCtx(() => [
  18364. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18365. key: 0,
  18366. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  18367. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  18368. onTouchstartPassive: onTouchStartInput
  18369. }, {
  18370. default: vue.withCtx(() => [
  18371. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18372. ]),
  18373. _: 1
  18374. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18375. ]),
  18376. suffix: vue.withCtx(() => [
  18377. showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18378. key: 0,
  18379. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  18380. onClick: vue.withModifiers(onClearIconClick, ["stop"])
  18381. }, {
  18382. default: vue.withCtx(() => [
  18383. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18384. ]),
  18385. _: 1
  18386. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  18387. ]),
  18388. _: 1
  18389. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onKeydown", "onClick"])) : (vue.openBlock(), vue.createElementBlock("div", {
  18390. key: 1,
  18391. ref_key: "inputRef",
  18392. ref: inputRef,
  18393. class: vue.normalizeClass(vue.unref(rangeInputKls)),
  18394. style: vue.normalizeStyle(_ctx.$attrs.style),
  18395. onClick: handleFocusInput,
  18396. onMouseenter: onMouseEnter,
  18397. onMouseleave: onMouseLeave,
  18398. onTouchstartPassive: onTouchStartInput,
  18399. onKeydown: handleKeydownInput
  18400. }, [
  18401. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18402. key: 0,
  18403. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")]),
  18404. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  18405. onTouchstartPassive: onTouchStartInput
  18406. }, {
  18407. default: vue.withCtx(() => [
  18408. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18409. ]),
  18410. _: 1
  18411. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  18412. vue.createElementVNode("input", {
  18413. id: _ctx.id && _ctx.id[0],
  18414. autocomplete: "off",
  18415. name: _ctx.name && _ctx.name[0],
  18416. placeholder: _ctx.startPlaceholder,
  18417. value: vue.unref(displayValue) && vue.unref(displayValue)[0],
  18418. disabled: vue.unref(pickerDisabled),
  18419. readonly: !_ctx.editable || _ctx.readonly,
  18420. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  18421. onMousedown: onMouseDownInput,
  18422. onInput: handleStartInput,
  18423. onChange: handleStartChange,
  18424. onFocus: handleFocusInput,
  18425. onBlur: handleBlurInput
  18426. }, null, 42, ["id", "name", "placeholder", "value", "disabled", "readonly"]),
  18427. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  18428. vue.createElementVNode("span", {
  18429. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  18430. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  18431. ]),
  18432. vue.createElementVNode("input", {
  18433. id: _ctx.id && _ctx.id[1],
  18434. autocomplete: "off",
  18435. name: _ctx.name && _ctx.name[1],
  18436. placeholder: _ctx.endPlaceholder,
  18437. value: vue.unref(displayValue) && vue.unref(displayValue)[1],
  18438. disabled: vue.unref(pickerDisabled),
  18439. readonly: !_ctx.editable || _ctx.readonly,
  18440. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  18441. onMousedown: onMouseDownInput,
  18442. onFocus: handleFocusInput,
  18443. onBlur: handleBlurInput,
  18444. onInput: handleEndInput,
  18445. onChange: handleEndChange
  18446. }, null, 42, ["id", "name", "placeholder", "value", "disabled", "readonly"]),
  18447. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18448. key: 1,
  18449. class: vue.normalizeClass(vue.unref(clearIconKls)),
  18450. onClick: onClearIconClick
  18451. }, {
  18452. default: vue.withCtx(() => [
  18453. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18454. ]),
  18455. _: 1
  18456. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  18457. ], 38))
  18458. ]),
  18459. content: vue.withCtx(() => [
  18460. vue.renderSlot(_ctx.$slots, "default", {
  18461. visible: pickerVisible.value,
  18462. actualVisible: pickerActualVisible.value,
  18463. parsedValue: vue.unref(parsedValue),
  18464. format: _ctx.format,
  18465. dateFormat: _ctx.dateFormat,
  18466. timeFormat: _ctx.timeFormat,
  18467. unlinkPanels: _ctx.unlinkPanels,
  18468. type: _ctx.type,
  18469. defaultValue: _ctx.defaultValue,
  18470. onPick,
  18471. onSelectRange: setSelectionRange,
  18472. onSetPickerOption,
  18473. onCalendarChange,
  18474. onPanelChange,
  18475. onKeydown: onKeydownPopperContent,
  18476. onMousedown: vue.withModifiers(() => {
  18477. }, ["stop"])
  18478. })
  18479. ]),
  18480. _: 3
  18481. }, 16, ["visible", "transition", "popper-class", "popper-options"]);
  18482. };
  18483. }
  18484. });
  18485. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "picker.vue"]]);
  18486. const panelTimePickerProps = buildProps({
  18487. ...timePanelSharedProps,
  18488. datetimeRole: String,
  18489. parsedValue: {
  18490. type: definePropType(Object)
  18491. }
  18492. });
  18493. const useTimePanel = ({
  18494. getAvailableHours,
  18495. getAvailableMinutes,
  18496. getAvailableSeconds
  18497. }) => {
  18498. const getAvailableTime = (date, role, first, compareDate) => {
  18499. const availableTimeGetters = {
  18500. hour: getAvailableHours,
  18501. minute: getAvailableMinutes,
  18502. second: getAvailableSeconds
  18503. };
  18504. let result = date;
  18505. ["hour", "minute", "second"].forEach((type) => {
  18506. if (availableTimeGetters[type]) {
  18507. let availableTimeSlots;
  18508. const method = availableTimeGetters[type];
  18509. switch (type) {
  18510. case "minute": {
  18511. availableTimeSlots = method(result.hour(), role, compareDate);
  18512. break;
  18513. }
  18514. case "second": {
  18515. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18516. break;
  18517. }
  18518. default: {
  18519. availableTimeSlots = method(role, compareDate);
  18520. break;
  18521. }
  18522. }
  18523. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  18524. const pos = first ? 0 : availableTimeSlots.length - 1;
  18525. result = result[type](availableTimeSlots[pos]);
  18526. }
  18527. }
  18528. });
  18529. return result;
  18530. };
  18531. const timePickerOptions = {};
  18532. const onSetOption = ([key, val]) => {
  18533. timePickerOptions[key] = val;
  18534. };
  18535. return {
  18536. timePickerOptions,
  18537. getAvailableTime,
  18538. onSetOption
  18539. };
  18540. };
  18541. const makeAvailableArr = (disabledList) => {
  18542. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18543. const getNumber = (predicate) => predicate !== true;
  18544. return disabledList.map(trueOrNumber).filter(getNumber);
  18545. };
  18546. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18547. const getHoursList = (role, compare) => {
  18548. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  18549. };
  18550. const getMinutesList = (hour, role, compare) => {
  18551. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  18552. };
  18553. const getSecondsList = (hour, minute, role, compare) => {
  18554. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  18555. };
  18556. return {
  18557. getHoursList,
  18558. getMinutesList,
  18559. getSecondsList
  18560. };
  18561. };
  18562. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18563. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18564. const getAvailableHours = (role, compare) => {
  18565. return makeAvailableArr(getHoursList(role, compare));
  18566. };
  18567. const getAvailableMinutes = (hour, role, compare) => {
  18568. return makeAvailableArr(getMinutesList(hour, role, compare));
  18569. };
  18570. const getAvailableSeconds = (hour, minute, role, compare) => {
  18571. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18572. };
  18573. return {
  18574. getAvailableHours,
  18575. getAvailableMinutes,
  18576. getAvailableSeconds
  18577. };
  18578. };
  18579. const useOldValue = (props) => {
  18580. const oldValue = vue.ref(props.parsedValue);
  18581. vue.watch(() => props.visible, (val) => {
  18582. if (!val) {
  18583. oldValue.value = props.parsedValue;
  18584. }
  18585. });
  18586. return oldValue;
  18587. };
  18588. const nodeList = /* @__PURE__ */ new Map();
  18589. if (isClient) {
  18590. let startClick;
  18591. document.addEventListener("mousedown", (e) => startClick = e);
  18592. document.addEventListener("mouseup", (e) => {
  18593. if (startClick) {
  18594. for (const handlers of nodeList.values()) {
  18595. for (const { documentHandler } of handlers) {
  18596. documentHandler(e, startClick);
  18597. }
  18598. }
  18599. startClick = void 0;
  18600. }
  18601. });
  18602. }
  18603. function createDocumentHandler(el, binding) {
  18604. let excludes = [];
  18605. if (Array.isArray(binding.arg)) {
  18606. excludes = binding.arg;
  18607. } else if (isElement$1(binding.arg)) {
  18608. excludes.push(binding.arg);
  18609. }
  18610. return function(mouseup, mousedown) {
  18611. const popperRef = binding.instance.popperRef;
  18612. const mouseUpTarget = mouseup.target;
  18613. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  18614. const isBound = !binding || !binding.instance;
  18615. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18616. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18617. const isSelf = el === mouseUpTarget;
  18618. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18619. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18620. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  18621. return;
  18622. }
  18623. binding.value(mouseup, mousedown);
  18624. };
  18625. }
  18626. const ClickOutside = {
  18627. beforeMount(el, binding) {
  18628. if (!nodeList.has(el)) {
  18629. nodeList.set(el, []);
  18630. }
  18631. nodeList.get(el).push({
  18632. documentHandler: createDocumentHandler(el, binding),
  18633. bindingFn: binding.value
  18634. });
  18635. },
  18636. updated(el, binding) {
  18637. if (!nodeList.has(el)) {
  18638. nodeList.set(el, []);
  18639. }
  18640. const handlers = nodeList.get(el);
  18641. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18642. const newHandler = {
  18643. documentHandler: createDocumentHandler(el, binding),
  18644. bindingFn: binding.value
  18645. };
  18646. if (oldHandlerIndex >= 0) {
  18647. handlers.splice(oldHandlerIndex, 1, newHandler);
  18648. } else {
  18649. handlers.push(newHandler);
  18650. }
  18651. },
  18652. unmounted(el) {
  18653. nodeList.delete(el);
  18654. }
  18655. };
  18656. const REPEAT_INTERVAL = 100;
  18657. const REPEAT_DELAY = 600;
  18658. const vRepeatClick = {
  18659. beforeMount(el, binding) {
  18660. const value = binding.value;
  18661. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18662. let intervalId;
  18663. let delayId;
  18664. const handler = () => isFunction$1(value) ? value() : value.handler();
  18665. const clear = () => {
  18666. if (delayId) {
  18667. clearTimeout(delayId);
  18668. delayId = void 0;
  18669. }
  18670. if (intervalId) {
  18671. clearInterval(intervalId);
  18672. intervalId = void 0;
  18673. }
  18674. };
  18675. el.addEventListener("mousedown", (evt) => {
  18676. if (evt.button !== 0)
  18677. return;
  18678. clear();
  18679. handler();
  18680. document.addEventListener("mouseup", () => clear(), {
  18681. once: true
  18682. });
  18683. delayId = setTimeout(() => {
  18684. intervalId = setInterval(() => {
  18685. handler();
  18686. }, interval);
  18687. }, delay);
  18688. });
  18689. }
  18690. };
  18691. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18692. const FOCUS_STACK = [];
  18693. const FOCUS_HANDLER = (e) => {
  18694. if (FOCUS_STACK.length === 0)
  18695. return;
  18696. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18697. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  18698. if (focusableElement.length === 1) {
  18699. e.preventDefault();
  18700. if (document.activeElement !== focusableElement[0]) {
  18701. focusableElement[0].focus();
  18702. }
  18703. return;
  18704. }
  18705. const goingBackward = e.shiftKey;
  18706. const isFirst = e.target === focusableElement[0];
  18707. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18708. if (isFirst && goingBackward) {
  18709. e.preventDefault();
  18710. focusableElement[focusableElement.length - 1].focus();
  18711. }
  18712. if (isLast && !goingBackward) {
  18713. e.preventDefault();
  18714. focusableElement[0].focus();
  18715. }
  18716. }
  18717. };
  18718. const TrapFocus = {
  18719. beforeMount(el) {
  18720. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18721. FOCUS_STACK.push(el);
  18722. if (FOCUS_STACK.length <= 1) {
  18723. document.addEventListener("keydown", FOCUS_HANDLER);
  18724. }
  18725. },
  18726. updated(el) {
  18727. vue.nextTick(() => {
  18728. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18729. });
  18730. },
  18731. unmounted() {
  18732. FOCUS_STACK.shift();
  18733. if (FOCUS_STACK.length === 0) {
  18734. document.removeEventListener("keydown", FOCUS_HANDLER);
  18735. }
  18736. }
  18737. };
  18738. 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;/**
  18739. * Checks if an event is supported in the current execution environment.
  18740. *
  18741. * NOTE: This will not work correctly for non-generic events such as `change`,
  18742. * `reset`, `load`, `error`, and `select`.
  18743. *
  18744. * Borrows from Modernizr.
  18745. *
  18746. * @param {string} eventNameSuffix Event name, e.g. "click".
  18747. * @param {?boolean} capture Check if the capture phase is supported.
  18748. * @return {boolean} True if the event is supported.
  18749. * @internal
  18750. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  18751. */
  18752. const mousewheel = function(element, callback) {
  18753. if (element && element.addEventListener) {
  18754. const fn = function(event) {
  18755. const normalized = Y(event);
  18756. callback && Reflect.apply(callback, this, [event, normalized]);
  18757. };
  18758. element.addEventListener("wheel", fn, { passive: true });
  18759. }
  18760. };
  18761. const Mousewheel = {
  18762. beforeMount(el, binding) {
  18763. mousewheel(el, binding.value);
  18764. }
  18765. };
  18766. const basicTimeSpinnerProps = buildProps({
  18767. role: {
  18768. type: String,
  18769. required: true
  18770. },
  18771. spinnerDate: {
  18772. type: definePropType(Object),
  18773. required: true
  18774. },
  18775. showSeconds: {
  18776. type: Boolean,
  18777. default: true
  18778. },
  18779. arrowControl: Boolean,
  18780. amPmMode: {
  18781. type: definePropType(String),
  18782. default: ""
  18783. },
  18784. ...disabledTimeListsProps
  18785. });
  18786. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  18787. __name: "basic-time-spinner",
  18788. props: basicTimeSpinnerProps,
  18789. emits: ["change", "select-range", "set-option"],
  18790. setup(__props, { emit }) {
  18791. const props = __props;
  18792. const ns = useNamespace("time");
  18793. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  18794. let isScrolling = false;
  18795. const currentScrollbar = vue.ref();
  18796. const listHoursRef = vue.ref();
  18797. const listMinutesRef = vue.ref();
  18798. const listSecondsRef = vue.ref();
  18799. const listRefsMap = {
  18800. hours: listHoursRef,
  18801. minutes: listMinutesRef,
  18802. seconds: listSecondsRef
  18803. };
  18804. const spinnerItems = vue.computed(() => {
  18805. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  18806. });
  18807. const timePartials = vue.computed(() => {
  18808. const { spinnerDate } = props;
  18809. const hours = spinnerDate.hour();
  18810. const minutes = spinnerDate.minute();
  18811. const seconds = spinnerDate.second();
  18812. return { hours, minutes, seconds };
  18813. });
  18814. const timeList = vue.computed(() => {
  18815. const { hours, minutes } = vue.unref(timePartials);
  18816. return {
  18817. hours: getHoursList(props.role),
  18818. minutes: getMinutesList(hours, props.role),
  18819. seconds: getSecondsList(hours, minutes, props.role)
  18820. };
  18821. });
  18822. const arrowControlTimeList = vue.computed(() => {
  18823. const { hours, minutes, seconds } = vue.unref(timePartials);
  18824. return {
  18825. hours: buildTimeList(hours, 23),
  18826. minutes: buildTimeList(minutes, 59),
  18827. seconds: buildTimeList(seconds, 59)
  18828. };
  18829. });
  18830. const debouncedResetScroll = debounce((type) => {
  18831. isScrolling = false;
  18832. adjustCurrentSpinner(type);
  18833. }, 200);
  18834. const getAmPmFlag = (hour) => {
  18835. const shouldShowAmPm = !!props.amPmMode;
  18836. if (!shouldShowAmPm)
  18837. return "";
  18838. const isCapital = props.amPmMode === "A";
  18839. let content = hour < 12 ? " am" : " pm";
  18840. if (isCapital)
  18841. content = content.toUpperCase();
  18842. return content;
  18843. };
  18844. const emitSelectRange = (type) => {
  18845. let range;
  18846. switch (type) {
  18847. case "hours":
  18848. range = [0, 2];
  18849. break;
  18850. case "minutes":
  18851. range = [3, 5];
  18852. break;
  18853. case "seconds":
  18854. range = [6, 8];
  18855. break;
  18856. }
  18857. const [left, right] = range;
  18858. emit("select-range", left, right);
  18859. currentScrollbar.value = type;
  18860. };
  18861. const adjustCurrentSpinner = (type) => {
  18862. adjustSpinner(type, vue.unref(timePartials)[type]);
  18863. };
  18864. const adjustSpinners = () => {
  18865. adjustCurrentSpinner("hours");
  18866. adjustCurrentSpinner("minutes");
  18867. adjustCurrentSpinner("seconds");
  18868. };
  18869. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  18870. const adjustSpinner = (type, value) => {
  18871. if (props.arrowControl)
  18872. return;
  18873. const scrollbar = vue.unref(listRefsMap[type]);
  18874. if (scrollbar && scrollbar.$el) {
  18875. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  18876. }
  18877. };
  18878. const typeItemHeight = (type) => {
  18879. const scrollbar = vue.unref(listRefsMap[type]);
  18880. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  18881. if (listItem) {
  18882. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  18883. }
  18884. return 0;
  18885. };
  18886. const onIncrement = () => {
  18887. scrollDown(1);
  18888. };
  18889. const onDecrement = () => {
  18890. scrollDown(-1);
  18891. };
  18892. const scrollDown = (step) => {
  18893. if (!currentScrollbar.value) {
  18894. emitSelectRange("hours");
  18895. }
  18896. const label = currentScrollbar.value;
  18897. const now = vue.unref(timePartials)[label];
  18898. const total = currentScrollbar.value === "hours" ? 24 : 60;
  18899. const next = findNextUnDisabled(label, now, step, total);
  18900. modifyDateField(label, next);
  18901. adjustSpinner(label, next);
  18902. vue.nextTick(() => emitSelectRange(label));
  18903. };
  18904. const findNextUnDisabled = (type, now, step, total) => {
  18905. let next = (now + step + total) % total;
  18906. const list = vue.unref(timeList)[type];
  18907. while (list[next] && next !== now) {
  18908. next = (next + step + total) % total;
  18909. }
  18910. return next;
  18911. };
  18912. const modifyDateField = (type, value) => {
  18913. const list = vue.unref(timeList)[type];
  18914. const isDisabled = list[value];
  18915. if (isDisabled)
  18916. return;
  18917. const { hours, minutes, seconds } = vue.unref(timePartials);
  18918. let changeTo;
  18919. switch (type) {
  18920. case "hours":
  18921. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  18922. break;
  18923. case "minutes":
  18924. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  18925. break;
  18926. case "seconds":
  18927. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  18928. break;
  18929. }
  18930. emit("change", changeTo);
  18931. };
  18932. const handleClick = (type, { value, disabled }) => {
  18933. if (!disabled) {
  18934. modifyDateField(type, value);
  18935. emitSelectRange(type);
  18936. adjustSpinner(type, value);
  18937. }
  18938. };
  18939. const handleScroll = (type) => {
  18940. isScrolling = true;
  18941. debouncedResetScroll(type);
  18942. 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);
  18943. modifyDateField(type, value);
  18944. };
  18945. const scrollBarHeight = (type) => {
  18946. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  18947. };
  18948. const bindScrollEvent = () => {
  18949. const bindFunction = (type) => {
  18950. const scrollbar = vue.unref(listRefsMap[type]);
  18951. if (scrollbar && scrollbar.$el) {
  18952. getScrollbarElement(scrollbar.$el).onscroll = () => {
  18953. handleScroll(type);
  18954. };
  18955. }
  18956. };
  18957. bindFunction("hours");
  18958. bindFunction("minutes");
  18959. bindFunction("seconds");
  18960. };
  18961. vue.onMounted(() => {
  18962. vue.nextTick(() => {
  18963. !props.arrowControl && bindScrollEvent();
  18964. adjustSpinners();
  18965. if (props.role === "start")
  18966. emitSelectRange("hours");
  18967. });
  18968. });
  18969. const setRef = (scrollbar, type) => {
  18970. listRefsMap[type].value = scrollbar;
  18971. };
  18972. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  18973. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  18974. vue.watch(() => props.spinnerDate, () => {
  18975. if (isScrolling)
  18976. return;
  18977. adjustSpinners();
  18978. });
  18979. return (_ctx, _cache) => {
  18980. return vue.openBlock(), vue.createElementBlock("div", {
  18981. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  18982. }, [
  18983. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  18984. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  18985. key: item,
  18986. ref_for: true,
  18987. ref: (scrollbar) => setRef(scrollbar, item),
  18988. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  18989. "wrap-style": "max-height: inherit;",
  18990. "view-class": vue.unref(ns).be("spinner", "list"),
  18991. noresize: "",
  18992. tag: "ul",
  18993. onMouseenter: ($event) => emitSelectRange(item),
  18994. onMousemove: ($event) => adjustCurrentSpinner(item)
  18995. }, {
  18996. default: vue.withCtx(() => [
  18997. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  18998. return vue.openBlock(), vue.createElementBlock("li", {
  18999. key,
  19000. class: vue.normalizeClass([
  19001. vue.unref(ns).be("spinner", "item"),
  19002. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  19003. vue.unref(ns).is("disabled", disabled)
  19004. ]),
  19005. onClick: ($event) => handleClick(item, { value: key, disabled })
  19006. }, [
  19007. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19008. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  19009. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  19010. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  19011. ], 64))
  19012. ], 10, ["onClick"]);
  19013. }), 128))
  19014. ]),
  19015. _: 2
  19016. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  19017. }), 128)) : vue.createCommentVNode("v-if", true),
  19018. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  19019. return vue.openBlock(), vue.createElementBlock("div", {
  19020. key: item,
  19021. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  19022. onMouseenter: ($event) => emitSelectRange(item)
  19023. }, [
  19024. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  19025. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  19026. }, {
  19027. default: vue.withCtx(() => [
  19028. vue.createVNode(vue.unref(arrow_up_default))
  19029. ]),
  19030. _: 1
  19031. }, 8, ["class"])), [
  19032. [vue.unref(vRepeatClick), onDecrement]
  19033. ]),
  19034. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  19035. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  19036. }, {
  19037. default: vue.withCtx(() => [
  19038. vue.createVNode(vue.unref(arrow_down_default))
  19039. ]),
  19040. _: 1
  19041. }, 8, ["class"])), [
  19042. [vue.unref(vRepeatClick), onIncrement]
  19043. ]),
  19044. vue.createElementVNode("ul", {
  19045. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  19046. }, [
  19047. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  19048. return vue.openBlock(), vue.createElementBlock("li", {
  19049. key,
  19050. class: vue.normalizeClass([
  19051. vue.unref(ns).be("spinner", "item"),
  19052. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  19053. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  19054. ])
  19055. }, [
  19056. typeof time === "number" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19057. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19058. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  19059. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  19060. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  19061. ], 64))
  19062. ], 64)) : vue.createCommentVNode("v-if", true)
  19063. ], 2);
  19064. }), 128))
  19065. ], 2)
  19066. ], 42, ["onMouseenter"]);
  19067. }), 128)) : vue.createCommentVNode("v-if", true)
  19068. ], 2);
  19069. };
  19070. }
  19071. });
  19072. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "basic-time-spinner.vue"]]);
  19073. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  19074. __name: "panel-time-pick",
  19075. props: panelTimePickerProps,
  19076. emits: ["pick", "select-range", "set-picker-option"],
  19077. setup(__props, { emit }) {
  19078. const props = __props;
  19079. const pickerBase = vue.inject("EP_PICKER_BASE");
  19080. const {
  19081. arrowControl,
  19082. disabledHours,
  19083. disabledMinutes,
  19084. disabledSeconds,
  19085. defaultValue
  19086. } = pickerBase.props;
  19087. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  19088. const ns = useNamespace("time");
  19089. const { t, lang } = useLocale();
  19090. const selectionRange = vue.ref([0, 2]);
  19091. const oldValue = useOldValue(props);
  19092. const transitionName = vue.computed(() => {
  19093. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  19094. });
  19095. const showSeconds = vue.computed(() => {
  19096. return props.format.includes("ss");
  19097. });
  19098. const amPmMode = vue.computed(() => {
  19099. if (props.format.includes("A"))
  19100. return "A";
  19101. if (props.format.includes("a"))
  19102. return "a";
  19103. return "";
  19104. });
  19105. const isValidValue = (_date) => {
  19106. const parsedDate = dayjs(_date).locale(lang.value);
  19107. const result = getRangeAvailableTime(parsedDate);
  19108. return parsedDate.isSame(result);
  19109. };
  19110. const handleCancel = () => {
  19111. emit("pick", oldValue.value, false);
  19112. };
  19113. const handleConfirm = (visible = false, first = false) => {
  19114. if (first)
  19115. return;
  19116. emit("pick", props.parsedValue, visible);
  19117. };
  19118. const handleChange = (_date) => {
  19119. if (!props.visible) {
  19120. return;
  19121. }
  19122. const result = getRangeAvailableTime(_date).millisecond(0);
  19123. emit("pick", result, true);
  19124. };
  19125. const setSelectionRange = (start, end) => {
  19126. emit("select-range", start, end);
  19127. selectionRange.value = [start, end];
  19128. };
  19129. const changeSelectionRange = (step) => {
  19130. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  19131. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19132. const index = list.indexOf(selectionRange.value[0]);
  19133. const next = (index + step + list.length) % list.length;
  19134. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19135. };
  19136. const handleKeydown = (event) => {
  19137. const code = event.code;
  19138. const { left, right, up, down } = EVENT_CODE;
  19139. if ([left, right].includes(code)) {
  19140. const step = code === left ? -1 : 1;
  19141. changeSelectionRange(step);
  19142. event.preventDefault();
  19143. return;
  19144. }
  19145. if ([up, down].includes(code)) {
  19146. const step = code === up ? -1 : 1;
  19147. timePickerOptions["start_scrollDown"](step);
  19148. event.preventDefault();
  19149. return;
  19150. }
  19151. };
  19152. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  19153. getAvailableHours,
  19154. getAvailableMinutes,
  19155. getAvailableSeconds
  19156. });
  19157. const getRangeAvailableTime = (date) => {
  19158. return getAvailableTime(date, props.datetimeRole || "", true);
  19159. };
  19160. const parseUserInput = (value) => {
  19161. if (!value)
  19162. return null;
  19163. return dayjs(value, props.format).locale(lang.value);
  19164. };
  19165. const formatToString = (value) => {
  19166. if (!value)
  19167. return null;
  19168. return value.format(props.format);
  19169. };
  19170. const getDefaultValue = () => {
  19171. return dayjs(defaultValue).locale(lang.value);
  19172. };
  19173. emit("set-picker-option", ["isValidValue", isValidValue]);
  19174. emit("set-picker-option", ["formatToString", formatToString]);
  19175. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19176. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19177. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19178. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19179. return (_ctx, _cache) => {
  19180. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  19181. default: vue.withCtx(() => [
  19182. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  19183. key: 0,
  19184. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  19185. }, [
  19186. vue.createElementVNode("div", {
  19187. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  19188. }, [
  19189. vue.createVNode(TimeSpinner, {
  19190. ref: "spinner",
  19191. role: _ctx.datetimeRole || "start",
  19192. "arrow-control": vue.unref(arrowControl),
  19193. "show-seconds": vue.unref(showSeconds),
  19194. "am-pm-mode": vue.unref(amPmMode),
  19195. "spinner-date": _ctx.parsedValue,
  19196. "disabled-hours": vue.unref(disabledHours),
  19197. "disabled-minutes": vue.unref(disabledMinutes),
  19198. "disabled-seconds": vue.unref(disabledSeconds),
  19199. onChange: handleChange,
  19200. onSetOption: vue.unref(onSetOption),
  19201. onSelectRange: setSelectionRange
  19202. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  19203. ], 2),
  19204. vue.createElementVNode("div", {
  19205. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  19206. }, [
  19207. vue.createElementVNode("button", {
  19208. type: "button",
  19209. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  19210. onClick: handleCancel
  19211. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  19212. vue.createElementVNode("button", {
  19213. type: "button",
  19214. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  19215. onClick: ($event) => handleConfirm()
  19216. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["onClick"])
  19217. ], 2)
  19218. ], 2)) : vue.createCommentVNode("v-if", true)
  19219. ]),
  19220. _: 1
  19221. }, 8, ["name"]);
  19222. };
  19223. }
  19224. });
  19225. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "panel-time-pick.vue"]]);
  19226. const panelTimeRangeProps = buildProps({
  19227. ...timePanelSharedProps,
  19228. parsedValue: {
  19229. type: definePropType(Array)
  19230. }
  19231. });
  19232. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  19233. __name: "panel-time-range",
  19234. props: panelTimeRangeProps,
  19235. emits: ["pick", "select-range", "set-picker-option"],
  19236. setup(__props, { emit }) {
  19237. const props = __props;
  19238. const makeSelectRange = (start, end) => {
  19239. const result = [];
  19240. for (let i = start; i <= end; i++) {
  19241. result.push(i);
  19242. }
  19243. return result;
  19244. };
  19245. const { t, lang } = useLocale();
  19246. const nsTime = useNamespace("time");
  19247. const nsPicker = useNamespace("picker");
  19248. const pickerBase = vue.inject("EP_PICKER_BASE");
  19249. const {
  19250. arrowControl,
  19251. disabledHours,
  19252. disabledMinutes,
  19253. disabledSeconds,
  19254. defaultValue
  19255. } = pickerBase.props;
  19256. const startContainerKls = vue.computed(() => [
  19257. nsTime.be("range-picker", "body"),
  19258. nsTime.be("panel", "content"),
  19259. nsTime.is("arrow", arrowControl),
  19260. showSeconds.value ? "has-seconds" : ""
  19261. ]);
  19262. const endContainerKls = vue.computed(() => [
  19263. nsTime.be("range-picker", "body"),
  19264. nsTime.be("panel", "content"),
  19265. nsTime.is("arrow", arrowControl),
  19266. showSeconds.value ? "has-seconds" : ""
  19267. ]);
  19268. const startTime = vue.computed(() => props.parsedValue[0]);
  19269. const endTime = vue.computed(() => props.parsedValue[1]);
  19270. const oldValue = useOldValue(props);
  19271. const handleCancel = () => {
  19272. emit("pick", oldValue.value, false);
  19273. };
  19274. const showSeconds = vue.computed(() => {
  19275. return props.format.includes("ss");
  19276. });
  19277. const amPmMode = vue.computed(() => {
  19278. if (props.format.includes("A"))
  19279. return "A";
  19280. if (props.format.includes("a"))
  19281. return "a";
  19282. return "";
  19283. });
  19284. const handleConfirm = (visible = false) => {
  19285. emit("pick", [startTime.value, endTime.value], visible);
  19286. };
  19287. const handleMinChange = (date) => {
  19288. handleChange(date.millisecond(0), endTime.value);
  19289. };
  19290. const handleMaxChange = (date) => {
  19291. handleChange(startTime.value, date.millisecond(0));
  19292. };
  19293. const isValidValue = (_date) => {
  19294. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  19295. const result = getRangeAvailableTime(parsedDate);
  19296. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  19297. };
  19298. const handleChange = (start, end) => {
  19299. emit("pick", [start, end], true);
  19300. };
  19301. const btnConfirmDisabled = vue.computed(() => {
  19302. return startTime.value > endTime.value;
  19303. });
  19304. const selectionRange = vue.ref([0, 2]);
  19305. const setMinSelectionRange = (start, end) => {
  19306. emit("select-range", start, end, "min");
  19307. selectionRange.value = [start, end];
  19308. };
  19309. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  19310. const setMaxSelectionRange = (start, end) => {
  19311. emit("select-range", start, end, "max");
  19312. const _offset = vue.unref(offset);
  19313. selectionRange.value = [start + _offset, end + _offset];
  19314. };
  19315. const changeSelectionRange = (step) => {
  19316. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  19317. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19318. const index = list.indexOf(selectionRange.value[0]);
  19319. const next = (index + step + list.length) % list.length;
  19320. const half = list.length / 2;
  19321. if (next < half) {
  19322. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19323. } else {
  19324. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  19325. }
  19326. };
  19327. const handleKeydown = (event) => {
  19328. const code = event.code;
  19329. const { left, right, up, down } = EVENT_CODE;
  19330. if ([left, right].includes(code)) {
  19331. const step = code === left ? -1 : 1;
  19332. changeSelectionRange(step);
  19333. event.preventDefault();
  19334. return;
  19335. }
  19336. if ([up, down].includes(code)) {
  19337. const step = code === up ? -1 : 1;
  19338. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  19339. timePickerOptions[`${role}_scrollDown`](step);
  19340. event.preventDefault();
  19341. return;
  19342. }
  19343. };
  19344. const disabledHours_ = (role, compare) => {
  19345. const defaultDisable = disabledHours ? disabledHours(role) : [];
  19346. const isStart = role === "start";
  19347. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19348. const compareHour = compareDate.hour();
  19349. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  19350. return union(defaultDisable, nextDisable);
  19351. };
  19352. const disabledMinutes_ = (hour, role, compare) => {
  19353. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  19354. const isStart = role === "start";
  19355. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19356. const compareHour = compareDate.hour();
  19357. if (hour !== compareHour) {
  19358. return defaultDisable;
  19359. }
  19360. const compareMinute = compareDate.minute();
  19361. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  19362. return union(defaultDisable, nextDisable);
  19363. };
  19364. const disabledSeconds_ = (hour, minute, role, compare) => {
  19365. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  19366. const isStart = role === "start";
  19367. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19368. const compareHour = compareDate.hour();
  19369. const compareMinute = compareDate.minute();
  19370. if (hour !== compareHour || minute !== compareMinute) {
  19371. return defaultDisable;
  19372. }
  19373. const compareSecond = compareDate.second();
  19374. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  19375. return union(defaultDisable, nextDisable);
  19376. };
  19377. const getRangeAvailableTime = ([start, end]) => {
  19378. return [
  19379. getAvailableTime(start, "start", true, end),
  19380. getAvailableTime(end, "end", false, start)
  19381. ];
  19382. };
  19383. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  19384. const {
  19385. timePickerOptions,
  19386. getAvailableTime,
  19387. onSetOption
  19388. } = useTimePanel({
  19389. getAvailableHours,
  19390. getAvailableMinutes,
  19391. getAvailableSeconds
  19392. });
  19393. const parseUserInput = (days) => {
  19394. if (!days)
  19395. return null;
  19396. if (isArray$1(days)) {
  19397. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  19398. }
  19399. return dayjs(days, props.format).locale(lang.value);
  19400. };
  19401. const formatToString = (days) => {
  19402. if (!days)
  19403. return null;
  19404. if (isArray$1(days)) {
  19405. return days.map((d) => d.format(props.format));
  19406. }
  19407. return days.format(props.format);
  19408. };
  19409. const getDefaultValue = () => {
  19410. if (isArray$1(defaultValue)) {
  19411. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  19412. }
  19413. const defaultDay = dayjs(defaultValue).locale(lang.value);
  19414. return [defaultDay, defaultDay.add(60, "m")];
  19415. };
  19416. emit("set-picker-option", ["formatToString", formatToString]);
  19417. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19418. emit("set-picker-option", ["isValidValue", isValidValue]);
  19419. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19420. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19421. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19422. return (_ctx, _cache) => {
  19423. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  19424. key: 0,
  19425. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  19426. }, [
  19427. vue.createElementVNode("div", {
  19428. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  19429. }, [
  19430. vue.createElementVNode("div", {
  19431. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19432. }, [
  19433. vue.createElementVNode("div", {
  19434. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19435. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  19436. vue.createElementVNode("div", {
  19437. class: vue.normalizeClass(vue.unref(startContainerKls))
  19438. }, [
  19439. vue.createVNode(TimeSpinner, {
  19440. ref: "minSpinner",
  19441. role: "start",
  19442. "show-seconds": vue.unref(showSeconds),
  19443. "am-pm-mode": vue.unref(amPmMode),
  19444. "arrow-control": vue.unref(arrowControl),
  19445. "spinner-date": vue.unref(startTime),
  19446. "disabled-hours": disabledHours_,
  19447. "disabled-minutes": disabledMinutes_,
  19448. "disabled-seconds": disabledSeconds_,
  19449. onChange: handleMinChange,
  19450. onSetOption: vue.unref(onSetOption),
  19451. onSelectRange: setMinSelectionRange
  19452. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19453. ], 2)
  19454. ], 2),
  19455. vue.createElementVNode("div", {
  19456. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19457. }, [
  19458. vue.createElementVNode("div", {
  19459. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19460. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  19461. vue.createElementVNode("div", {
  19462. class: vue.normalizeClass(vue.unref(endContainerKls))
  19463. }, [
  19464. vue.createVNode(TimeSpinner, {
  19465. ref: "maxSpinner",
  19466. role: "end",
  19467. "show-seconds": vue.unref(showSeconds),
  19468. "am-pm-mode": vue.unref(amPmMode),
  19469. "arrow-control": vue.unref(arrowControl),
  19470. "spinner-date": vue.unref(endTime),
  19471. "disabled-hours": disabledHours_,
  19472. "disabled-minutes": disabledMinutes_,
  19473. "disabled-seconds": disabledSeconds_,
  19474. onChange: handleMaxChange,
  19475. onSetOption: vue.unref(onSetOption),
  19476. onSelectRange: setMaxSelectionRange
  19477. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19478. ], 2)
  19479. ], 2)
  19480. ], 2),
  19481. vue.createElementVNode("div", {
  19482. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  19483. }, [
  19484. vue.createElementVNode("button", {
  19485. type: "button",
  19486. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  19487. onClick: ($event) => handleCancel()
  19488. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
  19489. vue.createElementVNode("button", {
  19490. type: "button",
  19491. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  19492. disabled: vue.unref(btnConfirmDisabled),
  19493. onClick: ($event) => handleConfirm()
  19494. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
  19495. ], 2)
  19496. ], 2)) : vue.createCommentVNode("v-if", true);
  19497. };
  19498. }
  19499. });
  19500. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "panel-time-range.vue"]]);
  19501. dayjs.extend(customParseFormat);
  19502. var TimePicker = vue.defineComponent({
  19503. name: "ElTimePicker",
  19504. install: null,
  19505. props: {
  19506. ...timePickerDefaultProps,
  19507. isRange: {
  19508. type: Boolean,
  19509. default: false
  19510. }
  19511. },
  19512. emits: ["update:modelValue"],
  19513. setup(props, ctx) {
  19514. const commonPicker = vue.ref();
  19515. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  19516. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  19517. vue.provide("ElPopperOptions", props.popperOptions);
  19518. ctx.expose({
  19519. focus: (e) => {
  19520. var _a;
  19521. (_a = commonPicker.value) == null ? void 0 : _a.handleFocusInput(e);
  19522. },
  19523. blur: (e) => {
  19524. var _a;
  19525. (_a = commonPicker.value) == null ? void 0 : _a.handleBlurInput(e);
  19526. },
  19527. handleOpen: () => {
  19528. var _a;
  19529. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  19530. },
  19531. handleClose: () => {
  19532. var _a;
  19533. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  19534. }
  19535. });
  19536. return () => {
  19537. var _a;
  19538. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  19539. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  19540. "ref": commonPicker,
  19541. "type": type,
  19542. "format": format,
  19543. "onUpdate:modelValue": modelUpdater
  19544. }), {
  19545. default: (props2) => vue.createVNode(Panel, props2, null)
  19546. });
  19547. };
  19548. }
  19549. });
  19550. const ElTimePicker = withInstall(TimePicker);
  19551. const getPrevMonthLastDays = (date, count) => {
  19552. const lastDay = date.subtract(1, "month").endOf("month").date();
  19553. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19554. };
  19555. const getMonthDays = (date) => {
  19556. const days = date.daysInMonth();
  19557. return rangeArr(days).map((_, index) => index + 1);
  19558. };
  19559. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19560. const start = index * 7;
  19561. return days.slice(start, start + 7);
  19562. });
  19563. const dateTableProps = buildProps({
  19564. selectedDay: {
  19565. type: definePropType(Object)
  19566. },
  19567. range: {
  19568. type: definePropType(Array)
  19569. },
  19570. date: {
  19571. type: definePropType(Object),
  19572. required: true
  19573. },
  19574. hideHeader: {
  19575. type: Boolean
  19576. }
  19577. });
  19578. const dateTableEmits = {
  19579. pick: (value) => isObject$1(value)
  19580. };
  19581. var localeData$1 = {exports: {}};
  19582. (function(module, exports) {
  19583. !function(n, e) {
  19584. module.exports = e() ;
  19585. }(commonjsGlobal, function() {
  19586. return function(n, e, t) {
  19587. var r = e.prototype, o = function(n2) {
  19588. return n2 && (n2.indexOf ? n2 : n2.s);
  19589. }, u = function(n2, e2, t2, r2, u2) {
  19590. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  19591. return n3.slice(0, r2);
  19592. });
  19593. if (!u2)
  19594. return f;
  19595. var d = i2.weekStart;
  19596. return f.map(function(n3, e3) {
  19597. return f[(e3 + (d || 0)) % 7];
  19598. });
  19599. }, i = function() {
  19600. return t.Ls[t.locale()];
  19601. }, a = function(n2, e2) {
  19602. return n2.formats[e2] || function(n3) {
  19603. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  19604. return e3 || t2.slice(1);
  19605. });
  19606. }(n2.formats[e2.toUpperCase()]);
  19607. }, s = function() {
  19608. var n2 = this;
  19609. return { months: function(e2) {
  19610. return e2 ? e2.format("MMMM") : u(n2, "months");
  19611. }, monthsShort: function(e2) {
  19612. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  19613. }, firstDayOfWeek: function() {
  19614. return n2.$locale().weekStart || 0;
  19615. }, weekdays: function(e2) {
  19616. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  19617. }, weekdaysMin: function(e2) {
  19618. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  19619. }, weekdaysShort: function(e2) {
  19620. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  19621. }, longDateFormat: function(e2) {
  19622. return a(n2.$locale(), e2);
  19623. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  19624. };
  19625. r.localeData = function() {
  19626. return s.bind(this)();
  19627. }, t.localeData = function() {
  19628. var n2 = i();
  19629. return { firstDayOfWeek: function() {
  19630. return n2.weekStart || 0;
  19631. }, weekdays: function() {
  19632. return t.weekdays();
  19633. }, weekdaysShort: function() {
  19634. return t.weekdaysShort();
  19635. }, weekdaysMin: function() {
  19636. return t.weekdaysMin();
  19637. }, months: function() {
  19638. return t.months();
  19639. }, monthsShort: function() {
  19640. return t.monthsShort();
  19641. }, longDateFormat: function(e2) {
  19642. return a(n2, e2);
  19643. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  19644. }, t.months = function() {
  19645. return u(i(), "months");
  19646. }, t.monthsShort = function() {
  19647. return u(i(), "monthsShort", "months", 3);
  19648. }, t.weekdays = function(n2) {
  19649. return u(i(), "weekdays", null, null, n2);
  19650. }, t.weekdaysShort = function(n2) {
  19651. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  19652. }, t.weekdaysMin = function(n2) {
  19653. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  19654. };
  19655. };
  19656. });
  19657. })(localeData$1);
  19658. var localeData = localeData$1.exports;
  19659. const useDateTable = (props, emit) => {
  19660. dayjs.extend(localeData);
  19661. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  19662. const { t, lang } = useLocale();
  19663. const now = dayjs().locale(lang.value);
  19664. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  19665. const rows = vue.computed(() => {
  19666. let days = [];
  19667. if (isInRange.value) {
  19668. const [start, end] = props.range;
  19669. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19670. text: start.date() + index,
  19671. type: "current"
  19672. }));
  19673. let remaining = currentMonthRange.length % 7;
  19674. remaining = remaining === 0 ? 0 : 7 - remaining;
  19675. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19676. text: index + 1,
  19677. type: "next"
  19678. }));
  19679. days = currentMonthRange.concat(nextMonthRange);
  19680. } else {
  19681. const firstDay = props.date.startOf("month").day();
  19682. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19683. text: day,
  19684. type: "prev"
  19685. }));
  19686. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19687. text: day,
  19688. type: "current"
  19689. }));
  19690. days = [...prevMonthDays, ...currentMonthDays];
  19691. const remaining = 7 - (days.length % 7 || 7);
  19692. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  19693. text: index + 1,
  19694. type: "next"
  19695. }));
  19696. days = days.concat(nextMonthDays);
  19697. }
  19698. return toNestedArr(days);
  19699. });
  19700. const weekDays = vue.computed(() => {
  19701. const start = firstDayOfWeek;
  19702. if (start === 0) {
  19703. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19704. } else {
  19705. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19706. }
  19707. });
  19708. const getFormattedDate = (day, type) => {
  19709. switch (type) {
  19710. case "prev":
  19711. return props.date.startOf("month").subtract(1, "month").date(day);
  19712. case "next":
  19713. return props.date.startOf("month").add(1, "month").date(day);
  19714. case "current":
  19715. return props.date.date(day);
  19716. }
  19717. };
  19718. const handlePickDay = ({ text, type }) => {
  19719. const date = getFormattedDate(text, type);
  19720. emit("pick", date);
  19721. };
  19722. const getSlotData = ({ text, type }) => {
  19723. const day = getFormattedDate(text, type);
  19724. return {
  19725. isSelected: day.isSame(props.selectedDay),
  19726. type: `${type}-month`,
  19727. day: day.format("YYYY-MM-DD"),
  19728. date: day.toDate()
  19729. };
  19730. };
  19731. return {
  19732. now,
  19733. isInRange,
  19734. rows,
  19735. weekDays,
  19736. getFormattedDate,
  19737. handlePickDay,
  19738. getSlotData
  19739. };
  19740. };
  19741. const __default__$1r = vue.defineComponent({
  19742. name: "DateTable"
  19743. });
  19744. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  19745. ...__default__$1r,
  19746. props: dateTableProps,
  19747. emits: dateTableEmits,
  19748. setup(__props, { expose, emit }) {
  19749. const props = __props;
  19750. const {
  19751. isInRange,
  19752. now,
  19753. rows,
  19754. weekDays,
  19755. getFormattedDate,
  19756. handlePickDay,
  19757. getSlotData
  19758. } = useDateTable(props, emit);
  19759. const nsTable = useNamespace("calendar-table");
  19760. const nsDay = useNamespace("calendar-day");
  19761. const getCellClass = ({ text, type }) => {
  19762. const classes = [type];
  19763. if (type === "current") {
  19764. const date = getFormattedDate(text, type);
  19765. if (date.isSame(props.selectedDay, "day")) {
  19766. classes.push(nsDay.is("selected"));
  19767. }
  19768. if (date.isSame(now, "day")) {
  19769. classes.push(nsDay.is("today"));
  19770. }
  19771. }
  19772. return classes;
  19773. };
  19774. expose({
  19775. getFormattedDate
  19776. });
  19777. return (_ctx, _cache) => {
  19778. return vue.openBlock(), vue.createElementBlock("table", {
  19779. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  19780. cellspacing: "0",
  19781. cellpadding: "0"
  19782. }, [
  19783. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", { key: 0 }, [
  19784. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  19785. return vue.openBlock(), vue.createElementBlock("th", { key: day }, vue.toDisplayString(day), 1);
  19786. }), 128))
  19787. ])) : vue.createCommentVNode("v-if", true),
  19788. vue.createElementVNode("tbody", null, [
  19789. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  19790. return vue.openBlock(), vue.createElementBlock("tr", {
  19791. key: index,
  19792. class: vue.normalizeClass({
  19793. [vue.unref(nsTable).e("row")]: true,
  19794. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  19795. })
  19796. }, [
  19797. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  19798. return vue.openBlock(), vue.createElementBlock("td", {
  19799. key,
  19800. class: vue.normalizeClass(getCellClass(cell)),
  19801. onClick: ($event) => vue.unref(handlePickDay)(cell)
  19802. }, [
  19803. vue.createElementVNode("div", {
  19804. class: vue.normalizeClass(vue.unref(nsDay).b())
  19805. }, [
  19806. vue.renderSlot(_ctx.$slots, "date-cell", {
  19807. data: vue.unref(getSlotData)(cell)
  19808. }, () => [
  19809. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  19810. ])
  19811. ], 2)
  19812. ], 10, ["onClick"]);
  19813. }), 128))
  19814. ], 2);
  19815. }), 128))
  19816. ])
  19817. ], 2);
  19818. };
  19819. }
  19820. });
  19821. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "date-table.vue"]]);
  19822. const adjacentMonth = (start, end) => {
  19823. const firstMonthLastDay = start.endOf("month");
  19824. const lastMonthFirstDay = end.startOf("month");
  19825. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  19826. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19827. return [
  19828. [start, firstMonthLastDay],
  19829. [lastMonthStartDay.startOf("week"), end]
  19830. ];
  19831. };
  19832. const threeConsecutiveMonth = (start, end) => {
  19833. const firstMonthLastDay = start.endOf("month");
  19834. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  19835. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  19836. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  19837. const lastMonthFirstDay = end.startOf("month");
  19838. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19839. return [
  19840. [start, firstMonthLastDay],
  19841. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  19842. [lastMonthStartDay.startOf("week"), end]
  19843. ];
  19844. };
  19845. const useCalendar = (props, emit, componentName) => {
  19846. const { lang } = useLocale();
  19847. const selectedDay = vue.ref();
  19848. const now = dayjs().locale(lang.value);
  19849. const realSelectedDay = vue.computed({
  19850. get() {
  19851. if (!props.modelValue)
  19852. return selectedDay.value;
  19853. return date.value;
  19854. },
  19855. set(val) {
  19856. if (!val)
  19857. return;
  19858. selectedDay.value = val;
  19859. const result = val.toDate();
  19860. emit(INPUT_EVENT, result);
  19861. emit(UPDATE_MODEL_EVENT, result);
  19862. }
  19863. });
  19864. const validatedRange = vue.computed(() => {
  19865. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate$1(item)))
  19866. return [];
  19867. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  19868. const [startDayjs, endDayjs] = rangeArrDayjs;
  19869. if (startDayjs.isAfter(endDayjs)) {
  19870. return [];
  19871. }
  19872. if (startDayjs.isSame(endDayjs, "month")) {
  19873. return calculateValidatedDateRange(startDayjs, endDayjs);
  19874. } else {
  19875. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  19876. return [];
  19877. }
  19878. return calculateValidatedDateRange(startDayjs, endDayjs);
  19879. }
  19880. });
  19881. const date = vue.computed(() => {
  19882. if (!props.modelValue) {
  19883. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  19884. } else {
  19885. return dayjs(props.modelValue).locale(lang.value);
  19886. }
  19887. });
  19888. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  19889. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  19890. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  19891. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  19892. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  19893. const firstDay = startDayjs.startOf("week");
  19894. const lastDay = endDayjs.endOf("week");
  19895. const firstMonth = firstDay.get("month");
  19896. const lastMonth = lastDay.get("month");
  19897. if (firstMonth === lastMonth) {
  19898. return [[firstDay, lastDay]];
  19899. } else if ((firstMonth + 1) % 12 === lastMonth) {
  19900. return adjacentMonth(firstDay, lastDay);
  19901. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  19902. return threeConsecutiveMonth(firstDay, lastDay);
  19903. } else {
  19904. return [];
  19905. }
  19906. };
  19907. const pickDay = (day) => {
  19908. realSelectedDay.value = day;
  19909. };
  19910. const selectDate = (type) => {
  19911. const dateMap = {
  19912. "prev-month": prevMonthDayjs.value,
  19913. "next-month": nextMonthDayjs.value,
  19914. "prev-year": prevYearDayjs.value,
  19915. "next-year": nextYearDayjs.value,
  19916. today: now
  19917. };
  19918. const day = dateMap[type];
  19919. if (!day.isSame(date.value, "day")) {
  19920. pickDay(day);
  19921. }
  19922. };
  19923. return {
  19924. calculateValidatedDateRange,
  19925. date,
  19926. realSelectedDay,
  19927. pickDay,
  19928. selectDate,
  19929. validatedRange
  19930. };
  19931. };
  19932. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  19933. const calendarProps = buildProps({
  19934. modelValue: {
  19935. type: Date
  19936. },
  19937. range: {
  19938. type: definePropType(Array),
  19939. validator: isValidRange$1
  19940. }
  19941. });
  19942. const calendarEmits = {
  19943. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  19944. [INPUT_EVENT]: (value) => isDate$1(value)
  19945. };
  19946. const COMPONENT_NAME$g = "ElCalendar";
  19947. const __default__$1q = vue.defineComponent({
  19948. name: COMPONENT_NAME$g
  19949. });
  19950. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  19951. ...__default__$1q,
  19952. props: calendarProps,
  19953. emits: calendarEmits,
  19954. setup(__props, { expose, emit }) {
  19955. const props = __props;
  19956. const ns = useNamespace("calendar");
  19957. const {
  19958. calculateValidatedDateRange,
  19959. date,
  19960. pickDay,
  19961. realSelectedDay,
  19962. selectDate,
  19963. validatedRange
  19964. } = useCalendar(props, emit);
  19965. const { t } = useLocale();
  19966. const i18nDate = vue.computed(() => {
  19967. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  19968. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  19969. });
  19970. expose({
  19971. selectedDay: realSelectedDay,
  19972. pickDay,
  19973. selectDate,
  19974. calculateValidatedDateRange
  19975. });
  19976. return (_ctx, _cache) => {
  19977. return vue.openBlock(), vue.createElementBlock("div", {
  19978. class: vue.normalizeClass(vue.unref(ns).b())
  19979. }, [
  19980. vue.createElementVNode("div", {
  19981. class: vue.normalizeClass(vue.unref(ns).e("header"))
  19982. }, [
  19983. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  19984. vue.createElementVNode("div", {
  19985. class: vue.normalizeClass(vue.unref(ns).e("title"))
  19986. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  19987. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  19988. key: 0,
  19989. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  19990. }, [
  19991. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  19992. default: vue.withCtx(() => [
  19993. vue.createVNode(vue.unref(ElButton), {
  19994. size: "small",
  19995. onClick: ($event) => vue.unref(selectDate)("prev-month")
  19996. }, {
  19997. default: vue.withCtx(() => [
  19998. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  19999. ]),
  20000. _: 1
  20001. }, 8, ["onClick"]),
  20002. vue.createVNode(vue.unref(ElButton), {
  20003. size: "small",
  20004. onClick: ($event) => vue.unref(selectDate)("today")
  20005. }, {
  20006. default: vue.withCtx(() => [
  20007. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  20008. ]),
  20009. _: 1
  20010. }, 8, ["onClick"]),
  20011. vue.createVNode(vue.unref(ElButton), {
  20012. size: "small",
  20013. onClick: ($event) => vue.unref(selectDate)("next-month")
  20014. }, {
  20015. default: vue.withCtx(() => [
  20016. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  20017. ]),
  20018. _: 1
  20019. }, 8, ["onClick"])
  20020. ]),
  20021. _: 1
  20022. })
  20023. ], 2)) : vue.createCommentVNode("v-if", true)
  20024. ])
  20025. ], 2),
  20026. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  20027. key: 0,
  20028. class: vue.normalizeClass(vue.unref(ns).e("body"))
  20029. }, [
  20030. vue.createVNode(DateTable$1, {
  20031. date: vue.unref(date),
  20032. "selected-day": vue.unref(realSelectedDay),
  20033. onPick: vue.unref(pickDay)
  20034. }, vue.createSlots({ _: 2 }, [
  20035. _ctx.$slots["date-cell"] ? {
  20036. name: "date-cell",
  20037. fn: vue.withCtx((data) => [
  20038. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  20039. ])
  20040. } : void 0
  20041. ]), 1032, ["date", "selected-day", "onPick"])
  20042. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  20043. key: 1,
  20044. class: vue.normalizeClass(vue.unref(ns).e("body"))
  20045. }, [
  20046. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  20047. return vue.openBlock(), vue.createBlock(DateTable$1, {
  20048. key: index,
  20049. date: range_[0],
  20050. "selected-day": vue.unref(realSelectedDay),
  20051. range: range_,
  20052. "hide-header": index !== 0,
  20053. onPick: vue.unref(pickDay)
  20054. }, vue.createSlots({ _: 2 }, [
  20055. _ctx.$slots["date-cell"] ? {
  20056. name: "date-cell",
  20057. fn: vue.withCtx((data) => [
  20058. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  20059. ])
  20060. } : void 0
  20061. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  20062. }), 128))
  20063. ], 2))
  20064. ], 2);
  20065. };
  20066. }
  20067. });
  20068. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "calendar.vue"]]);
  20069. const ElCalendar = withInstall(Calendar);
  20070. const cardProps = buildProps({
  20071. header: {
  20072. type: String,
  20073. default: ""
  20074. },
  20075. footer: {
  20076. type: String,
  20077. default: ""
  20078. },
  20079. bodyStyle: {
  20080. type: definePropType([String, Object, Array]),
  20081. default: ""
  20082. },
  20083. bodyClass: String,
  20084. shadow: {
  20085. type: String,
  20086. values: ["always", "hover", "never"],
  20087. default: "always"
  20088. }
  20089. });
  20090. const __default__$1p = vue.defineComponent({
  20091. name: "ElCard"
  20092. });
  20093. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  20094. ...__default__$1p,
  20095. props: cardProps,
  20096. setup(__props) {
  20097. const ns = useNamespace("card");
  20098. return (_ctx, _cache) => {
  20099. return vue.openBlock(), vue.createElementBlock("div", {
  20100. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)])
  20101. }, [
  20102. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  20103. key: 0,
  20104. class: vue.normalizeClass(vue.unref(ns).e("header"))
  20105. }, [
  20106. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  20107. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  20108. ])
  20109. ], 2)) : vue.createCommentVNode("v-if", true),
  20110. vue.createElementVNode("div", {
  20111. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass]),
  20112. style: vue.normalizeStyle(_ctx.bodyStyle)
  20113. }, [
  20114. vue.renderSlot(_ctx.$slots, "default")
  20115. ], 6),
  20116. _ctx.$slots.footer || _ctx.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  20117. key: 1,
  20118. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  20119. }, [
  20120. vue.renderSlot(_ctx.$slots, "footer", {}, () => [
  20121. vue.createTextVNode(vue.toDisplayString(_ctx.footer), 1)
  20122. ])
  20123. ], 2)) : vue.createCommentVNode("v-if", true)
  20124. ], 2);
  20125. };
  20126. }
  20127. });
  20128. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "card.vue"]]);
  20129. const ElCard = withInstall(Card);
  20130. const carouselProps = buildProps({
  20131. initialIndex: {
  20132. type: Number,
  20133. default: 0
  20134. },
  20135. height: {
  20136. type: String,
  20137. default: ""
  20138. },
  20139. trigger: {
  20140. type: String,
  20141. values: ["hover", "click"],
  20142. default: "hover"
  20143. },
  20144. autoplay: {
  20145. type: Boolean,
  20146. default: true
  20147. },
  20148. interval: {
  20149. type: Number,
  20150. default: 3e3
  20151. },
  20152. indicatorPosition: {
  20153. type: String,
  20154. values: ["", "none", "outside"],
  20155. default: ""
  20156. },
  20157. arrow: {
  20158. type: String,
  20159. values: ["always", "hover", "never"],
  20160. default: "hover"
  20161. },
  20162. type: {
  20163. type: String,
  20164. values: ["", "card"],
  20165. default: ""
  20166. },
  20167. cardScale: {
  20168. type: Number,
  20169. default: 0.83
  20170. },
  20171. loop: {
  20172. type: Boolean,
  20173. default: true
  20174. },
  20175. direction: {
  20176. type: String,
  20177. values: ["horizontal", "vertical"],
  20178. default: "horizontal"
  20179. },
  20180. pauseOnHover: {
  20181. type: Boolean,
  20182. default: true
  20183. },
  20184. motionBlur: Boolean
  20185. });
  20186. const carouselEmits = {
  20187. change: (current, prev) => [current, prev].every(isNumber)
  20188. };
  20189. const carouselContextKey = Symbol("carouselContextKey");
  20190. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  20191. const THROTTLE_TIME = 300;
  20192. const useCarousel = (props, emit, componentName) => {
  20193. const {
  20194. children: items,
  20195. addChild: addItem,
  20196. removeChild: removeItem
  20197. } = useOrderedChildren(vue.getCurrentInstance(), CAROUSEL_ITEM_NAME);
  20198. const slots = vue.useSlots();
  20199. const activeIndex = vue.ref(-1);
  20200. const timer = vue.ref(null);
  20201. const hover = vue.ref(false);
  20202. const root = vue.ref();
  20203. const containerHeight = vue.ref(0);
  20204. const isItemsTwoLength = vue.ref(true);
  20205. const isFirstCall = vue.ref(true);
  20206. const isTransitioning = vue.ref(false);
  20207. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  20208. const hasLabel = vue.computed(() => {
  20209. return items.value.some((item) => item.props.label.toString().length > 0);
  20210. });
  20211. const isCardType = vue.computed(() => props.type === "card");
  20212. const isVertical = vue.computed(() => props.direction === "vertical");
  20213. const containerStyle = vue.computed(() => {
  20214. if (props.height !== "auto") {
  20215. return {
  20216. height: props.height
  20217. };
  20218. }
  20219. return {
  20220. height: `${containerHeight.value}px`,
  20221. overflow: "hidden"
  20222. };
  20223. });
  20224. const throttledArrowClick = throttle((index) => {
  20225. setActiveItem(index);
  20226. }, THROTTLE_TIME, { trailing: true });
  20227. const throttledIndicatorHover = throttle((index) => {
  20228. handleIndicatorHover(index);
  20229. }, THROTTLE_TIME);
  20230. const isTwoLengthShow = (index) => {
  20231. if (!isItemsTwoLength.value)
  20232. return true;
  20233. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  20234. };
  20235. function pauseTimer() {
  20236. if (timer.value) {
  20237. clearInterval(timer.value);
  20238. timer.value = null;
  20239. }
  20240. }
  20241. function startTimer() {
  20242. if (props.interval <= 0 || !props.autoplay || timer.value)
  20243. return;
  20244. timer.value = setInterval(() => playSlides(), props.interval);
  20245. }
  20246. const playSlides = () => {
  20247. if (!isFirstCall.value) {
  20248. isTransitioning.value = true;
  20249. }
  20250. isFirstCall.value = false;
  20251. if (activeIndex.value < items.value.length - 1) {
  20252. activeIndex.value = activeIndex.value + 1;
  20253. } else if (props.loop) {
  20254. activeIndex.value = 0;
  20255. } else {
  20256. isTransitioning.value = false;
  20257. }
  20258. };
  20259. function setActiveItem(index) {
  20260. if (!isFirstCall.value) {
  20261. isTransitioning.value = true;
  20262. }
  20263. isFirstCall.value = false;
  20264. if (isString$1(index)) {
  20265. const filteredItems = items.value.filter((item) => item.props.name === index);
  20266. if (filteredItems.length > 0) {
  20267. index = items.value.indexOf(filteredItems[0]);
  20268. }
  20269. }
  20270. index = Number(index);
  20271. if (Number.isNaN(index) || index !== Math.floor(index)) {
  20272. return;
  20273. }
  20274. const itemCount = items.value.length;
  20275. const oldIndex = activeIndex.value;
  20276. if (index < 0) {
  20277. activeIndex.value = props.loop ? itemCount - 1 : 0;
  20278. } else if (index >= itemCount) {
  20279. activeIndex.value = props.loop ? 0 : itemCount - 1;
  20280. } else {
  20281. activeIndex.value = index;
  20282. }
  20283. if (oldIndex === activeIndex.value) {
  20284. resetItemPosition(oldIndex);
  20285. }
  20286. resetTimer();
  20287. }
  20288. function resetItemPosition(oldIndex) {
  20289. items.value.forEach((item, index) => {
  20290. item.translateItem(index, activeIndex.value, oldIndex);
  20291. });
  20292. }
  20293. function itemInStage(item, index) {
  20294. var _a, _b, _c, _d;
  20295. const _items = vue.unref(items);
  20296. const itemCount = _items.length;
  20297. if (itemCount === 0 || !item.states.inStage)
  20298. return false;
  20299. const nextItemIndex = index + 1;
  20300. const prevItemIndex = index - 1;
  20301. const lastItemIndex = itemCount - 1;
  20302. const isLastItemActive = _items[lastItemIndex].states.active;
  20303. const isFirstItemActive = _items[0].states.active;
  20304. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  20305. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  20306. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  20307. return "left";
  20308. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  20309. return "right";
  20310. }
  20311. return false;
  20312. }
  20313. function handleMouseEnter() {
  20314. hover.value = true;
  20315. if (props.pauseOnHover) {
  20316. pauseTimer();
  20317. }
  20318. }
  20319. function handleMouseLeave() {
  20320. hover.value = false;
  20321. startTimer();
  20322. }
  20323. function handleTransitionEnd() {
  20324. isTransitioning.value = false;
  20325. }
  20326. function handleButtonEnter(arrow) {
  20327. if (vue.unref(isVertical))
  20328. return;
  20329. items.value.forEach((item, index) => {
  20330. if (arrow === itemInStage(item, index)) {
  20331. item.states.hover = true;
  20332. }
  20333. });
  20334. }
  20335. function handleButtonLeave() {
  20336. if (vue.unref(isVertical))
  20337. return;
  20338. items.value.forEach((item) => {
  20339. item.states.hover = false;
  20340. });
  20341. }
  20342. function handleIndicatorClick(index) {
  20343. if (index !== activeIndex.value) {
  20344. if (!isFirstCall.value) {
  20345. isTransitioning.value = true;
  20346. }
  20347. }
  20348. activeIndex.value = index;
  20349. }
  20350. function handleIndicatorHover(index) {
  20351. if (props.trigger === "hover" && index !== activeIndex.value) {
  20352. activeIndex.value = index;
  20353. if (!isFirstCall.value) {
  20354. isTransitioning.value = true;
  20355. }
  20356. }
  20357. }
  20358. function prev() {
  20359. setActiveItem(activeIndex.value - 1);
  20360. }
  20361. function next() {
  20362. setActiveItem(activeIndex.value + 1);
  20363. }
  20364. function resetTimer() {
  20365. pauseTimer();
  20366. if (!props.pauseOnHover)
  20367. startTimer();
  20368. }
  20369. function setContainerHeight(height) {
  20370. if (props.height !== "auto")
  20371. return;
  20372. containerHeight.value = height;
  20373. }
  20374. function PlaceholderItem() {
  20375. var _a;
  20376. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  20377. if (!defaultSlots)
  20378. return null;
  20379. const flatSlots = flattedChildren(defaultSlots);
  20380. const normalizeSlots = flatSlots.filter((slot) => {
  20381. return vue.isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  20382. });
  20383. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  20384. isItemsTwoLength.value = true;
  20385. return normalizeSlots;
  20386. }
  20387. isItemsTwoLength.value = false;
  20388. return null;
  20389. }
  20390. vue.watch(() => activeIndex.value, (current, prev2) => {
  20391. resetItemPosition(prev2);
  20392. if (isItemsTwoLength.value) {
  20393. current = current % 2;
  20394. prev2 = prev2 % 2;
  20395. }
  20396. if (prev2 > -1) {
  20397. emit("change", current, prev2);
  20398. }
  20399. });
  20400. vue.watch(() => props.autoplay, (autoplay) => {
  20401. autoplay ? startTimer() : pauseTimer();
  20402. });
  20403. vue.watch(() => props.loop, () => {
  20404. setActiveItem(activeIndex.value);
  20405. });
  20406. vue.watch(() => props.interval, () => {
  20407. resetTimer();
  20408. });
  20409. const resizeObserver = vue.shallowRef();
  20410. vue.onMounted(() => {
  20411. vue.watch(() => items.value, () => {
  20412. if (items.value.length > 0)
  20413. setActiveItem(props.initialIndex);
  20414. }, {
  20415. immediate: true
  20416. });
  20417. resizeObserver.value = useResizeObserver(root.value, () => {
  20418. resetItemPosition();
  20419. });
  20420. startTimer();
  20421. });
  20422. vue.onBeforeUnmount(() => {
  20423. pauseTimer();
  20424. if (root.value && resizeObserver.value)
  20425. resizeObserver.value.stop();
  20426. });
  20427. vue.provide(carouselContextKey, {
  20428. root,
  20429. isCardType,
  20430. isVertical,
  20431. items,
  20432. loop: props.loop,
  20433. cardScale: props.cardScale,
  20434. addItem,
  20435. removeItem,
  20436. setActiveItem,
  20437. setContainerHeight
  20438. });
  20439. return {
  20440. root,
  20441. activeIndex,
  20442. arrowDisplay,
  20443. hasLabel,
  20444. hover,
  20445. isCardType,
  20446. isTransitioning,
  20447. items,
  20448. isVertical,
  20449. containerStyle,
  20450. isItemsTwoLength,
  20451. handleButtonEnter,
  20452. handleTransitionEnd,
  20453. handleButtonLeave,
  20454. handleIndicatorClick,
  20455. handleMouseEnter,
  20456. handleMouseLeave,
  20457. setActiveItem,
  20458. prev,
  20459. next,
  20460. PlaceholderItem,
  20461. isTwoLengthShow,
  20462. throttledArrowClick,
  20463. throttledIndicatorHover
  20464. };
  20465. };
  20466. const COMPONENT_NAME$f = "ElCarousel";
  20467. const __default__$1o = vue.defineComponent({
  20468. name: COMPONENT_NAME$f
  20469. });
  20470. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  20471. ...__default__$1o,
  20472. props: carouselProps,
  20473. emits: carouselEmits,
  20474. setup(__props, { expose, emit }) {
  20475. const props = __props;
  20476. const {
  20477. root,
  20478. activeIndex,
  20479. arrowDisplay,
  20480. hasLabel,
  20481. hover,
  20482. isCardType,
  20483. items,
  20484. isVertical,
  20485. containerStyle,
  20486. handleButtonEnter,
  20487. handleButtonLeave,
  20488. isTransitioning,
  20489. handleIndicatorClick,
  20490. handleMouseEnter,
  20491. handleMouseLeave,
  20492. handleTransitionEnd,
  20493. setActiveItem,
  20494. prev,
  20495. next,
  20496. PlaceholderItem,
  20497. isTwoLengthShow,
  20498. throttledArrowClick,
  20499. throttledIndicatorHover
  20500. } = useCarousel(props, emit);
  20501. const ns = useNamespace("carousel");
  20502. const { t } = useLocale();
  20503. const carouselClasses = vue.computed(() => {
  20504. const classes = [ns.b(), ns.m(props.direction)];
  20505. if (vue.unref(isCardType)) {
  20506. classes.push(ns.m("card"));
  20507. }
  20508. return classes;
  20509. });
  20510. const carouselContainer = vue.computed(() => {
  20511. const classes = [ns.e("container")];
  20512. if (props.motionBlur && vue.unref(isTransitioning)) {
  20513. classes.push(vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);
  20514. }
  20515. return classes;
  20516. });
  20517. const indicatorsClasses = vue.computed(() => {
  20518. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  20519. if (vue.unref(hasLabel)) {
  20520. classes.push(ns.em("indicators", "labels"));
  20521. }
  20522. if (props.indicatorPosition === "outside") {
  20523. classes.push(ns.em("indicators", "outside"));
  20524. }
  20525. if (vue.unref(isVertical)) {
  20526. classes.push(ns.em("indicators", "right"));
  20527. }
  20528. return classes;
  20529. });
  20530. expose({
  20531. activeIndex,
  20532. setActiveItem,
  20533. prev,
  20534. next
  20535. });
  20536. return (_ctx, _cache) => {
  20537. return vue.openBlock(), vue.createElementBlock("div", {
  20538. ref_key: "root",
  20539. ref: root,
  20540. class: vue.normalizeClass(vue.unref(carouselClasses)),
  20541. onMouseenter: vue.withModifiers(vue.unref(handleMouseEnter), ["stop"]),
  20542. onMouseleave: vue.withModifiers(vue.unref(handleMouseLeave), ["stop"])
  20543. }, [
  20544. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20545. key: 0,
  20546. name: "carousel-arrow-left",
  20547. persisted: ""
  20548. }, {
  20549. default: vue.withCtx(() => [
  20550. vue.withDirectives(vue.createElementVNode("button", {
  20551. type: "button",
  20552. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  20553. "aria-label": vue.unref(t)("el.carousel.leftArrow"),
  20554. onMouseenter: ($event) => vue.unref(handleButtonEnter)("left"),
  20555. onMouseleave: vue.unref(handleButtonLeave),
  20556. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"])
  20557. }, [
  20558. vue.createVNode(vue.unref(ElIcon), null, {
  20559. default: vue.withCtx(() => [
  20560. vue.createVNode(vue.unref(arrow_left_default))
  20561. ]),
  20562. _: 1
  20563. })
  20564. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20565. [
  20566. vue.vShow,
  20567. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
  20568. ]
  20569. ])
  20570. ]),
  20571. _: 1
  20572. })) : vue.createCommentVNode("v-if", true),
  20573. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20574. key: 1,
  20575. name: "carousel-arrow-right",
  20576. persisted: ""
  20577. }, {
  20578. default: vue.withCtx(() => [
  20579. vue.withDirectives(vue.createElementVNode("button", {
  20580. type: "button",
  20581. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  20582. "aria-label": vue.unref(t)("el.carousel.rightArrow"),
  20583. onMouseenter: ($event) => vue.unref(handleButtonEnter)("right"),
  20584. onMouseleave: vue.unref(handleButtonLeave),
  20585. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"])
  20586. }, [
  20587. vue.createVNode(vue.unref(ElIcon), null, {
  20588. default: vue.withCtx(() => [
  20589. vue.createVNode(vue.unref(arrow_right_default))
  20590. ]),
  20591. _: 1
  20592. })
  20593. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20594. [
  20595. vue.vShow,
  20596. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  20597. ]
  20598. ])
  20599. ]),
  20600. _: 1
  20601. })) : vue.createCommentVNode("v-if", true),
  20602. vue.createElementVNode("div", {
  20603. class: vue.normalizeClass(vue.unref(carouselContainer)),
  20604. style: vue.normalizeStyle(vue.unref(containerStyle)),
  20605. onTransitionend: vue.unref(handleTransitionEnd)
  20606. }, [
  20607. vue.createVNode(vue.unref(PlaceholderItem)),
  20608. vue.renderSlot(_ctx.$slots, "default")
  20609. ], 46, ["onTransitionend"]),
  20610. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  20611. key: 2,
  20612. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  20613. }, [
  20614. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  20615. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  20616. key: index,
  20617. class: vue.normalizeClass([
  20618. vue.unref(ns).e("indicator"),
  20619. vue.unref(ns).em("indicator", _ctx.direction),
  20620. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  20621. ]),
  20622. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  20623. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  20624. }, [
  20625. vue.createElementVNode("button", {
  20626. class: vue.normalizeClass(vue.unref(ns).e("button")),
  20627. "aria-label": vue.unref(t)("el.carousel.indicator", { index: index + 1 })
  20628. }, [
  20629. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  20630. ], 10, ["aria-label"])
  20631. ], 42, ["onMouseenter", "onClick"])), [
  20632. [vue.vShow, vue.unref(isTwoLengthShow)(index)]
  20633. ]);
  20634. }), 128))
  20635. ], 2)) : vue.createCommentVNode("v-if", true),
  20636. props.motionBlur ? (vue.openBlock(), vue.createElementBlock("svg", {
  20637. key: 3,
  20638. xmlns: "http://www.w3.org/2000/svg",
  20639. version: "1.1",
  20640. style: { "display": "none" }
  20641. }, [
  20642. vue.createElementVNode("defs", null, [
  20643. vue.createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  20644. vue.createElementVNode("feGaussianBlur", {
  20645. in: "SourceGraphic",
  20646. stdDeviation: "12,0"
  20647. })
  20648. ]),
  20649. vue.createElementVNode("filter", { id: "elCarouselVertical" }, [
  20650. vue.createElementVNode("feGaussianBlur", {
  20651. in: "SourceGraphic",
  20652. stdDeviation: "0,10"
  20653. })
  20654. ])
  20655. ])
  20656. ])) : vue.createCommentVNode("v-if", true)
  20657. ], 42, ["onMouseenter", "onMouseleave"]);
  20658. };
  20659. }
  20660. });
  20661. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "carousel.vue"]]);
  20662. const carouselItemProps = buildProps({
  20663. name: { type: String, default: "" },
  20664. label: {
  20665. type: [String, Number],
  20666. default: ""
  20667. }
  20668. });
  20669. const useCarouselItem = (props) => {
  20670. const carouselContext = vue.inject(carouselContextKey);
  20671. const instance = vue.getCurrentInstance();
  20672. const carouselItemRef = vue.ref();
  20673. const hover = vue.ref(false);
  20674. const translate = vue.ref(0);
  20675. const scale = vue.ref(1);
  20676. const active = vue.ref(false);
  20677. const ready = vue.ref(false);
  20678. const inStage = vue.ref(false);
  20679. const animating = vue.ref(false);
  20680. const { isCardType, isVertical, cardScale } = carouselContext;
  20681. function processIndex(index, activeIndex, length) {
  20682. const lastItemIndex = length - 1;
  20683. const prevItemIndex = activeIndex - 1;
  20684. const nextItemIndex = activeIndex + 1;
  20685. const halfItemIndex = length / 2;
  20686. if (activeIndex === 0 && index === lastItemIndex) {
  20687. return -1;
  20688. } else if (activeIndex === lastItemIndex && index === 0) {
  20689. return length;
  20690. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  20691. return length + 1;
  20692. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  20693. return -2;
  20694. }
  20695. return index;
  20696. }
  20697. function calcCardTranslate(index, activeIndex) {
  20698. var _a, _b;
  20699. const parentWidth = vue.unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
  20700. if (inStage.value) {
  20701. return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  20702. } else if (index < activeIndex) {
  20703. return -(1 + cardScale) * parentWidth / 4;
  20704. } else {
  20705. return (3 + cardScale) * parentWidth / 4;
  20706. }
  20707. }
  20708. function calcTranslate(index, activeIndex, isVertical2) {
  20709. const rootEl = carouselContext.root.value;
  20710. if (!rootEl)
  20711. return 0;
  20712. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  20713. return distance * (index - activeIndex);
  20714. }
  20715. const translateItem = (index, activeIndex, oldIndex) => {
  20716. var _a;
  20717. const _isCardType = vue.unref(isCardType);
  20718. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  20719. const isActive = index === activeIndex;
  20720. if (!_isCardType && !isUndefined(oldIndex)) {
  20721. animating.value = isActive || index === oldIndex;
  20722. }
  20723. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  20724. index = processIndex(index, activeIndex, carouselItemLength);
  20725. }
  20726. const _isVertical = vue.unref(isVertical);
  20727. active.value = isActive;
  20728. if (_isCardType) {
  20729. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  20730. translate.value = calcCardTranslate(index, activeIndex);
  20731. scale.value = vue.unref(active) ? 1 : cardScale;
  20732. } else {
  20733. translate.value = calcTranslate(index, activeIndex, _isVertical);
  20734. }
  20735. ready.value = true;
  20736. if (isActive && carouselItemRef.value) {
  20737. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  20738. }
  20739. };
  20740. function handleItemClick() {
  20741. if (carouselContext && vue.unref(isCardType)) {
  20742. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  20743. carouselContext.setActiveItem(index);
  20744. }
  20745. }
  20746. vue.onMounted(() => {
  20747. carouselContext.addItem({
  20748. props,
  20749. states: vue.reactive({
  20750. hover,
  20751. translate,
  20752. scale,
  20753. active,
  20754. ready,
  20755. inStage,
  20756. animating
  20757. }),
  20758. uid: instance.uid,
  20759. translateItem
  20760. });
  20761. });
  20762. vue.onUnmounted(() => {
  20763. carouselContext.removeItem(instance.uid);
  20764. });
  20765. return {
  20766. carouselItemRef,
  20767. active,
  20768. animating,
  20769. hover,
  20770. inStage,
  20771. isVertical,
  20772. translate,
  20773. isCardType,
  20774. scale,
  20775. ready,
  20776. handleItemClick
  20777. };
  20778. };
  20779. const __default__$1n = vue.defineComponent({
  20780. name: CAROUSEL_ITEM_NAME
  20781. });
  20782. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  20783. ...__default__$1n,
  20784. props: carouselItemProps,
  20785. setup(__props) {
  20786. const props = __props;
  20787. const ns = useNamespace("carousel");
  20788. const {
  20789. carouselItemRef,
  20790. active,
  20791. animating,
  20792. hover,
  20793. inStage,
  20794. isVertical,
  20795. translate,
  20796. isCardType,
  20797. scale,
  20798. ready,
  20799. handleItemClick
  20800. } = useCarouselItem(props);
  20801. const itemKls = vue.computed(() => [
  20802. ns.e("item"),
  20803. ns.is("active", active.value),
  20804. ns.is("in-stage", inStage.value),
  20805. ns.is("hover", hover.value),
  20806. ns.is("animating", animating.value),
  20807. {
  20808. [ns.em("item", "card")]: isCardType.value,
  20809. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  20810. }
  20811. ]);
  20812. const itemStyle = vue.computed(() => {
  20813. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  20814. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  20815. const _scale = `scale(${vue.unref(scale)})`;
  20816. const transform = [_translate, _scale].join(" ");
  20817. return {
  20818. transform
  20819. };
  20820. });
  20821. return (_ctx, _cache) => {
  20822. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20823. ref_key: "carouselItemRef",
  20824. ref: carouselItemRef,
  20825. class: vue.normalizeClass(vue.unref(itemKls)),
  20826. style: vue.normalizeStyle(vue.unref(itemStyle)),
  20827. onClick: vue.unref(handleItemClick)
  20828. }, [
  20829. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20830. key: 0,
  20831. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  20832. }, null, 2)), [
  20833. [vue.vShow, !vue.unref(active)]
  20834. ]) : vue.createCommentVNode("v-if", true),
  20835. vue.renderSlot(_ctx.$slots, "default")
  20836. ], 14, ["onClick"])), [
  20837. [vue.vShow, vue.unref(ready)]
  20838. ]);
  20839. };
  20840. }
  20841. });
  20842. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "carousel-item.vue"]]);
  20843. const ElCarousel = withInstall(Carousel, {
  20844. CarouselItem
  20845. });
  20846. const ElCarouselItem = withNoopInstall(CarouselItem);
  20847. const checkboxProps = {
  20848. modelValue: {
  20849. type: [Number, String, Boolean],
  20850. default: void 0
  20851. },
  20852. label: {
  20853. type: [String, Boolean, Number, Object],
  20854. default: void 0
  20855. },
  20856. value: {
  20857. type: [String, Boolean, Number, Object],
  20858. default: void 0
  20859. },
  20860. indeterminate: Boolean,
  20861. disabled: Boolean,
  20862. checked: Boolean,
  20863. name: {
  20864. type: String,
  20865. default: void 0
  20866. },
  20867. trueValue: {
  20868. type: [String, Number],
  20869. default: void 0
  20870. },
  20871. falseValue: {
  20872. type: [String, Number],
  20873. default: void 0
  20874. },
  20875. trueLabel: {
  20876. type: [String, Number],
  20877. default: void 0
  20878. },
  20879. falseLabel: {
  20880. type: [String, Number],
  20881. default: void 0
  20882. },
  20883. id: {
  20884. type: String,
  20885. default: void 0
  20886. },
  20887. border: Boolean,
  20888. size: useSizeProp,
  20889. tabindex: [String, Number],
  20890. validateEvent: {
  20891. type: Boolean,
  20892. default: true
  20893. },
  20894. ...useAriaProps(["ariaControls"])
  20895. };
  20896. const checkboxEmits = {
  20897. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  20898. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  20899. };
  20900. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  20901. const useCheckboxDisabled = ({
  20902. model,
  20903. isChecked
  20904. }) => {
  20905. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20906. const isLimitDisabled = vue.computed(() => {
  20907. var _a, _b;
  20908. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  20909. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  20910. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  20911. });
  20912. const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  20913. return {
  20914. isDisabled,
  20915. isLimitDisabled
  20916. };
  20917. };
  20918. const useCheckboxEvent = (props, {
  20919. model,
  20920. isLimitExceeded,
  20921. hasOwnLabel,
  20922. isDisabled,
  20923. isLabeledByFormItem
  20924. }) => {
  20925. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20926. const { formItem } = useFormItem();
  20927. const { emit } = vue.getCurrentInstance();
  20928. function getLabeledValue(value) {
  20929. var _a, _b, _c, _d;
  20930. return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
  20931. }
  20932. function emitChangeEvent(checked, e) {
  20933. emit("change", getLabeledValue(checked), e);
  20934. }
  20935. function handleChange(e) {
  20936. if (isLimitExceeded.value)
  20937. return;
  20938. const target = e.target;
  20939. emit("change", getLabeledValue(target.checked), e);
  20940. }
  20941. async function onClickRoot(e) {
  20942. if (isLimitExceeded.value)
  20943. return;
  20944. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  20945. const eventTargets = e.composedPath();
  20946. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  20947. if (!hasLabel) {
  20948. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  20949. await vue.nextTick();
  20950. emitChangeEvent(model.value, e);
  20951. }
  20952. }
  20953. }
  20954. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  20955. vue.watch(() => props.modelValue, () => {
  20956. if (validateEvent.value) {
  20957. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  20958. }
  20959. });
  20960. return {
  20961. handleChange,
  20962. onClickRoot
  20963. };
  20964. };
  20965. const useCheckboxModel = (props) => {
  20966. const selfModel = vue.ref(false);
  20967. const { emit } = vue.getCurrentInstance();
  20968. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20969. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  20970. const isLimitExceeded = vue.ref(false);
  20971. const model = vue.computed({
  20972. get() {
  20973. var _a, _b;
  20974. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  20975. },
  20976. set(val) {
  20977. var _a, _b;
  20978. if (isGroup.value && isArray$1(val)) {
  20979. isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
  20980. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  20981. } else {
  20982. emit(UPDATE_MODEL_EVENT, val);
  20983. selfModel.value = val;
  20984. }
  20985. }
  20986. });
  20987. return {
  20988. model,
  20989. isGroup,
  20990. isLimitExceeded
  20991. };
  20992. };
  20993. const useCheckboxStatus = (props, slots, { model }) => {
  20994. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20995. const isFocused = vue.ref(false);
  20996. const actualValue = vue.computed(() => {
  20997. if (!isPropAbsent(props.value)) {
  20998. return props.value;
  20999. }
  21000. return props.label;
  21001. });
  21002. const isChecked = vue.computed(() => {
  21003. const value = model.value;
  21004. if (isBoolean(value)) {
  21005. return value;
  21006. } else if (isArray$1(value)) {
  21007. if (isObject$1(actualValue.value)) {
  21008. return value.map(vue.toRaw).some((o) => isEqual$1(o, actualValue.value));
  21009. } else {
  21010. return value.map(vue.toRaw).includes(actualValue.value);
  21011. }
  21012. } else if (value !== null && value !== void 0) {
  21013. return value === props.trueValue || value === props.trueLabel;
  21014. } else {
  21015. return !!value;
  21016. }
  21017. });
  21018. const checkboxButtonSize = useFormSize(vue.computed(() => {
  21019. var _a;
  21020. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21021. }), {
  21022. prop: true
  21023. });
  21024. const checkboxSize = useFormSize(vue.computed(() => {
  21025. var _a;
  21026. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21027. }));
  21028. const hasOwnLabel = vue.computed(() => {
  21029. return !!slots.default || !isPropAbsent(actualValue.value);
  21030. });
  21031. return {
  21032. checkboxButtonSize,
  21033. isChecked,
  21034. isFocused,
  21035. checkboxSize,
  21036. hasOwnLabel,
  21037. actualValue
  21038. };
  21039. };
  21040. const useCheckbox = (props, slots) => {
  21041. const { formItem: elFormItem } = useFormItem();
  21042. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  21043. const {
  21044. isFocused,
  21045. isChecked,
  21046. checkboxButtonSize,
  21047. checkboxSize,
  21048. hasOwnLabel,
  21049. actualValue
  21050. } = useCheckboxStatus(props, slots, { model });
  21051. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  21052. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  21053. formItemContext: elFormItem,
  21054. disableIdGeneration: hasOwnLabel,
  21055. disableIdManagement: isGroup
  21056. });
  21057. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  21058. model,
  21059. isLimitExceeded,
  21060. hasOwnLabel,
  21061. isDisabled,
  21062. isLabeledByFormItem
  21063. });
  21064. const setStoreValue = () => {
  21065. function addToStore() {
  21066. var _a, _b;
  21067. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  21068. model.value.push(actualValue.value);
  21069. } else {
  21070. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  21071. }
  21072. }
  21073. props.checked && addToStore();
  21074. };
  21075. setStoreValue();
  21076. useDeprecated({
  21077. from: "label act as value",
  21078. replacement: "value",
  21079. version: "3.0.0",
  21080. scope: "el-checkbox",
  21081. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21082. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21083. useDeprecated({
  21084. from: "true-label",
  21085. replacement: "true-value",
  21086. version: "3.0.0",
  21087. scope: "el-checkbox",
  21088. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21089. }, vue.computed(() => !!props.trueLabel));
  21090. useDeprecated({
  21091. from: "false-label",
  21092. replacement: "false-value",
  21093. version: "3.0.0",
  21094. scope: "el-checkbox",
  21095. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21096. }, vue.computed(() => !!props.falseLabel));
  21097. return {
  21098. inputId,
  21099. isLabeledByFormItem,
  21100. isChecked,
  21101. isDisabled,
  21102. isFocused,
  21103. checkboxButtonSize,
  21104. checkboxSize,
  21105. hasOwnLabel,
  21106. model,
  21107. actualValue,
  21108. handleChange,
  21109. onClickRoot
  21110. };
  21111. };
  21112. const __default__$1m = vue.defineComponent({
  21113. name: "ElCheckbox"
  21114. });
  21115. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  21116. ...__default__$1m,
  21117. props: checkboxProps,
  21118. emits: checkboxEmits,
  21119. setup(__props) {
  21120. const props = __props;
  21121. const slots = vue.useSlots();
  21122. const {
  21123. inputId,
  21124. isLabeledByFormItem,
  21125. isChecked,
  21126. isDisabled,
  21127. isFocused,
  21128. checkboxSize,
  21129. hasOwnLabel,
  21130. model,
  21131. actualValue,
  21132. handleChange,
  21133. onClickRoot
  21134. } = useCheckbox(props, slots);
  21135. const ns = useNamespace("checkbox");
  21136. const compKls = vue.computed(() => {
  21137. return [
  21138. ns.b(),
  21139. ns.m(checkboxSize.value),
  21140. ns.is("disabled", isDisabled.value),
  21141. ns.is("bordered", props.border),
  21142. ns.is("checked", isChecked.value)
  21143. ];
  21144. });
  21145. const spanKls = vue.computed(() => {
  21146. return [
  21147. ns.e("input"),
  21148. ns.is("disabled", isDisabled.value),
  21149. ns.is("checked", isChecked.value),
  21150. ns.is("indeterminate", props.indeterminate),
  21151. ns.is("focus", isFocused.value)
  21152. ];
  21153. });
  21154. return (_ctx, _cache) => {
  21155. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  21156. class: vue.normalizeClass(vue.unref(compKls)),
  21157. "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
  21158. onClick: vue.unref(onClickRoot)
  21159. }, {
  21160. default: vue.withCtx(() => {
  21161. var _a, _b;
  21162. return [
  21163. vue.createElementVNode("span", {
  21164. class: vue.normalizeClass(vue.unref(spanKls))
  21165. }, [
  21166. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21167. key: 0,
  21168. id: vue.unref(inputId),
  21169. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21170. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21171. type: "checkbox",
  21172. indeterminate: _ctx.indeterminate,
  21173. name: _ctx.name,
  21174. tabindex: _ctx.tabindex,
  21175. disabled: vue.unref(isDisabled),
  21176. "true-value": (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel,
  21177. "false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
  21178. onChange: vue.unref(handleChange),
  21179. onFocus: ($event) => isFocused.value = true,
  21180. onBlur: ($event) => isFocused.value = false,
  21181. onClick: vue.withModifiers(() => {
  21182. }, ["stop"])
  21183. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21184. [vue.vModelCheckbox, vue.unref(model)]
  21185. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21186. key: 1,
  21187. id: vue.unref(inputId),
  21188. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21189. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21190. type: "checkbox",
  21191. indeterminate: _ctx.indeterminate,
  21192. disabled: vue.unref(isDisabled),
  21193. value: vue.unref(actualValue),
  21194. name: _ctx.name,
  21195. tabindex: _ctx.tabindex,
  21196. onChange: vue.unref(handleChange),
  21197. onFocus: ($event) => isFocused.value = true,
  21198. onBlur: ($event) => isFocused.value = false,
  21199. onClick: vue.withModifiers(() => {
  21200. }, ["stop"])
  21201. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
  21202. [vue.vModelCheckbox, vue.unref(model)]
  21203. ]),
  21204. vue.createElementVNode("span", {
  21205. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21206. }, null, 2)
  21207. ], 2),
  21208. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  21209. key: 0,
  21210. class: vue.normalizeClass(vue.unref(ns).e("label"))
  21211. }, [
  21212. vue.renderSlot(_ctx.$slots, "default"),
  21213. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  21214. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21215. ], 64)) : vue.createCommentVNode("v-if", true)
  21216. ], 2)) : vue.createCommentVNode("v-if", true)
  21217. ];
  21218. }),
  21219. _: 3
  21220. }, 8, ["class", "aria-controls", "onClick"]);
  21221. };
  21222. }
  21223. });
  21224. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "checkbox.vue"]]);
  21225. const __default__$1l = vue.defineComponent({
  21226. name: "ElCheckboxButton"
  21227. });
  21228. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  21229. ...__default__$1l,
  21230. props: checkboxProps,
  21231. emits: checkboxEmits,
  21232. setup(__props) {
  21233. const props = __props;
  21234. const slots = vue.useSlots();
  21235. const {
  21236. isFocused,
  21237. isChecked,
  21238. isDisabled,
  21239. checkboxButtonSize,
  21240. model,
  21241. actualValue,
  21242. handleChange
  21243. } = useCheckbox(props, slots);
  21244. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21245. const ns = useNamespace("checkbox");
  21246. const activeStyle = vue.computed(() => {
  21247. var _a, _b, _c, _d;
  21248. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  21249. return {
  21250. backgroundColor: fillValue,
  21251. borderColor: fillValue,
  21252. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  21253. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  21254. };
  21255. });
  21256. const labelKls = vue.computed(() => {
  21257. return [
  21258. ns.b("button"),
  21259. ns.bm("button", checkboxButtonSize.value),
  21260. ns.is("disabled", isDisabled.value),
  21261. ns.is("checked", isChecked.value),
  21262. ns.is("focus", isFocused.value)
  21263. ];
  21264. });
  21265. return (_ctx, _cache) => {
  21266. var _a, _b;
  21267. return vue.openBlock(), vue.createElementBlock("label", {
  21268. class: vue.normalizeClass(vue.unref(labelKls))
  21269. }, [
  21270. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21271. key: 0,
  21272. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21273. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21274. type: "checkbox",
  21275. name: _ctx.name,
  21276. tabindex: _ctx.tabindex,
  21277. disabled: vue.unref(isDisabled),
  21278. "true-value": (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel,
  21279. "false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
  21280. onChange: vue.unref(handleChange),
  21281. onFocus: ($event) => isFocused.value = true,
  21282. onBlur: ($event) => isFocused.value = false,
  21283. onClick: vue.withModifiers(() => {
  21284. }, ["stop"])
  21285. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21286. [vue.vModelCheckbox, vue.unref(model)]
  21287. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21288. key: 1,
  21289. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21290. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21291. type: "checkbox",
  21292. name: _ctx.name,
  21293. tabindex: _ctx.tabindex,
  21294. disabled: vue.unref(isDisabled),
  21295. value: vue.unref(actualValue),
  21296. onChange: vue.unref(handleChange),
  21297. onFocus: ($event) => isFocused.value = true,
  21298. onBlur: ($event) => isFocused.value = false,
  21299. onClick: vue.withModifiers(() => {
  21300. }, ["stop"])
  21301. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21302. [vue.vModelCheckbox, vue.unref(model)]
  21303. ]),
  21304. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  21305. key: 2,
  21306. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21307. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  21308. }, [
  21309. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21310. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21311. ])
  21312. ], 6)) : vue.createCommentVNode("v-if", true)
  21313. ], 2);
  21314. };
  21315. }
  21316. });
  21317. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "checkbox-button.vue"]]);
  21318. const checkboxGroupProps = buildProps({
  21319. modelValue: {
  21320. type: definePropType(Array),
  21321. default: () => []
  21322. },
  21323. disabled: Boolean,
  21324. min: Number,
  21325. max: Number,
  21326. size: useSizeProp,
  21327. fill: String,
  21328. textColor: String,
  21329. tag: {
  21330. type: String,
  21331. default: "div"
  21332. },
  21333. validateEvent: {
  21334. type: Boolean,
  21335. default: true
  21336. },
  21337. ...useAriaProps(["ariaLabel"])
  21338. });
  21339. const checkboxGroupEmits = {
  21340. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  21341. change: (val) => isArray$1(val)
  21342. };
  21343. const __default__$1k = vue.defineComponent({
  21344. name: "ElCheckboxGroup"
  21345. });
  21346. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  21347. ...__default__$1k,
  21348. props: checkboxGroupProps,
  21349. emits: checkboxGroupEmits,
  21350. setup(__props, { emit }) {
  21351. const props = __props;
  21352. const ns = useNamespace("checkbox");
  21353. const { formItem } = useFormItem();
  21354. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21355. formItemContext: formItem
  21356. });
  21357. const changeEvent = async (value) => {
  21358. emit(UPDATE_MODEL_EVENT, value);
  21359. await vue.nextTick();
  21360. emit("change", value);
  21361. };
  21362. const modelValue = vue.computed({
  21363. get() {
  21364. return props.modelValue;
  21365. },
  21366. set(val) {
  21367. changeEvent(val);
  21368. }
  21369. });
  21370. vue.provide(checkboxGroupContextKey, {
  21371. ...pick(vue.toRefs(props), [
  21372. "size",
  21373. "min",
  21374. "max",
  21375. "disabled",
  21376. "validateEvent",
  21377. "fill",
  21378. "textColor"
  21379. ]),
  21380. modelValue,
  21381. changeEvent
  21382. });
  21383. vue.watch(() => props.modelValue, () => {
  21384. if (props.validateEvent) {
  21385. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21386. }
  21387. });
  21388. return (_ctx, _cache) => {
  21389. var _a;
  21390. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  21391. id: vue.unref(groupId),
  21392. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21393. role: "group",
  21394. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
  21395. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  21396. }, {
  21397. default: vue.withCtx(() => [
  21398. vue.renderSlot(_ctx.$slots, "default")
  21399. ]),
  21400. _: 3
  21401. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  21402. };
  21403. }
  21404. });
  21405. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "checkbox-group.vue"]]);
  21406. const ElCheckbox = withInstall(Checkbox, {
  21407. CheckboxButton,
  21408. CheckboxGroup
  21409. });
  21410. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  21411. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  21412. const radioPropsBase = buildProps({
  21413. modelValue: {
  21414. type: [String, Number, Boolean],
  21415. default: void 0
  21416. },
  21417. size: useSizeProp,
  21418. disabled: Boolean,
  21419. label: {
  21420. type: [String, Number, Boolean],
  21421. default: void 0
  21422. },
  21423. value: {
  21424. type: [String, Number, Boolean],
  21425. default: void 0
  21426. },
  21427. name: {
  21428. type: String,
  21429. default: void 0
  21430. }
  21431. });
  21432. const radioProps = buildProps({
  21433. ...radioPropsBase,
  21434. border: Boolean
  21435. });
  21436. const radioEmits = {
  21437. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21438. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21439. };
  21440. const radioGroupKey = Symbol("radioGroupKey");
  21441. const useRadio = (props, emit) => {
  21442. const radioRef = vue.ref();
  21443. const radioGroup = vue.inject(radioGroupKey, void 0);
  21444. const isGroup = vue.computed(() => !!radioGroup);
  21445. const actualValue = vue.computed(() => {
  21446. if (!isPropAbsent(props.value)) {
  21447. return props.value;
  21448. }
  21449. return props.label;
  21450. });
  21451. const modelValue = vue.computed({
  21452. get() {
  21453. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21454. },
  21455. set(val) {
  21456. if (isGroup.value) {
  21457. radioGroup.changeEvent(val);
  21458. } else {
  21459. emit && emit(UPDATE_MODEL_EVENT, val);
  21460. }
  21461. radioRef.value.checked = props.modelValue === actualValue.value;
  21462. }
  21463. });
  21464. const size = useFormSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  21465. const disabled = useFormDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21466. const focus = vue.ref(false);
  21467. const tabIndex = vue.computed(() => {
  21468. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  21469. });
  21470. useDeprecated({
  21471. from: "label act as value",
  21472. replacement: "value",
  21473. version: "3.0.0",
  21474. scope: "el-radio",
  21475. ref: "https://element-plus.org/en-US/component/radio.html"
  21476. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21477. return {
  21478. radioRef,
  21479. isGroup,
  21480. radioGroup,
  21481. focus,
  21482. size,
  21483. disabled,
  21484. tabIndex,
  21485. modelValue,
  21486. actualValue
  21487. };
  21488. };
  21489. const __default__$1j = vue.defineComponent({
  21490. name: "ElRadio"
  21491. });
  21492. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  21493. ...__default__$1j,
  21494. props: radioProps,
  21495. emits: radioEmits,
  21496. setup(__props, { emit }) {
  21497. const props = __props;
  21498. const ns = useNamespace("radio");
  21499. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  21500. function handleChange() {
  21501. vue.nextTick(() => emit("change", modelValue.value));
  21502. }
  21503. return (_ctx, _cache) => {
  21504. var _a;
  21505. return vue.openBlock(), vue.createElementBlock("label", {
  21506. class: vue.normalizeClass([
  21507. vue.unref(ns).b(),
  21508. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21509. vue.unref(ns).is("focus", vue.unref(focus)),
  21510. vue.unref(ns).is("bordered", _ctx.border),
  21511. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue)),
  21512. vue.unref(ns).m(vue.unref(size))
  21513. ])
  21514. }, [
  21515. vue.createElementVNode("span", {
  21516. class: vue.normalizeClass([
  21517. vue.unref(ns).e("input"),
  21518. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21519. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue))
  21520. ])
  21521. }, [
  21522. vue.withDirectives(vue.createElementVNode("input", {
  21523. ref_key: "radioRef",
  21524. ref: radioRef,
  21525. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  21526. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21527. value: vue.unref(actualValue),
  21528. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21529. disabled: vue.unref(disabled),
  21530. checked: vue.unref(modelValue) === vue.unref(actualValue),
  21531. type: "radio",
  21532. onFocus: ($event) => focus.value = true,
  21533. onBlur: ($event) => focus.value = false,
  21534. onChange: handleChange,
  21535. onClick: vue.withModifiers(() => {
  21536. }, ["stop"])
  21537. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  21538. [vue.vModelRadio, vue.unref(modelValue)]
  21539. ]),
  21540. vue.createElementVNode("span", {
  21541. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21542. }, null, 2)
  21543. ], 2),
  21544. vue.createElementVNode("span", {
  21545. class: vue.normalizeClass(vue.unref(ns).e("label")),
  21546. onKeydown: vue.withModifiers(() => {
  21547. }, ["stop"])
  21548. }, [
  21549. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21550. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21551. ])
  21552. ], 42, ["onKeydown"])
  21553. ], 2);
  21554. };
  21555. }
  21556. });
  21557. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "radio.vue"]]);
  21558. const radioButtonProps = buildProps({
  21559. ...radioPropsBase
  21560. });
  21561. const __default__$1i = vue.defineComponent({
  21562. name: "ElRadioButton"
  21563. });
  21564. const _sfc_main$1T = /* @__PURE__ */ vue.defineComponent({
  21565. ...__default__$1i,
  21566. props: radioButtonProps,
  21567. setup(__props) {
  21568. const props = __props;
  21569. const ns = useNamespace("radio");
  21570. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  21571. const activeStyle = vue.computed(() => {
  21572. return {
  21573. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21574. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21575. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21576. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  21577. };
  21578. });
  21579. return (_ctx, _cache) => {
  21580. var _a;
  21581. return vue.openBlock(), vue.createElementBlock("label", {
  21582. class: vue.normalizeClass([
  21583. vue.unref(ns).b("button"),
  21584. vue.unref(ns).is("active", vue.unref(modelValue) === vue.unref(actualValue)),
  21585. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21586. vue.unref(ns).is("focus", vue.unref(focus)),
  21587. vue.unref(ns).bm("button", vue.unref(size))
  21588. ])
  21589. }, [
  21590. vue.withDirectives(vue.createElementVNode("input", {
  21591. ref_key: "radioRef",
  21592. ref: radioRef,
  21593. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  21594. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  21595. value: vue.unref(actualValue),
  21596. type: "radio",
  21597. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21598. disabled: vue.unref(disabled),
  21599. onFocus: ($event) => focus.value = true,
  21600. onBlur: ($event) => focus.value = false,
  21601. onClick: vue.withModifiers(() => {
  21602. }, ["stop"])
  21603. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
  21604. [vue.vModelRadio, vue.unref(modelValue)]
  21605. ]),
  21606. vue.createElementVNode("span", {
  21607. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21608. style: vue.normalizeStyle(vue.unref(modelValue) === vue.unref(actualValue) ? vue.unref(activeStyle) : {}),
  21609. onKeydown: vue.withModifiers(() => {
  21610. }, ["stop"])
  21611. }, [
  21612. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21613. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21614. ])
  21615. ], 46, ["onKeydown"])
  21616. ], 2);
  21617. };
  21618. }
  21619. });
  21620. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "radio-button.vue"]]);
  21621. const radioGroupProps = buildProps({
  21622. id: {
  21623. type: String,
  21624. default: void 0
  21625. },
  21626. size: useSizeProp,
  21627. disabled: Boolean,
  21628. modelValue: {
  21629. type: [String, Number, Boolean],
  21630. default: void 0
  21631. },
  21632. fill: {
  21633. type: String,
  21634. default: ""
  21635. },
  21636. textColor: {
  21637. type: String,
  21638. default: ""
  21639. },
  21640. name: {
  21641. type: String,
  21642. default: void 0
  21643. },
  21644. validateEvent: {
  21645. type: Boolean,
  21646. default: true
  21647. },
  21648. ...useAriaProps(["ariaLabel"])
  21649. });
  21650. const radioGroupEmits = radioEmits;
  21651. const __default__$1h = vue.defineComponent({
  21652. name: "ElRadioGroup"
  21653. });
  21654. const _sfc_main$1S = /* @__PURE__ */ vue.defineComponent({
  21655. ...__default__$1h,
  21656. props: radioGroupProps,
  21657. emits: radioGroupEmits,
  21658. setup(__props, { emit }) {
  21659. const props = __props;
  21660. const ns = useNamespace("radio");
  21661. const radioId = useId();
  21662. const radioGroupRef = vue.ref();
  21663. const { formItem } = useFormItem();
  21664. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21665. formItemContext: formItem
  21666. });
  21667. const changeEvent = (value) => {
  21668. emit(UPDATE_MODEL_EVENT, value);
  21669. vue.nextTick(() => emit("change", value));
  21670. };
  21671. vue.onMounted(() => {
  21672. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  21673. const firstLabel = radios[0];
  21674. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  21675. firstLabel.tabIndex = 0;
  21676. }
  21677. });
  21678. const name = vue.computed(() => {
  21679. return props.name || radioId.value;
  21680. });
  21681. vue.provide(radioGroupKey, vue.reactive({
  21682. ...vue.toRefs(props),
  21683. changeEvent,
  21684. name
  21685. }));
  21686. vue.watch(() => props.modelValue, () => {
  21687. if (props.validateEvent) {
  21688. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21689. }
  21690. });
  21691. return (_ctx, _cache) => {
  21692. return vue.openBlock(), vue.createElementBlock("div", {
  21693. id: vue.unref(groupId),
  21694. ref_key: "radioGroupRef",
  21695. ref: radioGroupRef,
  21696. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21697. role: "radiogroup",
  21698. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
  21699. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  21700. }, [
  21701. vue.renderSlot(_ctx.$slots, "default")
  21702. ], 10, ["id", "aria-label", "aria-labelledby"]);
  21703. };
  21704. }
  21705. });
  21706. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "radio-group.vue"]]);
  21707. const ElRadio = withInstall(Radio, {
  21708. RadioButton,
  21709. RadioGroup
  21710. });
  21711. const ElRadioGroup = withNoopInstall(RadioGroup);
  21712. const ElRadioButton = withNoopInstall(RadioButton);
  21713. var NodeContent$1 = vue.defineComponent({
  21714. name: "NodeContent",
  21715. setup() {
  21716. const ns = useNamespace("cascader-node");
  21717. return {
  21718. ns
  21719. };
  21720. },
  21721. render() {
  21722. const { ns } = this;
  21723. const { node, panel } = this.$parent;
  21724. const { data, label } = node;
  21725. const { renderLabelFn } = panel;
  21726. return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  21727. }
  21728. });
  21729. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  21730. const _sfc_main$1R = vue.defineComponent({
  21731. name: "ElCascaderNode",
  21732. components: {
  21733. ElCheckbox,
  21734. ElRadio,
  21735. NodeContent: NodeContent$1,
  21736. ElIcon,
  21737. Check: check_default,
  21738. Loading: loading_default,
  21739. ArrowRight: arrow_right_default
  21740. },
  21741. props: {
  21742. node: {
  21743. type: Object,
  21744. required: true
  21745. },
  21746. menuId: String
  21747. },
  21748. emits: ["expand"],
  21749. setup(props, { emit }) {
  21750. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  21751. const ns = useNamespace("cascader-node");
  21752. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  21753. const multiple = vue.computed(() => panel.config.multiple);
  21754. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  21755. const checkedNodeId = vue.computed(() => {
  21756. var _a;
  21757. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  21758. });
  21759. const isDisabled = vue.computed(() => props.node.isDisabled);
  21760. const isLeaf = vue.computed(() => props.node.isLeaf);
  21761. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  21762. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  21763. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  21764. const isInPath = (node) => {
  21765. var _a;
  21766. const { level, uid } = props.node;
  21767. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  21768. };
  21769. const doExpand = () => {
  21770. if (inExpandingPath.value)
  21771. return;
  21772. panel.expandNode(props.node);
  21773. };
  21774. const doCheck = (checked) => {
  21775. const { node } = props;
  21776. if (checked === node.checked)
  21777. return;
  21778. panel.handleCheckChange(node, checked);
  21779. };
  21780. const doLoad = () => {
  21781. panel.lazyLoad(props.node, () => {
  21782. if (!isLeaf.value)
  21783. doExpand();
  21784. });
  21785. };
  21786. const handleHoverExpand = (e) => {
  21787. if (!isHoverMenu.value)
  21788. return;
  21789. handleExpand();
  21790. !isLeaf.value && emit("expand", e);
  21791. };
  21792. const handleExpand = () => {
  21793. const { node } = props;
  21794. if (!expandable.value || node.loading)
  21795. return;
  21796. node.loaded ? doExpand() : doLoad();
  21797. };
  21798. const handleClick = () => {
  21799. if (isHoverMenu.value && !isLeaf.value)
  21800. return;
  21801. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  21802. handleCheck(true);
  21803. } else {
  21804. handleExpand();
  21805. }
  21806. };
  21807. const handleSelectCheck = (checked) => {
  21808. if (checkStrictly.value) {
  21809. doCheck(checked);
  21810. if (props.node.loaded) {
  21811. doExpand();
  21812. }
  21813. } else {
  21814. handleCheck(checked);
  21815. }
  21816. };
  21817. const handleCheck = (checked) => {
  21818. if (!props.node.loaded) {
  21819. doLoad();
  21820. } else {
  21821. doCheck(checked);
  21822. !checkStrictly.value && doExpand();
  21823. }
  21824. };
  21825. return {
  21826. panel,
  21827. isHoverMenu,
  21828. multiple,
  21829. checkStrictly,
  21830. checkedNodeId,
  21831. isDisabled,
  21832. isLeaf,
  21833. expandable,
  21834. inExpandingPath,
  21835. inCheckedPath,
  21836. ns,
  21837. handleHoverExpand,
  21838. handleExpand,
  21839. handleClick,
  21840. handleCheck,
  21841. handleSelectCheck
  21842. };
  21843. }
  21844. });
  21845. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  21846. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  21847. const _component_el_radio = vue.resolveComponent("el-radio");
  21848. const _component_check = vue.resolveComponent("check");
  21849. const _component_el_icon = vue.resolveComponent("el-icon");
  21850. const _component_node_content = vue.resolveComponent("node-content");
  21851. const _component_loading = vue.resolveComponent("loading");
  21852. const _component_arrow_right = vue.resolveComponent("arrow-right");
  21853. return vue.openBlock(), vue.createElementBlock("li", {
  21854. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  21855. role: "menuitem",
  21856. "aria-haspopup": !_ctx.isLeaf,
  21857. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  21858. "aria-expanded": _ctx.inExpandingPath,
  21859. tabindex: _ctx.expandable ? -1 : void 0,
  21860. class: vue.normalizeClass([
  21861. _ctx.ns.b(),
  21862. _ctx.ns.is("selectable", _ctx.checkStrictly),
  21863. _ctx.ns.is("active", _ctx.node.checked),
  21864. _ctx.ns.is("disabled", !_ctx.expandable),
  21865. _ctx.inExpandingPath && "in-active-path",
  21866. _ctx.inCheckedPath && "in-checked-path"
  21867. ]),
  21868. onMouseenter: _ctx.handleHoverExpand,
  21869. onFocus: _ctx.handleHoverExpand,
  21870. onClick: _ctx.handleClick
  21871. }, [
  21872. vue.createCommentVNode(" prefix "),
  21873. _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  21874. key: 0,
  21875. "model-value": _ctx.node.checked,
  21876. indeterminate: _ctx.node.indeterminate,
  21877. disabled: _ctx.isDisabled,
  21878. onClick: vue.withModifiers(() => {
  21879. }, ["stop"]),
  21880. "onUpdate:modelValue": _ctx.handleSelectCheck
  21881. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, {
  21882. key: 1,
  21883. "model-value": _ctx.checkedNodeId,
  21884. label: _ctx.node.uid,
  21885. disabled: _ctx.isDisabled,
  21886. "onUpdate:modelValue": _ctx.handleSelectCheck,
  21887. onClick: vue.withModifiers(() => {
  21888. }, ["stop"])
  21889. }, {
  21890. default: vue.withCtx(() => [
  21891. 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 "),
  21892. vue.createElementVNode("span")
  21893. ]),
  21894. _: 1
  21895. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue", "onClick"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21896. key: 2,
  21897. class: vue.normalizeClass(_ctx.ns.e("prefix"))
  21898. }, {
  21899. default: vue.withCtx(() => [
  21900. vue.createVNode(_component_check)
  21901. ]),
  21902. _: 1
  21903. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  21904. vue.createCommentVNode(" content "),
  21905. vue.createVNode(_component_node_content),
  21906. vue.createCommentVNode(" postfix "),
  21907. !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  21908. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21909. key: 0,
  21910. class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  21911. }, {
  21912. default: vue.withCtx(() => [
  21913. vue.createVNode(_component_loading)
  21914. ]),
  21915. _: 1
  21916. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21917. key: 1,
  21918. class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  21919. }, {
  21920. default: vue.withCtx(() => [
  21921. vue.createVNode(_component_arrow_right)
  21922. ]),
  21923. _: 1
  21924. }, 8, ["class"]))
  21925. ], 64)) : vue.createCommentVNode("v-if", true)
  21926. ], 42, ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex", "onMouseenter", "onFocus", "onClick"]);
  21927. }
  21928. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["render", _sfc_render$t], ["__file", "node.vue"]]);
  21929. const _sfc_main$1Q = vue.defineComponent({
  21930. name: "ElCascaderMenu",
  21931. components: {
  21932. Loading: loading_default,
  21933. ElIcon,
  21934. ElScrollbar,
  21935. ElCascaderNode
  21936. },
  21937. props: {
  21938. nodes: {
  21939. type: Array,
  21940. required: true
  21941. },
  21942. index: {
  21943. type: Number,
  21944. required: true
  21945. }
  21946. },
  21947. setup(props) {
  21948. const instance = vue.getCurrentInstance();
  21949. const ns = useNamespace("cascader-menu");
  21950. const { t } = useLocale();
  21951. const id = useId();
  21952. let activeNode = null;
  21953. let hoverTimer = null;
  21954. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  21955. const hoverZone = vue.ref(null);
  21956. const isEmpty = vue.computed(() => !props.nodes.length);
  21957. const isLoading = vue.computed(() => !panel.initialLoaded);
  21958. const menuId = vue.computed(() => `${id.value}-${props.index}`);
  21959. const handleExpand = (e) => {
  21960. activeNode = e.target;
  21961. };
  21962. const handleMouseMove = (e) => {
  21963. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  21964. return;
  21965. if (activeNode.contains(e.target)) {
  21966. clearHoverTimer();
  21967. const el = instance.vnode.el;
  21968. const { left } = el.getBoundingClientRect();
  21969. const { offsetWidth, offsetHeight } = el;
  21970. const startX = e.clientX - left;
  21971. const top = activeNode.offsetTop;
  21972. const bottom = top + activeNode.offsetHeight;
  21973. hoverZone.value.innerHTML = `
  21974. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  21975. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  21976. `;
  21977. } else if (!hoverTimer) {
  21978. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  21979. }
  21980. };
  21981. const clearHoverTimer = () => {
  21982. if (!hoverTimer)
  21983. return;
  21984. clearTimeout(hoverTimer);
  21985. hoverTimer = null;
  21986. };
  21987. const clearHoverZone = () => {
  21988. if (!hoverZone.value)
  21989. return;
  21990. hoverZone.value.innerHTML = "";
  21991. clearHoverTimer();
  21992. };
  21993. return {
  21994. ns,
  21995. panel,
  21996. hoverZone,
  21997. isEmpty,
  21998. isLoading,
  21999. menuId,
  22000. t,
  22001. handleExpand,
  22002. handleMouseMove,
  22003. clearHoverZone
  22004. };
  22005. }
  22006. });
  22007. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  22008. const _component_el_cascader_node = vue.resolveComponent("el-cascader-node");
  22009. const _component_loading = vue.resolveComponent("loading");
  22010. const _component_el_icon = vue.resolveComponent("el-icon");
  22011. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  22012. return vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  22013. key: _ctx.menuId,
  22014. tag: "ul",
  22015. role: "menu",
  22016. class: vue.normalizeClass(_ctx.ns.b()),
  22017. "wrap-class": _ctx.ns.e("wrap"),
  22018. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  22019. onMousemove: _ctx.handleMouseMove,
  22020. onMouseleave: _ctx.clearHoverZone
  22021. }, {
  22022. default: vue.withCtx(() => {
  22023. var _a;
  22024. return [
  22025. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => {
  22026. return vue.openBlock(), vue.createBlock(_component_el_cascader_node, {
  22027. key: node.uid,
  22028. node,
  22029. "menu-id": _ctx.menuId,
  22030. onExpand: _ctx.handleExpand
  22031. }, null, 8, ["node", "menu-id", "onExpand"]);
  22032. }), 128)),
  22033. _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", {
  22034. key: 0,
  22035. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22036. }, [
  22037. vue.createVNode(_component_el_icon, {
  22038. size: "14",
  22039. class: vue.normalizeClass(_ctx.ns.is("loading"))
  22040. }, {
  22041. default: vue.withCtx(() => [
  22042. vue.createVNode(_component_loading)
  22043. ]),
  22044. _: 1
  22045. }, 8, ["class"]),
  22046. vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1)
  22047. ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  22048. key: 1,
  22049. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22050. }, vue.toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock("svg", {
  22051. key: 2,
  22052. ref: "hoverZone",
  22053. class: vue.normalizeClass(_ctx.ns.e("hover-zone"))
  22054. }, null, 2)) : vue.createCommentVNode("v-if", true)
  22055. ];
  22056. }),
  22057. _: 1
  22058. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  22059. }
  22060. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["render", _sfc_render$s], ["__file", "menu.vue"]]);
  22061. let uid = 0;
  22062. const calculatePathNodes = (node) => {
  22063. const nodes = [node];
  22064. let { parent } = node;
  22065. while (parent) {
  22066. nodes.unshift(parent);
  22067. parent = parent.parent;
  22068. }
  22069. return nodes;
  22070. };
  22071. class Node$2 {
  22072. constructor(data, config, parent, root = false) {
  22073. this.data = data;
  22074. this.config = config;
  22075. this.parent = parent;
  22076. this.root = root;
  22077. this.uid = uid++;
  22078. this.checked = false;
  22079. this.indeterminate = false;
  22080. this.loading = false;
  22081. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  22082. const childrenData = data[childrenKey];
  22083. const pathNodes = calculatePathNodes(this);
  22084. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  22085. this.value = data[valueKey];
  22086. this.label = data[labelKey];
  22087. this.pathNodes = pathNodes;
  22088. this.pathValues = pathNodes.map((node) => node.value);
  22089. this.pathLabels = pathNodes.map((node) => node.label);
  22090. this.childrenData = childrenData;
  22091. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  22092. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  22093. }
  22094. get isDisabled() {
  22095. const { data, parent, config } = this;
  22096. const { disabled, checkStrictly } = config;
  22097. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  22098. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  22099. }
  22100. get isLeaf() {
  22101. const { data, config, childrenData, loaded } = this;
  22102. const { lazy, leaf } = config;
  22103. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  22104. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf;
  22105. }
  22106. get valueByOption() {
  22107. return this.config.emitPath ? this.pathValues : this.value;
  22108. }
  22109. appendChild(childData) {
  22110. const { childrenData, children } = this;
  22111. const node = new Node$2(childData, this.config, this);
  22112. if (Array.isArray(childrenData)) {
  22113. childrenData.push(childData);
  22114. } else {
  22115. this.childrenData = [childData];
  22116. }
  22117. children.push(node);
  22118. return node;
  22119. }
  22120. calcText(allLevels, separator) {
  22121. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  22122. this.text = text;
  22123. return text;
  22124. }
  22125. broadcast(event, ...args) {
  22126. const handlerName = `onParent${capitalize(event)}`;
  22127. this.children.forEach((child) => {
  22128. if (child) {
  22129. child.broadcast(event, ...args);
  22130. child[handlerName] && child[handlerName](...args);
  22131. }
  22132. });
  22133. }
  22134. emit(event, ...args) {
  22135. const { parent } = this;
  22136. const handlerName = `onChild${capitalize(event)}`;
  22137. if (parent) {
  22138. parent[handlerName] && parent[handlerName](...args);
  22139. parent.emit(event, ...args);
  22140. }
  22141. }
  22142. onParentCheck(checked) {
  22143. if (!this.isDisabled) {
  22144. this.setCheckState(checked);
  22145. }
  22146. }
  22147. onChildCheck() {
  22148. const { children } = this;
  22149. const validChildren = children.filter((child) => !child.isDisabled);
  22150. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  22151. this.setCheckState(checked);
  22152. }
  22153. setCheckState(checked) {
  22154. const totalNum = this.children.length;
  22155. const checkedNum = this.children.reduce((c, p) => {
  22156. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  22157. return c + num;
  22158. }, 0);
  22159. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  22160. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  22161. }
  22162. doCheck(checked) {
  22163. if (this.checked === checked)
  22164. return;
  22165. const { checkStrictly, multiple } = this.config;
  22166. if (checkStrictly || !multiple) {
  22167. this.checked = checked;
  22168. } else {
  22169. this.broadcast("check", checked);
  22170. this.setCheckState(checked);
  22171. this.emit("check");
  22172. }
  22173. }
  22174. }
  22175. var Node$3 = Node$2;
  22176. const flatNodes = (nodes, leafOnly) => {
  22177. return nodes.reduce((res, node) => {
  22178. if (node.isLeaf) {
  22179. res.push(node);
  22180. } else {
  22181. !leafOnly && res.push(node);
  22182. res = res.concat(flatNodes(node.children, leafOnly));
  22183. }
  22184. return res;
  22185. }, []);
  22186. };
  22187. class Store {
  22188. constructor(data, config) {
  22189. this.config = config;
  22190. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  22191. this.nodes = nodes;
  22192. this.allNodes = flatNodes(nodes, false);
  22193. this.leafNodes = flatNodes(nodes, true);
  22194. }
  22195. getNodes() {
  22196. return this.nodes;
  22197. }
  22198. getFlattedNodes(leafOnly) {
  22199. return leafOnly ? this.leafNodes : this.allNodes;
  22200. }
  22201. appendNode(nodeData, parentNode) {
  22202. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  22203. if (!parentNode)
  22204. this.nodes.push(node);
  22205. this.allNodes.push(node);
  22206. node.isLeaf && this.leafNodes.push(node);
  22207. }
  22208. appendNodes(nodeDataList, parentNode) {
  22209. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  22210. }
  22211. getNodeByValue(value, leafOnly = false) {
  22212. if (!value && value !== 0)
  22213. return null;
  22214. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  22215. return node || null;
  22216. }
  22217. getSameNode(node) {
  22218. if (!node)
  22219. return null;
  22220. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  22221. return node_ || null;
  22222. }
  22223. }
  22224. const CommonProps = buildProps({
  22225. modelValue: {
  22226. type: definePropType([Number, String, Array])
  22227. },
  22228. options: {
  22229. type: definePropType(Array),
  22230. default: () => []
  22231. },
  22232. props: {
  22233. type: definePropType(Object),
  22234. default: () => ({})
  22235. }
  22236. });
  22237. const DefaultProps = {
  22238. expandTrigger: "click",
  22239. multiple: false,
  22240. checkStrictly: false,
  22241. emitPath: true,
  22242. lazy: false,
  22243. lazyLoad: NOOP,
  22244. value: "value",
  22245. label: "label",
  22246. children: "children",
  22247. leaf: "leaf",
  22248. disabled: "disabled",
  22249. hoverThreshold: 500
  22250. };
  22251. const useCascaderConfig = (props) => {
  22252. return vue.computed(() => ({
  22253. ...DefaultProps,
  22254. ...props.props
  22255. }));
  22256. };
  22257. const getMenuIndex = (el) => {
  22258. if (!el)
  22259. return 0;
  22260. const pieces = el.id.split("-");
  22261. return Number(pieces[pieces.length - 2]);
  22262. };
  22263. const checkNode = (el) => {
  22264. if (!el)
  22265. return;
  22266. const input = el.querySelector("input");
  22267. if (input) {
  22268. input.click();
  22269. } else if (isLeaf(el)) {
  22270. el.click();
  22271. }
  22272. };
  22273. const sortByOriginalOrder = (oldNodes, newNodes) => {
  22274. const newNodesCopy = newNodes.slice(0);
  22275. const newIds = newNodesCopy.map((node) => node.uid);
  22276. const res = oldNodes.reduce((acc, item) => {
  22277. const index = newIds.indexOf(item.uid);
  22278. if (index > -1) {
  22279. acc.push(item);
  22280. newNodesCopy.splice(index, 1);
  22281. newIds.splice(index, 1);
  22282. }
  22283. return acc;
  22284. }, []);
  22285. res.push(...newNodesCopy);
  22286. return res;
  22287. };
  22288. const _sfc_main$1P = vue.defineComponent({
  22289. name: "ElCascaderPanel",
  22290. components: {
  22291. ElCascaderMenu
  22292. },
  22293. props: {
  22294. ...CommonProps,
  22295. border: {
  22296. type: Boolean,
  22297. default: true
  22298. },
  22299. renderLabel: Function
  22300. },
  22301. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  22302. setup(props, { emit, slots }) {
  22303. let manualChecked = false;
  22304. const ns = useNamespace("cascader");
  22305. const config = useCascaderConfig(props);
  22306. let store = null;
  22307. const initialLoaded = vue.ref(true);
  22308. const menuList = vue.ref([]);
  22309. const checkedValue = vue.ref(null);
  22310. const menus = vue.ref([]);
  22311. const expandingNode = vue.ref(null);
  22312. const checkedNodes = vue.ref([]);
  22313. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  22314. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  22315. const initStore = () => {
  22316. const { options } = props;
  22317. const cfg = config.value;
  22318. manualChecked = false;
  22319. store = new Store(options, cfg);
  22320. menus.value = [store.getNodes()];
  22321. if (cfg.lazy && isEmpty(props.options)) {
  22322. initialLoaded.value = false;
  22323. lazyLoad(void 0, (list) => {
  22324. if (list) {
  22325. store = new Store(list, cfg);
  22326. menus.value = [store.getNodes()];
  22327. }
  22328. initialLoaded.value = true;
  22329. syncCheckedValue(false, true);
  22330. });
  22331. } else {
  22332. syncCheckedValue(false, true);
  22333. }
  22334. };
  22335. const lazyLoad = (node, cb) => {
  22336. const cfg = config.value;
  22337. node = node || new Node$3({}, cfg, void 0, true);
  22338. node.loading = true;
  22339. const resolve = (dataList) => {
  22340. const _node = node;
  22341. const parent = _node.root ? null : _node;
  22342. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  22343. _node.loading = false;
  22344. _node.loaded = true;
  22345. _node.childrenData = _node.childrenData || [];
  22346. cb && cb(dataList);
  22347. };
  22348. cfg.lazyLoad(node, resolve);
  22349. };
  22350. const expandNode = (node, silent) => {
  22351. var _a;
  22352. const { level } = node;
  22353. const newMenus = menus.value.slice(0, level);
  22354. let newExpandingNode;
  22355. if (node.isLeaf) {
  22356. newExpandingNode = node.pathNodes[level - 2];
  22357. } else {
  22358. newExpandingNode = node;
  22359. newMenus.push(node.children);
  22360. }
  22361. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  22362. expandingNode.value = node;
  22363. menus.value = newMenus;
  22364. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  22365. }
  22366. };
  22367. const handleCheckChange = (node, checked, emitClose = true) => {
  22368. const { checkStrictly, multiple } = config.value;
  22369. const oldNode = checkedNodes.value[0];
  22370. manualChecked = true;
  22371. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  22372. node.doCheck(checked);
  22373. calculateCheckedValue();
  22374. emitClose && !multiple && !checkStrictly && emit("close");
  22375. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  22376. };
  22377. const expandParentNode = (node) => {
  22378. if (!node)
  22379. return;
  22380. node = node.parent;
  22381. expandParentNode(node);
  22382. node && expandNode(node);
  22383. };
  22384. const getFlattedNodes = (leafOnly) => {
  22385. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  22386. };
  22387. const getCheckedNodes = (leafOnly) => {
  22388. var _a;
  22389. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  22390. };
  22391. const clearCheckedNodes = () => {
  22392. checkedNodes.value.forEach((node) => node.doCheck(false));
  22393. calculateCheckedValue();
  22394. menus.value = menus.value.slice(0, 1);
  22395. expandingNode.value = null;
  22396. emit("expand-change", []);
  22397. };
  22398. const calculateCheckedValue = () => {
  22399. var _a;
  22400. const { checkStrictly, multiple } = config.value;
  22401. const oldNodes = checkedNodes.value;
  22402. const newNodes = getCheckedNodes(!checkStrictly);
  22403. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  22404. const values = nodes.map((node) => node.valueByOption);
  22405. checkedNodes.value = nodes;
  22406. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  22407. };
  22408. const syncCheckedValue = (loaded = false, forced = false) => {
  22409. const { modelValue } = props;
  22410. const { lazy, multiple, checkStrictly } = config.value;
  22411. const leafOnly = !checkStrictly;
  22412. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  22413. return;
  22414. if (lazy && !loaded) {
  22415. const values = unique(flattenDeep(castArray(modelValue)));
  22416. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  22417. if (nodes.length) {
  22418. nodes.forEach((node) => {
  22419. lazyLoad(node, () => syncCheckedValue(false, forced));
  22420. });
  22421. } else {
  22422. syncCheckedValue(true, forced);
  22423. }
  22424. } else {
  22425. const values = multiple ? castArray(modelValue) : [modelValue];
  22426. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  22427. syncMenuState(nodes, forced);
  22428. checkedValue.value = cloneDeep(modelValue);
  22429. }
  22430. };
  22431. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  22432. const { checkStrictly } = config.value;
  22433. const oldNodes = checkedNodes.value;
  22434. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  22435. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  22436. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  22437. if (newExpandingNode) {
  22438. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  22439. } else {
  22440. expandingNode.value = null;
  22441. }
  22442. oldNodes.forEach((node) => node.doCheck(false));
  22443. vue.reactive(newNodes).forEach((node) => node.doCheck(true));
  22444. checkedNodes.value = newNodes;
  22445. vue.nextTick(scrollToExpandingNode);
  22446. };
  22447. const scrollToExpandingNode = () => {
  22448. if (!isClient)
  22449. return;
  22450. menuList.value.forEach((menu) => {
  22451. const menuElement = menu == null ? void 0 : menu.$el;
  22452. if (menuElement) {
  22453. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  22454. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  22455. scrollIntoView(container, activeNode);
  22456. }
  22457. });
  22458. };
  22459. const handleKeyDown = (e) => {
  22460. const target = e.target;
  22461. const { code } = e;
  22462. switch (code) {
  22463. case EVENT_CODE.up:
  22464. case EVENT_CODE.down: {
  22465. e.preventDefault();
  22466. const distance = code === EVENT_CODE.up ? -1 : 1;
  22467. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  22468. break;
  22469. }
  22470. case EVENT_CODE.left: {
  22471. e.preventDefault();
  22472. const preMenu = menuList.value[getMenuIndex(target) - 1];
  22473. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  22474. focusNode(expandedNode);
  22475. break;
  22476. }
  22477. case EVENT_CODE.right: {
  22478. e.preventDefault();
  22479. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  22480. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  22481. focusNode(firstNode);
  22482. break;
  22483. }
  22484. case EVENT_CODE.enter:
  22485. checkNode(target);
  22486. break;
  22487. }
  22488. };
  22489. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  22490. config,
  22491. expandingNode,
  22492. checkedNodes,
  22493. isHoverMenu,
  22494. initialLoaded,
  22495. renderLabelFn,
  22496. lazyLoad,
  22497. expandNode,
  22498. handleCheckChange
  22499. }));
  22500. vue.watch([config, () => props.options], initStore, {
  22501. deep: true,
  22502. immediate: true
  22503. });
  22504. vue.watch(() => props.modelValue, () => {
  22505. manualChecked = false;
  22506. syncCheckedValue();
  22507. }, {
  22508. deep: true
  22509. });
  22510. vue.watch(() => checkedValue.value, (val) => {
  22511. if (!isEqual$1(val, props.modelValue)) {
  22512. emit(UPDATE_MODEL_EVENT, val);
  22513. emit(CHANGE_EVENT, val);
  22514. }
  22515. });
  22516. vue.onBeforeUpdate(() => menuList.value = []);
  22517. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  22518. return {
  22519. ns,
  22520. menuList,
  22521. menus,
  22522. checkedNodes,
  22523. handleKeyDown,
  22524. handleCheckChange,
  22525. getFlattedNodes,
  22526. getCheckedNodes,
  22527. clearCheckedNodes,
  22528. calculateCheckedValue,
  22529. scrollToExpandingNode
  22530. };
  22531. }
  22532. });
  22533. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  22534. const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu");
  22535. return vue.openBlock(), vue.createElementBlock("div", {
  22536. class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  22537. onKeydown: _ctx.handleKeyDown
  22538. }, [
  22539. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => {
  22540. return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, {
  22541. key: index,
  22542. ref_for: true,
  22543. ref: (item) => _ctx.menuList[index] = item,
  22544. index,
  22545. nodes: [...menu]
  22546. }, null, 8, ["index", "nodes"]);
  22547. }), 128))
  22548. ], 42, ["onKeydown"]);
  22549. }
  22550. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["render", _sfc_render$r], ["__file", "index.vue"]]);
  22551. const ElCascaderPanel = withInstall(CascaderPanel);
  22552. const tagProps = buildProps({
  22553. type: {
  22554. type: String,
  22555. values: ["primary", "success", "info", "warning", "danger"],
  22556. default: "primary"
  22557. },
  22558. closable: Boolean,
  22559. disableTransitions: Boolean,
  22560. hit: Boolean,
  22561. color: String,
  22562. size: {
  22563. type: String,
  22564. values: componentSizes
  22565. },
  22566. effect: {
  22567. type: String,
  22568. values: ["dark", "light", "plain"],
  22569. default: "light"
  22570. },
  22571. round: Boolean
  22572. });
  22573. const tagEmits = {
  22574. close: (evt) => evt instanceof MouseEvent,
  22575. click: (evt) => evt instanceof MouseEvent
  22576. };
  22577. const __default__$1g = vue.defineComponent({
  22578. name: "ElTag"
  22579. });
  22580. const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
  22581. ...__default__$1g,
  22582. props: tagProps,
  22583. emits: tagEmits,
  22584. setup(__props, { emit }) {
  22585. const props = __props;
  22586. const tagSize = useFormSize();
  22587. const ns = useNamespace("tag");
  22588. const containerKls = vue.computed(() => {
  22589. const { type, hit, effect, closable, round } = props;
  22590. return [
  22591. ns.b(),
  22592. ns.is("closable", closable),
  22593. ns.m(type || "primary"),
  22594. ns.m(tagSize.value),
  22595. ns.m(effect),
  22596. ns.is("hit", hit),
  22597. ns.is("round", round)
  22598. ];
  22599. });
  22600. const handleClose = (event) => {
  22601. emit("close", event);
  22602. };
  22603. const handleClick = (event) => {
  22604. emit("click", event);
  22605. };
  22606. const handleVNodeMounted = (vnode) => {
  22607. vnode.component.subTree.component.bum = null;
  22608. };
  22609. return (_ctx, _cache) => {
  22610. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  22611. key: 0,
  22612. class: vue.normalizeClass(vue.unref(containerKls)),
  22613. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22614. onClick: handleClick
  22615. }, [
  22616. vue.createElementVNode("span", {
  22617. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22618. }, [
  22619. vue.renderSlot(_ctx.$slots, "default")
  22620. ], 2),
  22621. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22622. key: 0,
  22623. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22624. onClick: vue.withModifiers(handleClose, ["stop"])
  22625. }, {
  22626. default: vue.withCtx(() => [
  22627. vue.createVNode(vue.unref(close_default))
  22628. ]),
  22629. _: 1
  22630. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22631. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  22632. key: 1,
  22633. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  22634. appear: "",
  22635. onVnodeMounted: handleVNodeMounted
  22636. }, {
  22637. default: vue.withCtx(() => [
  22638. vue.createElementVNode("span", {
  22639. class: vue.normalizeClass(vue.unref(containerKls)),
  22640. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22641. onClick: handleClick
  22642. }, [
  22643. vue.createElementVNode("span", {
  22644. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22645. }, [
  22646. vue.renderSlot(_ctx.$slots, "default")
  22647. ], 2),
  22648. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22649. key: 0,
  22650. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22651. onClick: vue.withModifiers(handleClose, ["stop"])
  22652. }, {
  22653. default: vue.withCtx(() => [
  22654. vue.createVNode(vue.unref(close_default))
  22655. ]),
  22656. _: 1
  22657. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22658. ], 6)
  22659. ]),
  22660. _: 3
  22661. }, 8, ["name"]));
  22662. };
  22663. }
  22664. });
  22665. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "tag.vue"]]);
  22666. const ElTag = withInstall(Tag);
  22667. const cascaderProps = buildProps({
  22668. ...CommonProps,
  22669. size: useSizeProp,
  22670. placeholder: String,
  22671. disabled: Boolean,
  22672. clearable: Boolean,
  22673. filterable: Boolean,
  22674. filterMethod: {
  22675. type: definePropType(Function),
  22676. default: (node, keyword) => node.text.includes(keyword)
  22677. },
  22678. separator: {
  22679. type: String,
  22680. default: " / "
  22681. },
  22682. showAllLevels: {
  22683. type: Boolean,
  22684. default: true
  22685. },
  22686. collapseTags: Boolean,
  22687. maxCollapseTags: {
  22688. type: Number,
  22689. default: 1
  22690. },
  22691. collapseTagsTooltip: {
  22692. type: Boolean,
  22693. default: false
  22694. },
  22695. debounce: {
  22696. type: Number,
  22697. default: 300
  22698. },
  22699. beforeFilter: {
  22700. type: definePropType(Function),
  22701. default: () => true
  22702. },
  22703. placement: {
  22704. type: definePropType(String),
  22705. values: Ee,
  22706. default: "bottom-start"
  22707. },
  22708. fallbackPlacements: {
  22709. type: definePropType(Array),
  22710. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  22711. },
  22712. popperClass: {
  22713. type: String,
  22714. default: ""
  22715. },
  22716. teleported: useTooltipContentProps.teleported,
  22717. tagType: { ...tagProps.type, default: "info" },
  22718. tagEffect: { ...tagProps.effect, default: "light" },
  22719. validateEvent: {
  22720. type: Boolean,
  22721. default: true
  22722. },
  22723. persistent: {
  22724. type: Boolean,
  22725. default: true
  22726. },
  22727. ...useEmptyValuesProps
  22728. });
  22729. const cascaderEmits = {
  22730. [UPDATE_MODEL_EVENT]: (_) => true,
  22731. [CHANGE_EVENT]: (_) => true,
  22732. focus: (evt) => evt instanceof FocusEvent,
  22733. blur: (evt) => evt instanceof FocusEvent,
  22734. clear: () => true,
  22735. visibleChange: (val) => isBoolean(val),
  22736. expandChange: (val) => !!val,
  22737. removeTag: (val) => !!val
  22738. };
  22739. const COMPONENT_NAME$e = "ElCascader";
  22740. const __default__$1f = vue.defineComponent({
  22741. name: COMPONENT_NAME$e
  22742. });
  22743. const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
  22744. ...__default__$1f,
  22745. props: cascaderProps,
  22746. emits: cascaderEmits,
  22747. setup(__props, { expose, emit }) {
  22748. const props = __props;
  22749. const popperOptions = {
  22750. modifiers: [
  22751. {
  22752. name: "arrowPosition",
  22753. enabled: true,
  22754. phase: "main",
  22755. fn: ({ state }) => {
  22756. const { modifiersData, placement } = state;
  22757. if (["right", "left", "bottom", "top"].includes(placement))
  22758. return;
  22759. modifiersData.arrow.x = 35;
  22760. },
  22761. requires: ["arrow"]
  22762. }
  22763. ]
  22764. };
  22765. const attrs = vue.useAttrs();
  22766. let inputInitialHeight = 0;
  22767. let pressDeleteCount = 0;
  22768. const nsCascader = useNamespace("cascader");
  22769. const nsInput = useNamespace("input");
  22770. const { t } = useLocale();
  22771. const { form, formItem } = useFormItem();
  22772. const { valueOnClear } = useEmptyValues(props);
  22773. const { isComposing, handleComposition } = useComposition({
  22774. afterComposition(event) {
  22775. var _a;
  22776. const text = (_a = event.target) == null ? void 0 : _a.value;
  22777. handleInput(text);
  22778. }
  22779. });
  22780. const tooltipRef = vue.ref(null);
  22781. const input = vue.ref(null);
  22782. const tagWrapper = vue.ref(null);
  22783. const cascaderPanelRef = vue.ref(null);
  22784. const suggestionPanel = vue.ref(null);
  22785. const popperVisible = vue.ref(false);
  22786. const inputHover = vue.ref(false);
  22787. const filtering = vue.ref(false);
  22788. const filterFocus = vue.ref(false);
  22789. const inputValue = vue.ref("");
  22790. const searchInputValue = vue.ref("");
  22791. const presentTags = vue.ref([]);
  22792. const allPresentTags = vue.ref([]);
  22793. const suggestions = vue.ref([]);
  22794. const cascaderStyle = vue.computed(() => {
  22795. return attrs.style;
  22796. });
  22797. const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  22798. const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder"));
  22799. const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  22800. const realSize = useFormSize();
  22801. const tagSize = vue.computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  22802. const multiple = vue.computed(() => !!props.props.multiple);
  22803. const readonly = vue.computed(() => !props.filterable || multiple.value);
  22804. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  22805. const checkedNodes = vue.computed(() => {
  22806. var _a;
  22807. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  22808. });
  22809. const clearBtnVisible = vue.computed(() => {
  22810. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  22811. return false;
  22812. return !!checkedNodes.value.length;
  22813. });
  22814. const presentText = vue.computed(() => {
  22815. const { showAllLevels, separator } = props;
  22816. const nodes = checkedNodes.value;
  22817. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  22818. });
  22819. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  22820. const checkedValue = vue.computed({
  22821. get() {
  22822. return cloneDeep(props.modelValue);
  22823. },
  22824. set(val) {
  22825. const value = val != null ? val : valueOnClear.value;
  22826. emit(UPDATE_MODEL_EVENT, value);
  22827. emit(CHANGE_EVENT, value);
  22828. if (props.validateEvent) {
  22829. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22830. }
  22831. }
  22832. });
  22833. const cascaderKls = vue.computed(() => {
  22834. return [
  22835. nsCascader.b(),
  22836. nsCascader.m(realSize.value),
  22837. nsCascader.is("disabled", isDisabled.value),
  22838. attrs.class
  22839. ];
  22840. });
  22841. const cascaderIconKls = vue.computed(() => {
  22842. return [
  22843. nsInput.e("icon"),
  22844. "icon-arrow-down",
  22845. nsCascader.is("reverse", popperVisible.value)
  22846. ];
  22847. });
  22848. const inputClass = vue.computed(() => {
  22849. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  22850. });
  22851. const contentRef = vue.computed(() => {
  22852. var _a, _b;
  22853. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  22854. });
  22855. const togglePopperVisible = (visible) => {
  22856. var _a, _b, _c;
  22857. if (isDisabled.value)
  22858. return;
  22859. visible = visible != null ? visible : !popperVisible.value;
  22860. if (visible !== popperVisible.value) {
  22861. popperVisible.value = visible;
  22862. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  22863. if (visible) {
  22864. updatePopperPosition();
  22865. vue.nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  22866. } else if (props.filterable) {
  22867. syncPresentTextValue();
  22868. }
  22869. emit("visibleChange", visible);
  22870. }
  22871. };
  22872. const updatePopperPosition = () => {
  22873. vue.nextTick(() => {
  22874. var _a;
  22875. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  22876. });
  22877. };
  22878. const hideSuggestionPanel = () => {
  22879. filtering.value = false;
  22880. };
  22881. const genTag = (node) => {
  22882. const { showAllLevels, separator } = props;
  22883. return {
  22884. node,
  22885. key: node.uid,
  22886. text: node.calcText(showAllLevels, separator),
  22887. hitState: false,
  22888. closable: !isDisabled.value && !node.isDisabled,
  22889. isCollapseTag: false
  22890. };
  22891. };
  22892. const deleteTag = (tag) => {
  22893. var _a;
  22894. const node = tag.node;
  22895. node.doCheck(false);
  22896. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  22897. emit("removeTag", node.valueByOption);
  22898. };
  22899. const calculatePresentTags = () => {
  22900. if (!multiple.value)
  22901. return;
  22902. const nodes = checkedNodes.value;
  22903. const tags = [];
  22904. const allTags = [];
  22905. nodes.forEach((node) => allTags.push(genTag(node)));
  22906. allPresentTags.value = allTags;
  22907. if (nodes.length) {
  22908. nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag(node)));
  22909. const rest = nodes.slice(props.maxCollapseTags);
  22910. const restCount = rest.length;
  22911. if (restCount) {
  22912. if (props.collapseTags) {
  22913. tags.push({
  22914. key: -1,
  22915. text: `+ ${restCount}`,
  22916. closable: false,
  22917. isCollapseTag: true
  22918. });
  22919. } else {
  22920. rest.forEach((node) => tags.push(genTag(node)));
  22921. }
  22922. }
  22923. }
  22924. presentTags.value = tags;
  22925. };
  22926. const calculateSuggestions = () => {
  22927. var _a, _b;
  22928. const { filterMethod, showAllLevels, separator } = props;
  22929. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  22930. if (node.isDisabled)
  22931. return false;
  22932. node.calcText(showAllLevels, separator);
  22933. return filterMethod(node, searchKeyword.value);
  22934. });
  22935. if (multiple.value) {
  22936. presentTags.value.forEach((tag) => {
  22937. tag.hitState = false;
  22938. });
  22939. allPresentTags.value.forEach((tag) => {
  22940. tag.hitState = false;
  22941. });
  22942. }
  22943. filtering.value = true;
  22944. suggestions.value = res;
  22945. updatePopperPosition();
  22946. };
  22947. const focusFirstNode = () => {
  22948. var _a;
  22949. let firstNode;
  22950. if (filtering.value && suggestionPanel.value) {
  22951. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  22952. } else {
  22953. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  22954. }
  22955. if (firstNode) {
  22956. firstNode.focus();
  22957. !filtering.value && firstNode.click();
  22958. }
  22959. };
  22960. const updateStyle = () => {
  22961. var _a, _b;
  22962. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  22963. const tagWrapperEl = tagWrapper.value;
  22964. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  22965. if (!isClient || !inputInner)
  22966. return;
  22967. if (suggestionPanelEl) {
  22968. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  22969. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  22970. }
  22971. if (tagWrapperEl) {
  22972. const { offsetHeight } = tagWrapperEl;
  22973. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  22974. inputInner.style.height = height;
  22975. updatePopperPosition();
  22976. }
  22977. };
  22978. const getCheckedNodes = (leafOnly) => {
  22979. var _a;
  22980. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  22981. };
  22982. const handleExpandChange = (value) => {
  22983. updatePopperPosition();
  22984. emit("expandChange", value);
  22985. };
  22986. const handleKeyDown = (e) => {
  22987. if (isComposing.value)
  22988. return;
  22989. switch (e.code) {
  22990. case EVENT_CODE.enter:
  22991. togglePopperVisible();
  22992. break;
  22993. case EVENT_CODE.down:
  22994. togglePopperVisible(true);
  22995. vue.nextTick(focusFirstNode);
  22996. e.preventDefault();
  22997. break;
  22998. case EVENT_CODE.esc:
  22999. if (popperVisible.value === true) {
  23000. e.preventDefault();
  23001. e.stopPropagation();
  23002. togglePopperVisible(false);
  23003. }
  23004. break;
  23005. case EVENT_CODE.tab:
  23006. togglePopperVisible(false);
  23007. break;
  23008. }
  23009. };
  23010. const handleClear = () => {
  23011. var _a;
  23012. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  23013. if (!popperVisible.value && props.filterable) {
  23014. syncPresentTextValue();
  23015. }
  23016. togglePopperVisible(false);
  23017. emit("clear");
  23018. };
  23019. const syncPresentTextValue = () => {
  23020. const { value } = presentText;
  23021. inputValue.value = value;
  23022. searchInputValue.value = value;
  23023. };
  23024. const handleSuggestionClick = (node) => {
  23025. var _a, _b;
  23026. const { checked } = node;
  23027. if (multiple.value) {
  23028. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  23029. } else {
  23030. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  23031. togglePopperVisible(false);
  23032. }
  23033. };
  23034. const handleSuggestionKeyDown = (e) => {
  23035. const target = e.target;
  23036. const { code } = e;
  23037. switch (code) {
  23038. case EVENT_CODE.up:
  23039. case EVENT_CODE.down: {
  23040. const distance = code === EVENT_CODE.up ? -1 : 1;
  23041. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  23042. break;
  23043. }
  23044. case EVENT_CODE.enter:
  23045. target.click();
  23046. break;
  23047. }
  23048. };
  23049. const handleDelete = () => {
  23050. const tags = presentTags.value;
  23051. const lastTag = tags[tags.length - 1];
  23052. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  23053. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  23054. return;
  23055. if (lastTag.hitState) {
  23056. deleteTag(lastTag);
  23057. } else {
  23058. lastTag.hitState = true;
  23059. }
  23060. };
  23061. const handleFocus = (e) => {
  23062. const el = e.target;
  23063. const name = nsCascader.e("search-input");
  23064. if (el.className === name) {
  23065. filterFocus.value = true;
  23066. }
  23067. emit("focus", e);
  23068. };
  23069. const handleBlur = (e) => {
  23070. filterFocus.value = false;
  23071. emit("blur", e);
  23072. };
  23073. const handleFilter = debounce(() => {
  23074. const { value } = searchKeyword;
  23075. if (!value)
  23076. return;
  23077. const passed = props.beforeFilter(value);
  23078. if (isPromise(passed)) {
  23079. passed.then(calculateSuggestions).catch(() => {
  23080. });
  23081. } else if (passed !== false) {
  23082. calculateSuggestions();
  23083. } else {
  23084. hideSuggestionPanel();
  23085. }
  23086. }, props.debounce);
  23087. const handleInput = (val, e) => {
  23088. !popperVisible.value && togglePopperVisible(true);
  23089. if (e == null ? void 0 : e.isComposing)
  23090. return;
  23091. val ? handleFilter() : hideSuggestionPanel();
  23092. };
  23093. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  23094. vue.watch(filtering, updatePopperPosition);
  23095. vue.watch([checkedNodes, isDisabled, () => props.collapseTags], calculatePresentTags);
  23096. vue.watch(presentTags, () => {
  23097. vue.nextTick(() => updateStyle());
  23098. });
  23099. vue.watch(realSize, async () => {
  23100. await vue.nextTick();
  23101. const inputInner = input.value.input;
  23102. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  23103. updateStyle();
  23104. });
  23105. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  23106. vue.onMounted(() => {
  23107. const inputInner = input.value.input;
  23108. const inputInnerHeight = getInputInnerHeight(inputInner);
  23109. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  23110. useResizeObserver(inputInner, updateStyle);
  23111. });
  23112. expose({
  23113. getCheckedNodes,
  23114. cascaderPanelRef,
  23115. togglePopperVisible,
  23116. contentRef
  23117. });
  23118. return (_ctx, _cache) => {
  23119. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23120. ref_key: "tooltipRef",
  23121. ref: tooltipRef,
  23122. visible: popperVisible.value,
  23123. teleported: _ctx.teleported,
  23124. "popper-class": [vue.unref(nsCascader).e("dropdown"), _ctx.popperClass],
  23125. "popper-options": popperOptions,
  23126. "fallback-placements": _ctx.fallbackPlacements,
  23127. "stop-popper-mouse-event": false,
  23128. "gpu-acceleration": false,
  23129. placement: _ctx.placement,
  23130. transition: `${vue.unref(nsCascader).namespace.value}-zoom-in-top`,
  23131. effect: "light",
  23132. pure: "",
  23133. persistent: _ctx.persistent,
  23134. onHide: hideSuggestionPanel
  23135. }, {
  23136. default: vue.withCtx(() => [
  23137. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  23138. class: vue.normalizeClass(vue.unref(cascaderKls)),
  23139. style: vue.normalizeStyle(vue.unref(cascaderStyle)),
  23140. onClick: () => togglePopperVisible(vue.unref(readonly) ? void 0 : true),
  23141. onKeydown: handleKeyDown,
  23142. onMouseenter: ($event) => inputHover.value = true,
  23143. onMouseleave: ($event) => inputHover.value = false
  23144. }, [
  23145. vue.createVNode(vue.unref(ElInput), {
  23146. ref_key: "input",
  23147. ref: input,
  23148. modelValue: inputValue.value,
  23149. "onUpdate:modelValue": ($event) => inputValue.value = $event,
  23150. placeholder: vue.unref(currentPlaceholder),
  23151. readonly: vue.unref(readonly),
  23152. disabled: vue.unref(isDisabled),
  23153. "validate-event": false,
  23154. size: vue.unref(realSize),
  23155. class: vue.normalizeClass(vue.unref(inputClass)),
  23156. tabindex: vue.unref(multiple) && _ctx.filterable && !vue.unref(isDisabled) ? -1 : void 0,
  23157. onCompositionstart: vue.unref(handleComposition),
  23158. onCompositionupdate: vue.unref(handleComposition),
  23159. onCompositionend: vue.unref(handleComposition),
  23160. onFocus: handleFocus,
  23161. onBlur: handleBlur,
  23162. onInput: handleInput
  23163. }, {
  23164. suffix: vue.withCtx(() => [
  23165. vue.unref(clearBtnVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23166. key: "clear",
  23167. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), "icon-circle-close"]),
  23168. onClick: vue.withModifiers(handleClear, ["stop"])
  23169. }, {
  23170. default: vue.withCtx(() => [
  23171. vue.createVNode(vue.unref(circle_close_default))
  23172. ]),
  23173. _: 1
  23174. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23175. key: "arrow-down",
  23176. class: vue.normalizeClass(vue.unref(cascaderIconKls)),
  23177. onClick: vue.withModifiers(($event) => togglePopperVisible(), ["stop"])
  23178. }, {
  23179. default: vue.withCtx(() => [
  23180. vue.createVNode(vue.unref(arrow_down_default))
  23181. ]),
  23182. _: 1
  23183. }, 8, ["class", "onClick"]))
  23184. ]),
  23185. _: 1
  23186. }, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  23187. vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", {
  23188. key: 0,
  23189. ref_key: "tagWrapper",
  23190. ref: tagWrapper,
  23191. class: vue.normalizeClass([
  23192. vue.unref(nsCascader).e("tags"),
  23193. vue.unref(nsCascader).is("validate", Boolean(vue.unref(validateState)))
  23194. ])
  23195. }, [
  23196. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(presentTags.value, (tag) => {
  23197. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23198. key: tag.key,
  23199. type: _ctx.tagType,
  23200. size: vue.unref(tagSize),
  23201. effect: _ctx.tagEffect,
  23202. hit: tag.hitState,
  23203. closable: tag.closable,
  23204. "disable-transitions": "",
  23205. onClose: ($event) => deleteTag(tag)
  23206. }, {
  23207. default: vue.withCtx(() => [
  23208. tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23209. key: 1,
  23210. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  23211. "fallback-placements": ["bottom", "top", "right", "left"],
  23212. placement: "bottom",
  23213. effect: "light"
  23214. }, {
  23215. default: vue.withCtx(() => [
  23216. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  23217. ]),
  23218. content: vue.withCtx(() => [
  23219. vue.createElementVNode("div", {
  23220. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tags"))
  23221. }, [
  23222. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
  23223. return vue.openBlock(), vue.createElementBlock("div", {
  23224. key: idx,
  23225. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tag"))
  23226. }, [
  23227. (vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23228. key: tag2.key,
  23229. class: "in-tooltip",
  23230. type: _ctx.tagType,
  23231. size: vue.unref(tagSize),
  23232. effect: _ctx.tagEffect,
  23233. hit: tag2.hitState,
  23234. closable: tag2.closable,
  23235. "disable-transitions": "",
  23236. onClose: ($event) => deleteTag(tag2)
  23237. }, {
  23238. default: vue.withCtx(() => [
  23239. vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1)
  23240. ]),
  23241. _: 2
  23242. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
  23243. ], 2);
  23244. }), 128))
  23245. ], 2)
  23246. ]),
  23247. _: 2
  23248. }, 1032, ["disabled"]))
  23249. ]),
  23250. _: 2
  23251. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
  23252. }), 128)),
  23253. _ctx.filterable && !vue.unref(isDisabled) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  23254. key: 0,
  23255. "onUpdate:modelValue": ($event) => searchInputValue.value = $event,
  23256. type: "text",
  23257. class: vue.normalizeClass(vue.unref(nsCascader).e("search-input")),
  23258. placeholder: vue.unref(presentText) ? "" : vue.unref(inputPlaceholder),
  23259. onInput: (e) => handleInput(searchInputValue.value, e),
  23260. onClick: vue.withModifiers(($event) => togglePopperVisible(true), ["stop"]),
  23261. onKeydown: vue.withKeys(handleDelete, ["delete"]),
  23262. onCompositionstart: vue.unref(handleComposition),
  23263. onCompositionupdate: vue.unref(handleComposition),
  23264. onCompositionend: vue.unref(handleComposition),
  23265. onFocus: handleFocus,
  23266. onBlur: handleBlur
  23267. }, null, 42, ["onUpdate:modelValue", "placeholder", "onInput", "onClick", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend"])), [
  23268. [vue.vModelText, searchInputValue.value]
  23269. ]) : vue.createCommentVNode("v-if", true)
  23270. ], 2)) : vue.createCommentVNode("v-if", true)
  23271. ], 46, ["onClick", "onMouseenter", "onMouseleave"])), [
  23272. [vue.unref(ClickOutside), () => togglePopperVisible(false), vue.unref(contentRef)]
  23273. ])
  23274. ]),
  23275. content: vue.withCtx(() => [
  23276. vue.withDirectives(vue.createVNode(vue.unref(ElCascaderPanel), {
  23277. ref_key: "cascaderPanelRef",
  23278. ref: cascaderPanelRef,
  23279. modelValue: vue.unref(checkedValue),
  23280. "onUpdate:modelValue": ($event) => vue.isRef(checkedValue) ? checkedValue.value = $event : null,
  23281. options: _ctx.options,
  23282. props: props.props,
  23283. border: false,
  23284. "render-label": _ctx.$slots.default,
  23285. onExpandChange: handleExpandChange,
  23286. onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
  23287. }, null, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "render-label", "onClose"]), [
  23288. [vue.vShow, !filtering.value]
  23289. ]),
  23290. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  23291. key: 0,
  23292. ref_key: "suggestionPanel",
  23293. ref: suggestionPanel,
  23294. tag: "ul",
  23295. class: vue.normalizeClass(vue.unref(nsCascader).e("suggestion-panel")),
  23296. "view-class": vue.unref(nsCascader).e("suggestion-list"),
  23297. onKeydown: handleSuggestionKeyDown
  23298. }, {
  23299. default: vue.withCtx(() => [
  23300. suggestions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(suggestions.value, (item) => {
  23301. return vue.openBlock(), vue.createElementBlock("li", {
  23302. key: item.uid,
  23303. class: vue.normalizeClass([
  23304. vue.unref(nsCascader).e("suggestion-item"),
  23305. vue.unref(nsCascader).is("checked", item.checked)
  23306. ]),
  23307. tabindex: -1,
  23308. onClick: ($event) => handleSuggestionClick(item)
  23309. }, [
  23310. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  23311. item.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  23312. default: vue.withCtx(() => [
  23313. vue.createVNode(vue.unref(check_default))
  23314. ]),
  23315. _: 1
  23316. })) : vue.createCommentVNode("v-if", true)
  23317. ], 10, ["onClick"]);
  23318. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  23319. vue.createElementVNode("li", {
  23320. class: vue.normalizeClass(vue.unref(nsCascader).e("empty-text"))
  23321. }, vue.toDisplayString(vue.unref(t)("el.cascader.noMatch")), 3)
  23322. ])
  23323. ]),
  23324. _: 3
  23325. }, 8, ["class", "view-class"])), [
  23326. [vue.vShow, filtering.value]
  23327. ]) : vue.createCommentVNode("v-if", true)
  23328. ]),
  23329. _: 3
  23330. }, 8, ["visible", "teleported", "popper-class", "fallback-placements", "placement", "transition", "persistent"]);
  23331. };
  23332. }
  23333. });
  23334. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "cascader.vue"]]);
  23335. const ElCascader = withInstall(Cascader);
  23336. const checkTagProps = buildProps({
  23337. checked: Boolean,
  23338. disabled: Boolean,
  23339. type: {
  23340. type: String,
  23341. values: ["primary", "success", "info", "warning", "danger"],
  23342. default: "primary"
  23343. }
  23344. });
  23345. const checkTagEmits = {
  23346. "update:checked": (value) => isBoolean(value),
  23347. [CHANGE_EVENT]: (value) => isBoolean(value)
  23348. };
  23349. const __default__$1e = vue.defineComponent({
  23350. name: "ElCheckTag"
  23351. });
  23352. const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({
  23353. ...__default__$1e,
  23354. props: checkTagProps,
  23355. emits: checkTagEmits,
  23356. setup(__props, { emit }) {
  23357. const props = __props;
  23358. const ns = useNamespace("check-tag");
  23359. const isDisabled = vue.computed(() => props.disabled);
  23360. const containerKls = vue.computed(() => [
  23361. ns.b(),
  23362. ns.is("checked", props.checked),
  23363. ns.is("disabled", isDisabled.value),
  23364. ns.m(props.type || "primary")
  23365. ]);
  23366. const handleChange = () => {
  23367. if (isDisabled.value)
  23368. return;
  23369. const checked = !props.checked;
  23370. emit(CHANGE_EVENT, checked);
  23371. emit("update:checked", checked);
  23372. };
  23373. return (_ctx, _cache) => {
  23374. return vue.openBlock(), vue.createElementBlock("span", {
  23375. class: vue.normalizeClass(vue.unref(containerKls)),
  23376. onClick: handleChange
  23377. }, [
  23378. vue.renderSlot(_ctx.$slots, "default")
  23379. ], 2);
  23380. };
  23381. }
  23382. });
  23383. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "check-tag.vue"]]);
  23384. const ElCheckTag = withInstall(CheckTag);
  23385. const rowContextKey = Symbol("rowContextKey");
  23386. const RowJustify = [
  23387. "start",
  23388. "center",
  23389. "end",
  23390. "space-around",
  23391. "space-between",
  23392. "space-evenly"
  23393. ];
  23394. const RowAlign = ["top", "middle", "bottom"];
  23395. const rowProps = buildProps({
  23396. tag: {
  23397. type: String,
  23398. default: "div"
  23399. },
  23400. gutter: {
  23401. type: Number,
  23402. default: 0
  23403. },
  23404. justify: {
  23405. type: String,
  23406. values: RowJustify,
  23407. default: "start"
  23408. },
  23409. align: {
  23410. type: String,
  23411. values: RowAlign
  23412. }
  23413. });
  23414. const __default__$1d = vue.defineComponent({
  23415. name: "ElRow"
  23416. });
  23417. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  23418. ...__default__$1d,
  23419. props: rowProps,
  23420. setup(__props) {
  23421. const props = __props;
  23422. const ns = useNamespace("row");
  23423. const gutter = vue.computed(() => props.gutter);
  23424. vue.provide(rowContextKey, {
  23425. gutter
  23426. });
  23427. const style = vue.computed(() => {
  23428. const styles = {};
  23429. if (!props.gutter) {
  23430. return styles;
  23431. }
  23432. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  23433. return styles;
  23434. });
  23435. const rowKls = vue.computed(() => [
  23436. ns.b(),
  23437. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  23438. ns.is(`align-${props.align}`, !!props.align)
  23439. ]);
  23440. return (_ctx, _cache) => {
  23441. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23442. class: vue.normalizeClass(vue.unref(rowKls)),
  23443. style: vue.normalizeStyle(vue.unref(style))
  23444. }, {
  23445. default: vue.withCtx(() => [
  23446. vue.renderSlot(_ctx.$slots, "default")
  23447. ]),
  23448. _: 3
  23449. }, 8, ["class", "style"]);
  23450. };
  23451. }
  23452. });
  23453. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "row.vue"]]);
  23454. const ElRow = withInstall(Row$1);
  23455. const colProps = buildProps({
  23456. tag: {
  23457. type: String,
  23458. default: "div"
  23459. },
  23460. span: {
  23461. type: Number,
  23462. default: 24
  23463. },
  23464. offset: {
  23465. type: Number,
  23466. default: 0
  23467. },
  23468. pull: {
  23469. type: Number,
  23470. default: 0
  23471. },
  23472. push: {
  23473. type: Number,
  23474. default: 0
  23475. },
  23476. xs: {
  23477. type: definePropType([Number, Object]),
  23478. default: () => mutable({})
  23479. },
  23480. sm: {
  23481. type: definePropType([Number, Object]),
  23482. default: () => mutable({})
  23483. },
  23484. md: {
  23485. type: definePropType([Number, Object]),
  23486. default: () => mutable({})
  23487. },
  23488. lg: {
  23489. type: definePropType([Number, Object]),
  23490. default: () => mutable({})
  23491. },
  23492. xl: {
  23493. type: definePropType([Number, Object]),
  23494. default: () => mutable({})
  23495. }
  23496. });
  23497. const __default__$1c = vue.defineComponent({
  23498. name: "ElCol"
  23499. });
  23500. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  23501. ...__default__$1c,
  23502. props: colProps,
  23503. setup(__props) {
  23504. const props = __props;
  23505. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  23506. const ns = useNamespace("col");
  23507. const style = vue.computed(() => {
  23508. const styles = {};
  23509. if (gutter.value) {
  23510. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  23511. }
  23512. return styles;
  23513. });
  23514. const colKls = vue.computed(() => {
  23515. const classes = [];
  23516. const pos = ["span", "offset", "pull", "push"];
  23517. pos.forEach((prop) => {
  23518. const size = props[prop];
  23519. if (isNumber(size)) {
  23520. if (prop === "span")
  23521. classes.push(ns.b(`${props[prop]}`));
  23522. else if (size > 0)
  23523. classes.push(ns.b(`${prop}-${props[prop]}`));
  23524. }
  23525. });
  23526. const sizes = ["xs", "sm", "md", "lg", "xl"];
  23527. sizes.forEach((size) => {
  23528. if (isNumber(props[size])) {
  23529. classes.push(ns.b(`${size}-${props[size]}`));
  23530. } else if (isObject$1(props[size])) {
  23531. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  23532. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  23533. });
  23534. }
  23535. });
  23536. if (gutter.value) {
  23537. classes.push(ns.is("guttered"));
  23538. }
  23539. return [ns.b(), classes];
  23540. });
  23541. return (_ctx, _cache) => {
  23542. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23543. class: vue.normalizeClass(vue.unref(colKls)),
  23544. style: vue.normalizeStyle(vue.unref(style))
  23545. }, {
  23546. default: vue.withCtx(() => [
  23547. vue.renderSlot(_ctx.$slots, "default")
  23548. ]),
  23549. _: 3
  23550. }, 8, ["class", "style"]);
  23551. };
  23552. }
  23553. });
  23554. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "col.vue"]]);
  23555. const ElCol = withInstall(Col);
  23556. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  23557. const collapseProps = buildProps({
  23558. accordion: Boolean,
  23559. modelValue: {
  23560. type: definePropType([Array, String, Number]),
  23561. default: () => mutable([])
  23562. }
  23563. });
  23564. const collapseEmits = {
  23565. [UPDATE_MODEL_EVENT]: emitChangeFn,
  23566. [CHANGE_EVENT]: emitChangeFn
  23567. };
  23568. const collapseContextKey = Symbol("collapseContextKey");
  23569. const useCollapse = (props, emit) => {
  23570. const activeNames = vue.ref(castArray$1(props.modelValue));
  23571. const setActiveNames = (_activeNames) => {
  23572. activeNames.value = _activeNames;
  23573. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  23574. emit(UPDATE_MODEL_EVENT, value);
  23575. emit(CHANGE_EVENT, value);
  23576. };
  23577. const handleItemClick = (name) => {
  23578. if (props.accordion) {
  23579. setActiveNames([activeNames.value[0] === name ? "" : name]);
  23580. } else {
  23581. const _activeNames = [...activeNames.value];
  23582. const index = _activeNames.indexOf(name);
  23583. if (index > -1) {
  23584. _activeNames.splice(index, 1);
  23585. } else {
  23586. _activeNames.push(name);
  23587. }
  23588. setActiveNames(_activeNames);
  23589. }
  23590. };
  23591. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  23592. vue.provide(collapseContextKey, {
  23593. activeNames,
  23594. handleItemClick
  23595. });
  23596. return {
  23597. activeNames,
  23598. setActiveNames
  23599. };
  23600. };
  23601. const useCollapseDOM = () => {
  23602. const ns = useNamespace("collapse");
  23603. const rootKls = vue.computed(() => ns.b());
  23604. return {
  23605. rootKls
  23606. };
  23607. };
  23608. const __default__$1b = vue.defineComponent({
  23609. name: "ElCollapse"
  23610. });
  23611. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  23612. ...__default__$1b,
  23613. props: collapseProps,
  23614. emits: collapseEmits,
  23615. setup(__props, { expose, emit }) {
  23616. const props = __props;
  23617. const { activeNames, setActiveNames } = useCollapse(props, emit);
  23618. const { rootKls } = useCollapseDOM();
  23619. expose({
  23620. activeNames,
  23621. setActiveNames
  23622. });
  23623. return (_ctx, _cache) => {
  23624. return vue.openBlock(), vue.createElementBlock("div", {
  23625. class: vue.normalizeClass(vue.unref(rootKls))
  23626. }, [
  23627. vue.renderSlot(_ctx.$slots, "default")
  23628. ], 2);
  23629. };
  23630. }
  23631. });
  23632. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "collapse.vue"]]);
  23633. const __default__$1a = vue.defineComponent({
  23634. name: "ElCollapseTransition"
  23635. });
  23636. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  23637. ...__default__$1a,
  23638. setup(__props) {
  23639. const ns = useNamespace("collapse-transition");
  23640. const reset = (el) => {
  23641. el.style.maxHeight = "";
  23642. el.style.overflow = el.dataset.oldOverflow;
  23643. el.style.paddingTop = el.dataset.oldPaddingTop;
  23644. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23645. };
  23646. const on = {
  23647. beforeEnter(el) {
  23648. if (!el.dataset)
  23649. el.dataset = {};
  23650. el.dataset.oldPaddingTop = el.style.paddingTop;
  23651. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23652. if (el.style.height)
  23653. el.dataset.elExistsHeight = el.style.height;
  23654. el.style.maxHeight = 0;
  23655. el.style.paddingTop = 0;
  23656. el.style.paddingBottom = 0;
  23657. },
  23658. enter(el) {
  23659. requestAnimationFrame(() => {
  23660. el.dataset.oldOverflow = el.style.overflow;
  23661. if (el.dataset.elExistsHeight) {
  23662. el.style.maxHeight = el.dataset.elExistsHeight;
  23663. } else if (el.scrollHeight !== 0) {
  23664. el.style.maxHeight = `${el.scrollHeight}px`;
  23665. } else {
  23666. el.style.maxHeight = 0;
  23667. }
  23668. el.style.paddingTop = el.dataset.oldPaddingTop;
  23669. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23670. el.style.overflow = "hidden";
  23671. });
  23672. },
  23673. afterEnter(el) {
  23674. el.style.maxHeight = "";
  23675. el.style.overflow = el.dataset.oldOverflow;
  23676. },
  23677. enterCancelled(el) {
  23678. reset(el);
  23679. },
  23680. beforeLeave(el) {
  23681. if (!el.dataset)
  23682. el.dataset = {};
  23683. el.dataset.oldPaddingTop = el.style.paddingTop;
  23684. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23685. el.dataset.oldOverflow = el.style.overflow;
  23686. el.style.maxHeight = `${el.scrollHeight}px`;
  23687. el.style.overflow = "hidden";
  23688. },
  23689. leave(el) {
  23690. if (el.scrollHeight !== 0) {
  23691. el.style.maxHeight = 0;
  23692. el.style.paddingTop = 0;
  23693. el.style.paddingBottom = 0;
  23694. }
  23695. },
  23696. afterLeave(el) {
  23697. reset(el);
  23698. },
  23699. leaveCancelled(el) {
  23700. reset(el);
  23701. }
  23702. };
  23703. return (_ctx, _cache) => {
  23704. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  23705. name: vue.unref(ns).b()
  23706. }, vue.toHandlers(on)), {
  23707. default: vue.withCtx(() => [
  23708. vue.renderSlot(_ctx.$slots, "default")
  23709. ]),
  23710. _: 3
  23711. }, 16, ["name"]);
  23712. };
  23713. }
  23714. });
  23715. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "collapse-transition.vue"]]);
  23716. const ElCollapseTransition = withInstall(CollapseTransition);
  23717. const collapseItemProps = buildProps({
  23718. title: {
  23719. type: String,
  23720. default: ""
  23721. },
  23722. name: {
  23723. type: definePropType([String, Number]),
  23724. default: void 0
  23725. },
  23726. disabled: Boolean
  23727. });
  23728. const useCollapseItem = (props) => {
  23729. const collapse = vue.inject(collapseContextKey);
  23730. const { namespace } = useNamespace("collapse");
  23731. const focusing = vue.ref(false);
  23732. const isClick = vue.ref(false);
  23733. const idInjection = useIdInjection();
  23734. const id = vue.computed(() => idInjection.current++);
  23735. const name = vue.computed(() => {
  23736. var _a;
  23737. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${vue.unref(id)}`;
  23738. });
  23739. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(vue.unref(name)));
  23740. const handleFocus = () => {
  23741. setTimeout(() => {
  23742. if (!isClick.value) {
  23743. focusing.value = true;
  23744. } else {
  23745. isClick.value = false;
  23746. }
  23747. }, 50);
  23748. };
  23749. const handleHeaderClick = () => {
  23750. if (props.disabled)
  23751. return;
  23752. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  23753. focusing.value = false;
  23754. isClick.value = true;
  23755. };
  23756. const handleEnterClick = () => {
  23757. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  23758. };
  23759. return {
  23760. focusing,
  23761. id,
  23762. isActive,
  23763. handleFocus,
  23764. handleHeaderClick,
  23765. handleEnterClick
  23766. };
  23767. };
  23768. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  23769. const ns = useNamespace("collapse");
  23770. const rootKls = vue.computed(() => [
  23771. ns.b("item"),
  23772. ns.is("active", vue.unref(isActive)),
  23773. ns.is("disabled", props.disabled)
  23774. ]);
  23775. const headKls = vue.computed(() => [
  23776. ns.be("item", "header"),
  23777. ns.is("active", vue.unref(isActive)),
  23778. { focusing: vue.unref(focusing) && !props.disabled }
  23779. ]);
  23780. const arrowKls = vue.computed(() => [
  23781. ns.be("item", "arrow"),
  23782. ns.is("active", vue.unref(isActive))
  23783. ]);
  23784. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  23785. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  23786. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  23787. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  23788. return {
  23789. arrowKls,
  23790. headKls,
  23791. rootKls,
  23792. itemWrapperKls,
  23793. itemContentKls,
  23794. scopedContentId,
  23795. scopedHeadId
  23796. };
  23797. };
  23798. const __default__$19 = vue.defineComponent({
  23799. name: "ElCollapseItem"
  23800. });
  23801. const _sfc_main$1H = /* @__PURE__ */ vue.defineComponent({
  23802. ...__default__$19,
  23803. props: collapseItemProps,
  23804. setup(__props, { expose }) {
  23805. const props = __props;
  23806. const {
  23807. focusing,
  23808. id,
  23809. isActive,
  23810. handleFocus,
  23811. handleHeaderClick,
  23812. handleEnterClick
  23813. } = useCollapseItem(props);
  23814. const {
  23815. arrowKls,
  23816. headKls,
  23817. rootKls,
  23818. itemWrapperKls,
  23819. itemContentKls,
  23820. scopedContentId,
  23821. scopedHeadId
  23822. } = useCollapseItemDOM(props, { focusing, isActive, id });
  23823. expose({
  23824. isActive
  23825. });
  23826. return (_ctx, _cache) => {
  23827. return vue.openBlock(), vue.createElementBlock("div", {
  23828. class: vue.normalizeClass(vue.unref(rootKls))
  23829. }, [
  23830. vue.createElementVNode("button", {
  23831. id: vue.unref(scopedHeadId),
  23832. class: vue.normalizeClass(vue.unref(headKls)),
  23833. "aria-expanded": vue.unref(isActive),
  23834. "aria-controls": vue.unref(scopedContentId),
  23835. "aria-describedby": vue.unref(scopedContentId),
  23836. tabindex: _ctx.disabled ? -1 : 0,
  23837. type: "button",
  23838. onClick: vue.unref(handleHeaderClick),
  23839. onKeydown: vue.withKeys(vue.withModifiers(vue.unref(handleEnterClick), ["stop", "prevent"]), ["space", "enter"]),
  23840. onFocus: vue.unref(handleFocus),
  23841. onBlur: ($event) => focusing.value = false
  23842. }, [
  23843. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  23844. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  23845. ]),
  23846. vue.createVNode(vue.unref(ElIcon), {
  23847. class: vue.normalizeClass(vue.unref(arrowKls))
  23848. }, {
  23849. default: vue.withCtx(() => [
  23850. vue.createVNode(vue.unref(arrow_right_default))
  23851. ]),
  23852. _: 1
  23853. }, 8, ["class"])
  23854. ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
  23855. vue.createVNode(vue.unref(ElCollapseTransition), null, {
  23856. default: vue.withCtx(() => [
  23857. vue.withDirectives(vue.createElementVNode("div", {
  23858. id: vue.unref(scopedContentId),
  23859. role: "region",
  23860. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  23861. "aria-hidden": !vue.unref(isActive),
  23862. "aria-labelledby": vue.unref(scopedHeadId)
  23863. }, [
  23864. vue.createElementVNode("div", {
  23865. class: vue.normalizeClass(vue.unref(itemContentKls))
  23866. }, [
  23867. vue.renderSlot(_ctx.$slots, "default")
  23868. ], 2)
  23869. ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
  23870. [vue.vShow, vue.unref(isActive)]
  23871. ])
  23872. ]),
  23873. _: 3
  23874. })
  23875. ], 2);
  23876. };
  23877. }
  23878. });
  23879. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "collapse-item.vue"]]);
  23880. const ElCollapse = withInstall(Collapse, {
  23881. CollapseItem
  23882. });
  23883. const ElCollapseItem = withNoopInstall(CollapseItem);
  23884. const alphaSliderProps = buildProps({
  23885. color: {
  23886. type: definePropType(Object),
  23887. required: true
  23888. },
  23889. vertical: {
  23890. type: Boolean,
  23891. default: false
  23892. }
  23893. });
  23894. let isDragging = false;
  23895. function draggable(element, options) {
  23896. if (!isClient)
  23897. return;
  23898. const moveFn = function(event) {
  23899. var _a;
  23900. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  23901. };
  23902. const upFn = function(event) {
  23903. var _a;
  23904. document.removeEventListener("mousemove", moveFn);
  23905. document.removeEventListener("mouseup", upFn);
  23906. document.removeEventListener("touchmove", moveFn);
  23907. document.removeEventListener("touchend", upFn);
  23908. document.onselectstart = null;
  23909. document.ondragstart = null;
  23910. isDragging = false;
  23911. (_a = options.end) == null ? void 0 : _a.call(options, event);
  23912. };
  23913. const downFn = function(event) {
  23914. var _a;
  23915. if (isDragging)
  23916. return;
  23917. event.preventDefault();
  23918. document.onselectstart = () => false;
  23919. document.ondragstart = () => false;
  23920. document.addEventListener("mousemove", moveFn);
  23921. document.addEventListener("mouseup", upFn);
  23922. document.addEventListener("touchmove", moveFn);
  23923. document.addEventListener("touchend", upFn);
  23924. isDragging = true;
  23925. (_a = options.start) == null ? void 0 : _a.call(options, event);
  23926. };
  23927. element.addEventListener("mousedown", downFn);
  23928. element.addEventListener("touchstart", downFn, { passive: false });
  23929. }
  23930. const useAlphaSlider = (props) => {
  23931. const instance = vue.getCurrentInstance();
  23932. const { t } = useLocale();
  23933. const thumb = vue.shallowRef();
  23934. const bar = vue.shallowRef();
  23935. const alpha = vue.computed(() => props.color.get("alpha"));
  23936. const alphaLabel = vue.computed(() => t("el.colorpicker.alphaLabel"));
  23937. function handleClick(event) {
  23938. var _a;
  23939. const target = event.target;
  23940. if (target !== thumb.value) {
  23941. handleDrag(event);
  23942. }
  23943. (_a = thumb.value) == null ? void 0 : _a.focus();
  23944. }
  23945. function handleDrag(event) {
  23946. if (!bar.value || !thumb.value)
  23947. return;
  23948. const el = instance.vnode.el;
  23949. const rect = el.getBoundingClientRect();
  23950. const { clientX, clientY } = getClientXY(event);
  23951. if (!props.vertical) {
  23952. let left = clientX - rect.left;
  23953. left = Math.max(thumb.value.offsetWidth / 2, left);
  23954. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  23955. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  23956. } else {
  23957. let top = clientY - rect.top;
  23958. top = Math.max(thumb.value.offsetHeight / 2, top);
  23959. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  23960. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  23961. }
  23962. }
  23963. function handleKeydown(event) {
  23964. const { code, shiftKey } = event;
  23965. const step = shiftKey ? 10 : 1;
  23966. switch (code) {
  23967. case EVENT_CODE.left:
  23968. case EVENT_CODE.down:
  23969. event.preventDefault();
  23970. event.stopPropagation();
  23971. incrementPosition(-step);
  23972. break;
  23973. case EVENT_CODE.right:
  23974. case EVENT_CODE.up:
  23975. event.preventDefault();
  23976. event.stopPropagation();
  23977. incrementPosition(step);
  23978. break;
  23979. }
  23980. }
  23981. function incrementPosition(step) {
  23982. let next = alpha.value + step;
  23983. next = next < 0 ? 0 : next > 100 ? 100 : next;
  23984. props.color.set("alpha", next);
  23985. }
  23986. return {
  23987. thumb,
  23988. bar,
  23989. alpha,
  23990. alphaLabel,
  23991. handleDrag,
  23992. handleClick,
  23993. handleKeydown
  23994. };
  23995. };
  23996. const useAlphaSliderDOM = (props, {
  23997. bar,
  23998. thumb,
  23999. handleDrag
  24000. }) => {
  24001. const instance = vue.getCurrentInstance();
  24002. const ns = useNamespace("color-alpha-slider");
  24003. const thumbLeft = vue.ref(0);
  24004. const thumbTop = vue.ref(0);
  24005. const background = vue.ref();
  24006. function getThumbLeft() {
  24007. if (!thumb.value)
  24008. return 0;
  24009. if (props.vertical)
  24010. return 0;
  24011. const el = instance.vnode.el;
  24012. const alpha = props.color.get("alpha");
  24013. if (!el)
  24014. return 0;
  24015. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  24016. }
  24017. function getThumbTop() {
  24018. if (!thumb.value)
  24019. return 0;
  24020. const el = instance.vnode.el;
  24021. if (!props.vertical)
  24022. return 0;
  24023. const alpha = props.color.get("alpha");
  24024. if (!el)
  24025. return 0;
  24026. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  24027. }
  24028. function getBackground() {
  24029. if (props.color && props.color.value) {
  24030. const { r, g, b } = props.color.toRgb();
  24031. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  24032. }
  24033. return "";
  24034. }
  24035. function update() {
  24036. thumbLeft.value = getThumbLeft();
  24037. thumbTop.value = getThumbTop();
  24038. background.value = getBackground();
  24039. }
  24040. vue.onMounted(() => {
  24041. if (!bar.value || !thumb.value)
  24042. return;
  24043. const dragConfig = {
  24044. drag: (event) => {
  24045. handleDrag(event);
  24046. },
  24047. end: (event) => {
  24048. handleDrag(event);
  24049. }
  24050. };
  24051. draggable(bar.value, dragConfig);
  24052. draggable(thumb.value, dragConfig);
  24053. update();
  24054. });
  24055. vue.watch(() => props.color.get("alpha"), () => update());
  24056. vue.watch(() => props.color.value, () => update());
  24057. const rootKls = vue.computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  24058. const barKls = vue.computed(() => ns.e("bar"));
  24059. const thumbKls = vue.computed(() => ns.e("thumb"));
  24060. const barStyle = vue.computed(() => ({ background: background.value }));
  24061. const thumbStyle = vue.computed(() => ({
  24062. left: addUnit(thumbLeft.value),
  24063. top: addUnit(thumbTop.value)
  24064. }));
  24065. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  24066. };
  24067. const COMPONENT_NAME$d = "ElColorAlphaSlider";
  24068. const __default__$18 = vue.defineComponent({
  24069. name: COMPONENT_NAME$d
  24070. });
  24071. const _sfc_main$1G = /* @__PURE__ */ vue.defineComponent({
  24072. ...__default__$18,
  24073. props: alphaSliderProps,
  24074. setup(__props, { expose }) {
  24075. const props = __props;
  24076. const {
  24077. alpha,
  24078. alphaLabel,
  24079. bar,
  24080. thumb,
  24081. handleDrag,
  24082. handleClick,
  24083. handleKeydown
  24084. } = useAlphaSlider(props);
  24085. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  24086. bar,
  24087. thumb,
  24088. handleDrag
  24089. });
  24090. expose({
  24091. update,
  24092. bar,
  24093. thumb
  24094. });
  24095. return (_ctx, _cache) => {
  24096. return vue.openBlock(), vue.createElementBlock("div", {
  24097. class: vue.normalizeClass(vue.unref(rootKls))
  24098. }, [
  24099. vue.createElementVNode("div", {
  24100. ref_key: "bar",
  24101. ref: bar,
  24102. class: vue.normalizeClass(vue.unref(barKls)),
  24103. style: vue.normalizeStyle(vue.unref(barStyle)),
  24104. onClick: vue.unref(handleClick)
  24105. }, null, 14, ["onClick"]),
  24106. vue.createElementVNode("div", {
  24107. ref_key: "thumb",
  24108. ref: thumb,
  24109. class: vue.normalizeClass(vue.unref(thumbKls)),
  24110. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  24111. "aria-label": vue.unref(alphaLabel),
  24112. "aria-valuenow": vue.unref(alpha),
  24113. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  24114. "aria-valuemin": "0",
  24115. "aria-valuemax": "100",
  24116. role: "slider",
  24117. tabindex: "0",
  24118. onKeydown: vue.unref(handleKeydown)
  24119. }, null, 46, ["aria-label", "aria-valuenow", "aria-orientation", "onKeydown"])
  24120. ], 2);
  24121. };
  24122. }
  24123. });
  24124. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["__file", "alpha-slider.vue"]]);
  24125. const _sfc_main$1F = vue.defineComponent({
  24126. name: "ElColorHueSlider",
  24127. props: {
  24128. color: {
  24129. type: Object,
  24130. required: true
  24131. },
  24132. vertical: Boolean
  24133. },
  24134. setup(props) {
  24135. const ns = useNamespace("color-hue-slider");
  24136. const instance = vue.getCurrentInstance();
  24137. const thumb = vue.ref();
  24138. const bar = vue.ref();
  24139. const thumbLeft = vue.ref(0);
  24140. const thumbTop = vue.ref(0);
  24141. const hueValue = vue.computed(() => {
  24142. return props.color.get("hue");
  24143. });
  24144. vue.watch(() => hueValue.value, () => {
  24145. update();
  24146. });
  24147. function handleClick(event) {
  24148. const target = event.target;
  24149. if (target !== thumb.value) {
  24150. handleDrag(event);
  24151. }
  24152. }
  24153. function handleDrag(event) {
  24154. if (!bar.value || !thumb.value)
  24155. return;
  24156. const el = instance.vnode.el;
  24157. const rect = el.getBoundingClientRect();
  24158. const { clientX, clientY } = getClientXY(event);
  24159. let hue;
  24160. if (!props.vertical) {
  24161. let left = clientX - rect.left;
  24162. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24163. left = Math.max(thumb.value.offsetWidth / 2, left);
  24164. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  24165. } else {
  24166. let top = clientY - rect.top;
  24167. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24168. top = Math.max(thumb.value.offsetHeight / 2, top);
  24169. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  24170. }
  24171. props.color.set("hue", hue);
  24172. }
  24173. function getThumbLeft() {
  24174. if (!thumb.value)
  24175. return 0;
  24176. const el = instance.vnode.el;
  24177. if (props.vertical)
  24178. return 0;
  24179. const hue = props.color.get("hue");
  24180. if (!el)
  24181. return 0;
  24182. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  24183. }
  24184. function getThumbTop() {
  24185. if (!thumb.value)
  24186. return 0;
  24187. const el = instance.vnode.el;
  24188. if (!props.vertical)
  24189. return 0;
  24190. const hue = props.color.get("hue");
  24191. if (!el)
  24192. return 0;
  24193. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  24194. }
  24195. function update() {
  24196. thumbLeft.value = getThumbLeft();
  24197. thumbTop.value = getThumbTop();
  24198. }
  24199. vue.onMounted(() => {
  24200. if (!bar.value || !thumb.value)
  24201. return;
  24202. const dragConfig = {
  24203. drag: (event) => {
  24204. handleDrag(event);
  24205. },
  24206. end: (event) => {
  24207. handleDrag(event);
  24208. }
  24209. };
  24210. draggable(bar.value, dragConfig);
  24211. draggable(thumb.value, dragConfig);
  24212. update();
  24213. });
  24214. return {
  24215. bar,
  24216. thumb,
  24217. thumbLeft,
  24218. thumbTop,
  24219. hueValue,
  24220. handleClick,
  24221. update,
  24222. ns
  24223. };
  24224. }
  24225. });
  24226. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  24227. return vue.openBlock(), vue.createElementBlock("div", {
  24228. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  24229. }, [
  24230. vue.createElementVNode("div", {
  24231. ref: "bar",
  24232. class: vue.normalizeClass(_ctx.ns.e("bar")),
  24233. onClick: _ctx.handleClick
  24234. }, null, 10, ["onClick"]),
  24235. vue.createElementVNode("div", {
  24236. ref: "thumb",
  24237. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  24238. style: vue.normalizeStyle({
  24239. left: _ctx.thumbLeft + "px",
  24240. top: _ctx.thumbTop + "px"
  24241. })
  24242. }, null, 6)
  24243. ], 2);
  24244. }
  24245. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$q], ["__file", "hue-slider.vue"]]);
  24246. const colorPickerProps = buildProps({
  24247. modelValue: String,
  24248. id: String,
  24249. showAlpha: Boolean,
  24250. colorFormat: String,
  24251. disabled: Boolean,
  24252. size: useSizeProp,
  24253. popperClass: {
  24254. type: String,
  24255. default: ""
  24256. },
  24257. tabindex: {
  24258. type: [String, Number],
  24259. default: 0
  24260. },
  24261. teleported: useTooltipContentProps.teleported,
  24262. predefine: {
  24263. type: definePropType(Array)
  24264. },
  24265. validateEvent: {
  24266. type: Boolean,
  24267. default: true
  24268. },
  24269. ...useAriaProps(["ariaLabel"])
  24270. });
  24271. const colorPickerEmits = {
  24272. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  24273. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  24274. activeChange: (val) => isString$1(val) || isNil(val),
  24275. focus: (evt) => evt instanceof FocusEvent,
  24276. blur: (evt) => evt instanceof FocusEvent
  24277. };
  24278. const colorPickerContextKey = Symbol("colorPickerContextKey");
  24279. const hsv2hsl = function(hue, sat, val) {
  24280. return [
  24281. hue,
  24282. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  24283. hue / 2
  24284. ];
  24285. };
  24286. const isOnePointZero = function(n) {
  24287. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  24288. };
  24289. const isPercentage = function(n) {
  24290. return typeof n === "string" && n.includes("%");
  24291. };
  24292. const bound01 = function(value, max) {
  24293. if (isOnePointZero(value))
  24294. value = "100%";
  24295. const processPercent = isPercentage(value);
  24296. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  24297. if (processPercent) {
  24298. value = Number.parseInt(`${value * max}`, 10) / 100;
  24299. }
  24300. if (Math.abs(value - max) < 1e-6) {
  24301. return 1;
  24302. }
  24303. return value % max / Number.parseFloat(max);
  24304. };
  24305. const INT_HEX_MAP = {
  24306. 10: "A",
  24307. 11: "B",
  24308. 12: "C",
  24309. 13: "D",
  24310. 14: "E",
  24311. 15: "F"
  24312. };
  24313. const hexOne = (value) => {
  24314. value = Math.min(Math.round(value), 255);
  24315. const high = Math.floor(value / 16);
  24316. const low = value % 16;
  24317. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  24318. };
  24319. const toHex = function({ r, g, b }) {
  24320. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  24321. return "";
  24322. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  24323. };
  24324. const HEX_INT_MAP = {
  24325. A: 10,
  24326. B: 11,
  24327. C: 12,
  24328. D: 13,
  24329. E: 14,
  24330. F: 15
  24331. };
  24332. const parseHexChannel = function(hex) {
  24333. if (hex.length === 2) {
  24334. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  24335. }
  24336. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  24337. };
  24338. const hsl2hsv = function(hue, sat, light) {
  24339. sat = sat / 100;
  24340. light = light / 100;
  24341. let smin = sat;
  24342. const lmin = Math.max(light, 0.01);
  24343. light *= 2;
  24344. sat *= light <= 1 ? light : 2 - light;
  24345. smin *= lmin <= 1 ? lmin : 2 - lmin;
  24346. const v = (light + sat) / 2;
  24347. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  24348. return {
  24349. h: hue,
  24350. s: sv * 100,
  24351. v: v * 100
  24352. };
  24353. };
  24354. const rgb2hsv = (r, g, b) => {
  24355. r = bound01(r, 255);
  24356. g = bound01(g, 255);
  24357. b = bound01(b, 255);
  24358. const max = Math.max(r, g, b);
  24359. const min = Math.min(r, g, b);
  24360. let h;
  24361. const v = max;
  24362. const d = max - min;
  24363. const s = max === 0 ? 0 : d / max;
  24364. if (max === min) {
  24365. h = 0;
  24366. } else {
  24367. switch (max) {
  24368. case r: {
  24369. h = (g - b) / d + (g < b ? 6 : 0);
  24370. break;
  24371. }
  24372. case g: {
  24373. h = (b - r) / d + 2;
  24374. break;
  24375. }
  24376. case b: {
  24377. h = (r - g) / d + 4;
  24378. break;
  24379. }
  24380. }
  24381. h /= 6;
  24382. }
  24383. return { h: h * 360, s: s * 100, v: v * 100 };
  24384. };
  24385. const hsv2rgb = function(h, s, v) {
  24386. h = bound01(h, 360) * 6;
  24387. s = bound01(s, 100);
  24388. v = bound01(v, 100);
  24389. const i = Math.floor(h);
  24390. const f = h - i;
  24391. const p = v * (1 - s);
  24392. const q = v * (1 - f * s);
  24393. const t = v * (1 - (1 - f) * s);
  24394. const mod = i % 6;
  24395. const r = [v, q, p, p, t, v][mod];
  24396. const g = [t, v, v, q, p, p][mod];
  24397. const b = [p, p, t, v, v, q][mod];
  24398. return {
  24399. r: Math.round(r * 255),
  24400. g: Math.round(g * 255),
  24401. b: Math.round(b * 255)
  24402. };
  24403. };
  24404. class Color {
  24405. constructor(options = {}) {
  24406. this._hue = 0;
  24407. this._saturation = 100;
  24408. this._value = 100;
  24409. this._alpha = 100;
  24410. this.enableAlpha = false;
  24411. this.format = "hex";
  24412. this.value = "";
  24413. for (const option in options) {
  24414. if (hasOwn(options, option)) {
  24415. this[option] = options[option];
  24416. }
  24417. }
  24418. if (options.value) {
  24419. this.fromString(options.value);
  24420. } else {
  24421. this.doOnChange();
  24422. }
  24423. }
  24424. set(prop, value) {
  24425. if (arguments.length === 1 && typeof prop === "object") {
  24426. for (const p in prop) {
  24427. if (hasOwn(prop, p)) {
  24428. this.set(p, prop[p]);
  24429. }
  24430. }
  24431. return;
  24432. }
  24433. this[`_${prop}`] = value;
  24434. this.doOnChange();
  24435. }
  24436. get(prop) {
  24437. if (prop === "alpha") {
  24438. return Math.floor(this[`_${prop}`]);
  24439. }
  24440. return this[`_${prop}`];
  24441. }
  24442. toRgb() {
  24443. return hsv2rgb(this._hue, this._saturation, this._value);
  24444. }
  24445. fromString(value) {
  24446. if (!value) {
  24447. this._hue = 0;
  24448. this._saturation = 100;
  24449. this._value = 100;
  24450. this.doOnChange();
  24451. return;
  24452. }
  24453. const fromHSV = (h, s, v) => {
  24454. this._hue = Math.max(0, Math.min(360, h));
  24455. this._saturation = Math.max(0, Math.min(100, s));
  24456. this._value = Math.max(0, Math.min(100, v));
  24457. this.doOnChange();
  24458. };
  24459. if (value.includes("hsl")) {
  24460. 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));
  24461. if (parts.length === 4) {
  24462. this._alpha = Number.parseFloat(parts[3]) * 100;
  24463. } else if (parts.length === 3) {
  24464. this._alpha = 100;
  24465. }
  24466. if (parts.length >= 3) {
  24467. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  24468. fromHSV(h, s, v);
  24469. }
  24470. } else if (value.includes("hsv")) {
  24471. 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));
  24472. if (parts.length === 4) {
  24473. this._alpha = Number.parseFloat(parts[3]) * 100;
  24474. } else if (parts.length === 3) {
  24475. this._alpha = 100;
  24476. }
  24477. if (parts.length >= 3) {
  24478. fromHSV(parts[0], parts[1], parts[2]);
  24479. }
  24480. } else if (value.includes("rgb")) {
  24481. 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));
  24482. if (parts.length === 4) {
  24483. this._alpha = Number.parseFloat(parts[3]) * 100;
  24484. } else if (parts.length === 3) {
  24485. this._alpha = 100;
  24486. }
  24487. if (parts.length >= 3) {
  24488. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  24489. fromHSV(h, s, v);
  24490. }
  24491. } else if (value.includes("#")) {
  24492. const hex = value.replace("#", "").trim();
  24493. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  24494. return;
  24495. let r, g, b;
  24496. if (hex.length === 3) {
  24497. r = parseHexChannel(hex[0] + hex[0]);
  24498. g = parseHexChannel(hex[1] + hex[1]);
  24499. b = parseHexChannel(hex[2] + hex[2]);
  24500. } else if (hex.length === 6 || hex.length === 8) {
  24501. r = parseHexChannel(hex.slice(0, 2));
  24502. g = parseHexChannel(hex.slice(2, 4));
  24503. b = parseHexChannel(hex.slice(4, 6));
  24504. }
  24505. if (hex.length === 8) {
  24506. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  24507. } else if (hex.length === 3 || hex.length === 6) {
  24508. this._alpha = 100;
  24509. }
  24510. const { h, s, v } = rgb2hsv(r, g, b);
  24511. fromHSV(h, s, v);
  24512. }
  24513. }
  24514. compare(color) {
  24515. 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;
  24516. }
  24517. doOnChange() {
  24518. const { _hue, _saturation, _value, _alpha, format } = this;
  24519. if (this.enableAlpha) {
  24520. switch (format) {
  24521. case "hsl": {
  24522. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24523. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  24524. break;
  24525. }
  24526. case "hsv": {
  24527. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  24528. break;
  24529. }
  24530. case "hex": {
  24531. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  24532. break;
  24533. }
  24534. default: {
  24535. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24536. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  24537. }
  24538. }
  24539. } else {
  24540. switch (format) {
  24541. case "hsl": {
  24542. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24543. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  24544. break;
  24545. }
  24546. case "hsv": {
  24547. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  24548. break;
  24549. }
  24550. case "rgb": {
  24551. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24552. this.value = `rgb(${r}, ${g}, ${b})`;
  24553. break;
  24554. }
  24555. default: {
  24556. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  24557. }
  24558. }
  24559. }
  24560. }
  24561. }
  24562. const _sfc_main$1E = vue.defineComponent({
  24563. props: {
  24564. colors: {
  24565. type: Array,
  24566. required: true
  24567. },
  24568. color: {
  24569. type: Object,
  24570. required: true
  24571. },
  24572. enableAlpha: {
  24573. type: Boolean,
  24574. required: true
  24575. }
  24576. },
  24577. setup(props) {
  24578. const ns = useNamespace("color-predefine");
  24579. const { currentColor } = vue.inject(colorPickerContextKey);
  24580. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  24581. vue.watch(() => currentColor.value, (val) => {
  24582. const color = new Color();
  24583. color.fromString(val);
  24584. rgbaColors.value.forEach((item) => {
  24585. item.selected = color.compare(item);
  24586. });
  24587. });
  24588. vue.watchEffect(() => {
  24589. rgbaColors.value = parseColors(props.colors, props.color);
  24590. });
  24591. function handleSelect(index) {
  24592. props.color.fromString(props.colors[index]);
  24593. }
  24594. function parseColors(colors, color) {
  24595. return colors.map((value) => {
  24596. const c = new Color();
  24597. c.enableAlpha = props.enableAlpha;
  24598. c.format = "rgba";
  24599. c.fromString(value);
  24600. c.selected = c.value === color.value;
  24601. return c;
  24602. });
  24603. }
  24604. return {
  24605. rgbaColors,
  24606. handleSelect,
  24607. ns
  24608. };
  24609. }
  24610. });
  24611. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  24612. return vue.openBlock(), vue.createElementBlock("div", {
  24613. class: vue.normalizeClass(_ctx.ns.b())
  24614. }, [
  24615. vue.createElementVNode("div", {
  24616. class: vue.normalizeClass(_ctx.ns.e("colors"))
  24617. }, [
  24618. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => {
  24619. return vue.openBlock(), vue.createElementBlock("div", {
  24620. key: _ctx.colors[index],
  24621. class: vue.normalizeClass([
  24622. _ctx.ns.e("color-selector"),
  24623. _ctx.ns.is("alpha", item._alpha < 100),
  24624. { selected: item.selected }
  24625. ]),
  24626. onClick: ($event) => _ctx.handleSelect(index)
  24627. }, [
  24628. vue.createElementVNode("div", {
  24629. style: vue.normalizeStyle({ backgroundColor: item.value })
  24630. }, null, 4)
  24631. ], 10, ["onClick"]);
  24632. }), 128))
  24633. ], 2)
  24634. ], 2);
  24635. }
  24636. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["render", _sfc_render$p], ["__file", "predefine.vue"]]);
  24637. const _sfc_main$1D = vue.defineComponent({
  24638. name: "ElSlPanel",
  24639. props: {
  24640. color: {
  24641. type: Object,
  24642. required: true
  24643. }
  24644. },
  24645. setup(props) {
  24646. const ns = useNamespace("color-svpanel");
  24647. const instance = vue.getCurrentInstance();
  24648. const cursorTop = vue.ref(0);
  24649. const cursorLeft = vue.ref(0);
  24650. const background = vue.ref("hsl(0, 100%, 50%)");
  24651. const colorValue = vue.computed(() => {
  24652. const hue = props.color.get("hue");
  24653. const value = props.color.get("value");
  24654. return { hue, value };
  24655. });
  24656. function update() {
  24657. const saturation = props.color.get("saturation");
  24658. const value = props.color.get("value");
  24659. const el = instance.vnode.el;
  24660. const { clientWidth: width, clientHeight: height } = el;
  24661. cursorLeft.value = saturation * width / 100;
  24662. cursorTop.value = (100 - value) * height / 100;
  24663. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  24664. }
  24665. function handleDrag(event) {
  24666. const el = instance.vnode.el;
  24667. const rect = el.getBoundingClientRect();
  24668. const { clientX, clientY } = getClientXY(event);
  24669. let left = clientX - rect.left;
  24670. let top = clientY - rect.top;
  24671. left = Math.max(0, left);
  24672. left = Math.min(left, rect.width);
  24673. top = Math.max(0, top);
  24674. top = Math.min(top, rect.height);
  24675. cursorLeft.value = left;
  24676. cursorTop.value = top;
  24677. props.color.set({
  24678. saturation: left / rect.width * 100,
  24679. value: 100 - top / rect.height * 100
  24680. });
  24681. }
  24682. vue.watch(() => colorValue.value, () => {
  24683. update();
  24684. });
  24685. vue.onMounted(() => {
  24686. draggable(instance.vnode.el, {
  24687. drag: (event) => {
  24688. handleDrag(event);
  24689. },
  24690. end: (event) => {
  24691. handleDrag(event);
  24692. }
  24693. });
  24694. update();
  24695. });
  24696. return {
  24697. cursorTop,
  24698. cursorLeft,
  24699. background,
  24700. colorValue,
  24701. handleDrag,
  24702. update,
  24703. ns
  24704. };
  24705. }
  24706. });
  24707. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  24708. return vue.openBlock(), vue.createElementBlock("div", {
  24709. class: vue.normalizeClass(_ctx.ns.b()),
  24710. style: vue.normalizeStyle({
  24711. backgroundColor: _ctx.background
  24712. })
  24713. }, [
  24714. vue.createElementVNode("div", {
  24715. class: vue.normalizeClass(_ctx.ns.e("white"))
  24716. }, null, 2),
  24717. vue.createElementVNode("div", {
  24718. class: vue.normalizeClass(_ctx.ns.e("black"))
  24719. }, null, 2),
  24720. vue.createElementVNode("div", {
  24721. class: vue.normalizeClass(_ctx.ns.e("cursor")),
  24722. style: vue.normalizeStyle({
  24723. top: _ctx.cursorTop + "px",
  24724. left: _ctx.cursorLeft + "px"
  24725. })
  24726. }, [
  24727. vue.createElementVNode("div")
  24728. ], 6)
  24729. ], 6);
  24730. }
  24731. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["render", _sfc_render$o], ["__file", "sv-panel.vue"]]);
  24732. const __default__$17 = vue.defineComponent({
  24733. name: "ElColorPicker"
  24734. });
  24735. const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({
  24736. ...__default__$17,
  24737. props: colorPickerProps,
  24738. emits: colorPickerEmits,
  24739. setup(__props, { expose, emit }) {
  24740. const props = __props;
  24741. const { t } = useLocale();
  24742. const ns = useNamespace("color");
  24743. const { formItem } = useFormItem();
  24744. const colorSize = useFormSize();
  24745. const colorDisabled = useFormDisabled();
  24746. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  24747. formItemContext: formItem
  24748. });
  24749. const hue = vue.ref();
  24750. const sv = vue.ref();
  24751. const alpha = vue.ref();
  24752. const popper = vue.ref();
  24753. const triggerRef = vue.ref();
  24754. const inputRef = vue.ref();
  24755. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  24756. beforeFocus() {
  24757. return colorDisabled.value;
  24758. },
  24759. beforeBlur(event) {
  24760. var _a;
  24761. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  24762. },
  24763. afterBlur() {
  24764. setShowPicker(false);
  24765. resetColor();
  24766. }
  24767. });
  24768. let shouldActiveChange = true;
  24769. const color = vue.reactive(new Color({
  24770. enableAlpha: props.showAlpha,
  24771. format: props.colorFormat || "",
  24772. value: props.modelValue
  24773. }));
  24774. const showPicker = vue.ref(false);
  24775. const showPanelColor = vue.ref(false);
  24776. const customInput = vue.ref("");
  24777. const displayedColor = vue.computed(() => {
  24778. if (!props.modelValue && !showPanelColor.value) {
  24779. return "transparent";
  24780. }
  24781. return displayedRgb(color, props.showAlpha);
  24782. });
  24783. const currentColor = vue.computed(() => {
  24784. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  24785. });
  24786. const buttonAriaLabel = vue.computed(() => {
  24787. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  24788. });
  24789. const buttonAriaLabelledby = vue.computed(() => {
  24790. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  24791. });
  24792. const btnKls = vue.computed(() => {
  24793. return [
  24794. ns.b("picker"),
  24795. ns.is("disabled", colorDisabled.value),
  24796. ns.bm("picker", colorSize.value),
  24797. ns.is("focused", isFocused.value)
  24798. ];
  24799. });
  24800. function displayedRgb(color2, showAlpha) {
  24801. if (!(color2 instanceof Color)) {
  24802. throw new TypeError("color should be instance of _color Class");
  24803. }
  24804. const { r, g, b } = color2.toRgb();
  24805. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  24806. }
  24807. function setShowPicker(value) {
  24808. showPicker.value = value;
  24809. }
  24810. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  24811. function show() {
  24812. if (colorDisabled.value)
  24813. return;
  24814. setShowPicker(true);
  24815. }
  24816. function hide() {
  24817. debounceSetShowPicker(false);
  24818. resetColor();
  24819. }
  24820. function resetColor() {
  24821. vue.nextTick(() => {
  24822. if (props.modelValue) {
  24823. color.fromString(props.modelValue);
  24824. } else {
  24825. color.value = "";
  24826. vue.nextTick(() => {
  24827. showPanelColor.value = false;
  24828. });
  24829. }
  24830. });
  24831. }
  24832. function handleTrigger() {
  24833. if (colorDisabled.value)
  24834. return;
  24835. debounceSetShowPicker(!showPicker.value);
  24836. }
  24837. function handleConfirm() {
  24838. color.fromString(customInput.value);
  24839. }
  24840. function confirmValue() {
  24841. const value = color.value;
  24842. emit(UPDATE_MODEL_EVENT, value);
  24843. emit("change", value);
  24844. if (props.validateEvent) {
  24845. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24846. }
  24847. debounceSetShowPicker(false);
  24848. vue.nextTick(() => {
  24849. const newColor = new Color({
  24850. enableAlpha: props.showAlpha,
  24851. format: props.colorFormat || "",
  24852. value: props.modelValue
  24853. });
  24854. if (!color.compare(newColor)) {
  24855. resetColor();
  24856. }
  24857. });
  24858. }
  24859. function clear() {
  24860. debounceSetShowPicker(false);
  24861. emit(UPDATE_MODEL_EVENT, null);
  24862. emit("change", null);
  24863. if (props.modelValue !== null && props.validateEvent) {
  24864. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24865. }
  24866. resetColor();
  24867. }
  24868. function handleClickOutside() {
  24869. if (!showPicker.value)
  24870. return;
  24871. hide();
  24872. isFocused.value && focus();
  24873. }
  24874. function handleEsc(event) {
  24875. event.preventDefault();
  24876. event.stopPropagation();
  24877. setShowPicker(false);
  24878. resetColor();
  24879. }
  24880. function handleKeyDown(event) {
  24881. switch (event.code) {
  24882. case EVENT_CODE.enter:
  24883. case EVENT_CODE.space:
  24884. event.preventDefault();
  24885. event.stopPropagation();
  24886. show();
  24887. inputRef.value.focus();
  24888. break;
  24889. case EVENT_CODE.esc:
  24890. handleEsc(event);
  24891. break;
  24892. }
  24893. }
  24894. function focus() {
  24895. triggerRef.value.focus();
  24896. }
  24897. function blur() {
  24898. triggerRef.value.blur();
  24899. }
  24900. vue.onMounted(() => {
  24901. if (props.modelValue) {
  24902. customInput.value = currentColor.value;
  24903. }
  24904. });
  24905. vue.watch(() => props.modelValue, (newVal) => {
  24906. if (!newVal) {
  24907. showPanelColor.value = false;
  24908. } else if (newVal && newVal !== color.value) {
  24909. shouldActiveChange = false;
  24910. color.fromString(newVal);
  24911. }
  24912. });
  24913. vue.watch(() => currentColor.value, (val) => {
  24914. customInput.value = val;
  24915. shouldActiveChange && emit("activeChange", val);
  24916. shouldActiveChange = true;
  24917. });
  24918. vue.watch(() => color.value, () => {
  24919. if (!props.modelValue && !showPanelColor.value) {
  24920. showPanelColor.value = true;
  24921. }
  24922. });
  24923. vue.watch(() => showPicker.value, () => {
  24924. vue.nextTick(() => {
  24925. var _a, _b, _c;
  24926. (_a = hue.value) == null ? void 0 : _a.update();
  24927. (_b = sv.value) == null ? void 0 : _b.update();
  24928. (_c = alpha.value) == null ? void 0 : _c.update();
  24929. });
  24930. });
  24931. vue.provide(colorPickerContextKey, {
  24932. currentColor
  24933. });
  24934. expose({
  24935. color,
  24936. show,
  24937. hide,
  24938. focus,
  24939. blur
  24940. });
  24941. return (_ctx, _cache) => {
  24942. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  24943. ref_key: "popper",
  24944. ref: popper,
  24945. visible: showPicker.value,
  24946. "show-arrow": false,
  24947. "fallback-placements": ["bottom", "top", "right", "left"],
  24948. offset: 0,
  24949. "gpu-acceleration": false,
  24950. "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass],
  24951. "stop-popper-mouse-event": false,
  24952. effect: "light",
  24953. trigger: "click",
  24954. teleported: _ctx.teleported,
  24955. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  24956. persistent: "",
  24957. onHide: ($event) => setShowPicker(false)
  24958. }, {
  24959. content: vue.withCtx(() => [
  24960. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  24961. onKeydown: vue.withKeys(handleEsc, ["esc"])
  24962. }, [
  24963. vue.createElementVNode("div", {
  24964. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper"))
  24965. }, [
  24966. vue.createVNode(HueSlider, {
  24967. ref_key: "hue",
  24968. ref: hue,
  24969. class: "hue-slider",
  24970. color: vue.unref(color),
  24971. vertical: ""
  24972. }, null, 8, ["color"]),
  24973. vue.createVNode(SvPanel, {
  24974. ref_key: "sv",
  24975. ref: sv,
  24976. color: vue.unref(color)
  24977. }, null, 8, ["color"])
  24978. ], 2),
  24979. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  24980. key: 0,
  24981. ref_key: "alpha",
  24982. ref: alpha,
  24983. color: vue.unref(color)
  24984. }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
  24985. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  24986. key: 1,
  24987. ref: "predefine",
  24988. "enable-alpha": _ctx.showAlpha,
  24989. color: vue.unref(color),
  24990. colors: _ctx.predefine
  24991. }, null, 8, ["enable-alpha", "color", "colors"])) : vue.createCommentVNode("v-if", true),
  24992. vue.createElementVNode("div", {
  24993. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns"))
  24994. }, [
  24995. vue.createElementVNode("span", {
  24996. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value"))
  24997. }, [
  24998. vue.createVNode(vue.unref(ElInput), {
  24999. ref_key: "inputRef",
  25000. ref: inputRef,
  25001. modelValue: customInput.value,
  25002. "onUpdate:modelValue": ($event) => customInput.value = $event,
  25003. "validate-event": false,
  25004. size: "small",
  25005. onKeyup: vue.withKeys(handleConfirm, ["enter"]),
  25006. onBlur: handleConfirm
  25007. }, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup"])
  25008. ], 2),
  25009. vue.createVNode(vue.unref(ElButton), {
  25010. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")),
  25011. text: "",
  25012. size: "small",
  25013. onClick: clear
  25014. }, {
  25015. default: vue.withCtx(() => [
  25016. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  25017. ]),
  25018. _: 1
  25019. }, 8, ["class"]),
  25020. vue.createVNode(vue.unref(ElButton), {
  25021. plain: "",
  25022. size: "small",
  25023. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")),
  25024. onClick: confirmValue
  25025. }, {
  25026. default: vue.withCtx(() => [
  25027. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  25028. ]),
  25029. _: 1
  25030. }, 8, ["class"])
  25031. ], 2)
  25032. ], 40, ["onKeydown"])), [
  25033. [vue.unref(ClickOutside), handleClickOutside]
  25034. ])
  25035. ]),
  25036. default: vue.withCtx(() => [
  25037. vue.createElementVNode("div", vue.mergeProps({
  25038. id: vue.unref(buttonId),
  25039. ref_key: "triggerRef",
  25040. ref: triggerRef
  25041. }, _ctx.$attrs, {
  25042. class: vue.unref(btnKls),
  25043. role: "button",
  25044. "aria-label": vue.unref(buttonAriaLabel),
  25045. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  25046. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  25047. "aria-disabled": vue.unref(colorDisabled),
  25048. tabindex: vue.unref(colorDisabled) ? -1 : _ctx.tabindex,
  25049. onKeydown: handleKeyDown,
  25050. onFocus: vue.unref(handleFocus),
  25051. onBlur: vue.unref(handleBlur)
  25052. }), [
  25053. vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", {
  25054. key: 0,
  25055. class: vue.normalizeClass(vue.unref(ns).be("picker", "mask"))
  25056. }, null, 2)) : vue.createCommentVNode("v-if", true),
  25057. vue.createElementVNode("div", {
  25058. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  25059. onClick: handleTrigger
  25060. }, [
  25061. vue.createElementVNode("span", {
  25062. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  25063. }, [
  25064. vue.createElementVNode("span", {
  25065. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  25066. style: vue.normalizeStyle({
  25067. backgroundColor: vue.unref(displayedColor)
  25068. })
  25069. }, [
  25070. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25071. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  25072. }, {
  25073. default: vue.withCtx(() => [
  25074. vue.createVNode(vue.unref(arrow_down_default))
  25075. ]),
  25076. _: 1
  25077. }, 8, ["class"]), [
  25078. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  25079. ]),
  25080. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25081. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  25082. }, {
  25083. default: vue.withCtx(() => [
  25084. vue.createVNode(vue.unref(close_default))
  25085. ]),
  25086. _: 1
  25087. }, 8, ["class"]), [
  25088. [vue.vShow, !_ctx.modelValue && !showPanelColor.value]
  25089. ])
  25090. ], 6)
  25091. ], 2)
  25092. ], 2)
  25093. ], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
  25094. ]),
  25095. _: 1
  25096. }, 8, ["visible", "popper-class", "teleported", "transition", "onHide"]);
  25097. };
  25098. }
  25099. });
  25100. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "color-picker.vue"]]);
  25101. const ElColorPicker = withInstall(ColorPicker);
  25102. const __default__$16 = vue.defineComponent({
  25103. name: "ElContainer"
  25104. });
  25105. const _sfc_main$1B = /* @__PURE__ */ vue.defineComponent({
  25106. ...__default__$16,
  25107. props: {
  25108. direction: {
  25109. type: String
  25110. }
  25111. },
  25112. setup(__props) {
  25113. const props = __props;
  25114. const slots = vue.useSlots();
  25115. const ns = useNamespace("container");
  25116. const isVertical = vue.computed(() => {
  25117. if (props.direction === "vertical") {
  25118. return true;
  25119. } else if (props.direction === "horizontal") {
  25120. return false;
  25121. }
  25122. if (slots && slots.default) {
  25123. const vNodes = slots.default();
  25124. return vNodes.some((vNode) => {
  25125. const tag = vNode.type.name;
  25126. return tag === "ElHeader" || tag === "ElFooter";
  25127. });
  25128. } else {
  25129. return false;
  25130. }
  25131. });
  25132. return (_ctx, _cache) => {
  25133. return vue.openBlock(), vue.createElementBlock("section", {
  25134. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  25135. }, [
  25136. vue.renderSlot(_ctx.$slots, "default")
  25137. ], 2);
  25138. };
  25139. }
  25140. });
  25141. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "container.vue"]]);
  25142. const __default__$15 = vue.defineComponent({
  25143. name: "ElAside"
  25144. });
  25145. const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({
  25146. ...__default__$15,
  25147. props: {
  25148. width: {
  25149. type: String,
  25150. default: null
  25151. }
  25152. },
  25153. setup(__props) {
  25154. const props = __props;
  25155. const ns = useNamespace("aside");
  25156. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  25157. return (_ctx, _cache) => {
  25158. return vue.openBlock(), vue.createElementBlock("aside", {
  25159. class: vue.normalizeClass(vue.unref(ns).b()),
  25160. style: vue.normalizeStyle(vue.unref(style))
  25161. }, [
  25162. vue.renderSlot(_ctx.$slots, "default")
  25163. ], 6);
  25164. };
  25165. }
  25166. });
  25167. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "aside.vue"]]);
  25168. const __default__$14 = vue.defineComponent({
  25169. name: "ElFooter"
  25170. });
  25171. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  25172. ...__default__$14,
  25173. props: {
  25174. height: {
  25175. type: String,
  25176. default: null
  25177. }
  25178. },
  25179. setup(__props) {
  25180. const props = __props;
  25181. const ns = useNamespace("footer");
  25182. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  25183. return (_ctx, _cache) => {
  25184. return vue.openBlock(), vue.createElementBlock("footer", {
  25185. class: vue.normalizeClass(vue.unref(ns).b()),
  25186. style: vue.normalizeStyle(vue.unref(style))
  25187. }, [
  25188. vue.renderSlot(_ctx.$slots, "default")
  25189. ], 6);
  25190. };
  25191. }
  25192. });
  25193. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "footer.vue"]]);
  25194. const __default__$13 = vue.defineComponent({
  25195. name: "ElHeader"
  25196. });
  25197. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  25198. ...__default__$13,
  25199. props: {
  25200. height: {
  25201. type: String,
  25202. default: null
  25203. }
  25204. },
  25205. setup(__props) {
  25206. const props = __props;
  25207. const ns = useNamespace("header");
  25208. const style = vue.computed(() => {
  25209. return props.height ? ns.cssVarBlock({
  25210. height: props.height
  25211. }) : {};
  25212. });
  25213. return (_ctx, _cache) => {
  25214. return vue.openBlock(), vue.createElementBlock("header", {
  25215. class: vue.normalizeClass(vue.unref(ns).b()),
  25216. style: vue.normalizeStyle(vue.unref(style))
  25217. }, [
  25218. vue.renderSlot(_ctx.$slots, "default")
  25219. ], 6);
  25220. };
  25221. }
  25222. });
  25223. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "header.vue"]]);
  25224. const __default__$12 = vue.defineComponent({
  25225. name: "ElMain"
  25226. });
  25227. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  25228. ...__default__$12,
  25229. setup(__props) {
  25230. const ns = useNamespace("main");
  25231. return (_ctx, _cache) => {
  25232. return vue.openBlock(), vue.createElementBlock("main", {
  25233. class: vue.normalizeClass(vue.unref(ns).b())
  25234. }, [
  25235. vue.renderSlot(_ctx.$slots, "default")
  25236. ], 2);
  25237. };
  25238. }
  25239. });
  25240. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "main.vue"]]);
  25241. const ElContainer = withInstall(Container, {
  25242. Aside,
  25243. Footer: Footer$2,
  25244. Header: Header$1,
  25245. Main
  25246. });
  25247. const ElAside = withNoopInstall(Aside);
  25248. const ElFooter = withNoopInstall(Footer$2);
  25249. const ElHeader = withNoopInstall(Header$1);
  25250. const ElMain = withNoopInstall(Main);
  25251. var advancedFormat$1 = {exports: {}};
  25252. (function(module, exports) {
  25253. !function(e, t) {
  25254. module.exports = t() ;
  25255. }(commonjsGlobal, function() {
  25256. return function(e, t, r) {
  25257. var n = t.prototype, s = n.format;
  25258. r.en.ordinal = function(e2) {
  25259. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  25260. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  25261. }, n.format = function(e2) {
  25262. var t2 = this, r2 = this.$locale();
  25263. if (!this.isValid())
  25264. return s.bind(this)(e2);
  25265. 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) {
  25266. switch (e3) {
  25267. case "Q":
  25268. return Math.ceil((t2.$M + 1) / 3);
  25269. case "Do":
  25270. return r2.ordinal(t2.$D);
  25271. case "gggg":
  25272. return t2.weekYear();
  25273. case "GGGG":
  25274. return t2.isoWeekYear();
  25275. case "wo":
  25276. return r2.ordinal(t2.week(), "W");
  25277. case "w":
  25278. case "ww":
  25279. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  25280. case "W":
  25281. case "WW":
  25282. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  25283. case "k":
  25284. case "kk":
  25285. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  25286. case "X":
  25287. return Math.floor(t2.$d.getTime() / 1e3);
  25288. case "x":
  25289. return t2.$d.getTime();
  25290. case "z":
  25291. return "[" + t2.offsetName() + "]";
  25292. case "zzz":
  25293. return "[" + t2.offsetName("long") + "]";
  25294. default:
  25295. return e3;
  25296. }
  25297. });
  25298. return s.bind(this)(a);
  25299. };
  25300. };
  25301. });
  25302. })(advancedFormat$1);
  25303. var advancedFormat = advancedFormat$1.exports;
  25304. var weekOfYear$1 = {exports: {}};
  25305. (function(module, exports) {
  25306. !function(e, t) {
  25307. module.exports = t() ;
  25308. }(commonjsGlobal, function() {
  25309. var e = "week", t = "year";
  25310. return function(i, n, r) {
  25311. var f = n.prototype;
  25312. f.week = function(i2) {
  25313. if (i2 === void 0 && (i2 = null), i2 !== null)
  25314. return this.add(7 * (i2 - this.week()), "day");
  25315. var n2 = this.$locale().yearStart || 1;
  25316. if (this.month() === 11 && this.date() > 25) {
  25317. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  25318. if (f2.isBefore(s))
  25319. return 1;
  25320. }
  25321. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  25322. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  25323. }, f.weeks = function(e2) {
  25324. return e2 === void 0 && (e2 = null), this.week(e2);
  25325. };
  25326. };
  25327. });
  25328. })(weekOfYear$1);
  25329. var weekOfYear = weekOfYear$1.exports;
  25330. var weekYear$1 = {exports: {}};
  25331. (function(module, exports) {
  25332. !function(e, t) {
  25333. module.exports = t() ;
  25334. }(commonjsGlobal, function() {
  25335. return function(e, t) {
  25336. t.prototype.weekYear = function() {
  25337. var e2 = this.month(), t2 = this.week(), n = this.year();
  25338. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  25339. };
  25340. };
  25341. });
  25342. })(weekYear$1);
  25343. var weekYear = weekYear$1.exports;
  25344. var dayOfYear$1 = {exports: {}};
  25345. (function(module, exports) {
  25346. !function(e, t) {
  25347. module.exports = t() ;
  25348. }(commonjsGlobal, function() {
  25349. return function(e, t, n) {
  25350. t.prototype.dayOfYear = function(e2) {
  25351. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  25352. return e2 == null ? t2 : this.add(e2 - t2, "day");
  25353. };
  25354. };
  25355. });
  25356. })(dayOfYear$1);
  25357. var dayOfYear = dayOfYear$1.exports;
  25358. var isSameOrAfter$1 = {exports: {}};
  25359. (function(module, exports) {
  25360. !function(e, t) {
  25361. module.exports = t() ;
  25362. }(commonjsGlobal, function() {
  25363. return function(e, t) {
  25364. t.prototype.isSameOrAfter = function(e2, t2) {
  25365. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  25366. };
  25367. };
  25368. });
  25369. })(isSameOrAfter$1);
  25370. var isSameOrAfter = isSameOrAfter$1.exports;
  25371. var isSameOrBefore$1 = {exports: {}};
  25372. (function(module, exports) {
  25373. !function(e, i) {
  25374. module.exports = i() ;
  25375. }(commonjsGlobal, function() {
  25376. return function(e, i) {
  25377. i.prototype.isSameOrBefore = function(e2, i2) {
  25378. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  25379. };
  25380. };
  25381. });
  25382. })(isSameOrBefore$1);
  25383. var isSameOrBefore = isSameOrBefore$1.exports;
  25384. const ROOT_PICKER_INJECTION_KEY = Symbol();
  25385. const datePickerProps = buildProps({
  25386. ...timePickerDefaultProps,
  25387. type: {
  25388. type: definePropType(String),
  25389. default: "date"
  25390. }
  25391. });
  25392. const selectionModes = [
  25393. "date",
  25394. "dates",
  25395. "year",
  25396. "years",
  25397. "month",
  25398. "months",
  25399. "week",
  25400. "range"
  25401. ];
  25402. const datePickerSharedProps = buildProps({
  25403. disabledDate: {
  25404. type: definePropType(Function)
  25405. },
  25406. date: {
  25407. type: definePropType(Object),
  25408. required: true
  25409. },
  25410. minDate: {
  25411. type: definePropType(Object)
  25412. },
  25413. maxDate: {
  25414. type: definePropType(Object)
  25415. },
  25416. parsedValue: {
  25417. type: definePropType([Object, Array])
  25418. },
  25419. rangeState: {
  25420. type: definePropType(Object),
  25421. default: () => ({
  25422. endDate: null,
  25423. selecting: false
  25424. })
  25425. }
  25426. });
  25427. const panelSharedProps = buildProps({
  25428. type: {
  25429. type: definePropType(String),
  25430. required: true,
  25431. values: datePickTypes
  25432. },
  25433. dateFormat: String,
  25434. timeFormat: String
  25435. });
  25436. const panelRangeSharedProps = buildProps({
  25437. unlinkPanels: Boolean,
  25438. parsedValue: {
  25439. type: definePropType(Array)
  25440. }
  25441. });
  25442. const selectionModeWithDefault = (mode) => {
  25443. return {
  25444. type: String,
  25445. values: selectionModes,
  25446. default: mode
  25447. };
  25448. };
  25449. const panelDatePickProps = buildProps({
  25450. ...panelSharedProps,
  25451. parsedValue: {
  25452. type: definePropType([Object, Array])
  25453. },
  25454. visible: {
  25455. type: Boolean
  25456. },
  25457. format: {
  25458. type: String,
  25459. default: ""
  25460. }
  25461. });
  25462. const isValidRange = (range) => {
  25463. if (!isArray$1(range))
  25464. return false;
  25465. const [left, right] = range;
  25466. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
  25467. };
  25468. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  25469. let start;
  25470. if (isArray$1(defaultValue)) {
  25471. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  25472. if (!unlinkPanels) {
  25473. right = left.add(1, unit);
  25474. }
  25475. return [left, right];
  25476. } else if (defaultValue) {
  25477. start = dayjs(defaultValue);
  25478. } else {
  25479. start = dayjs();
  25480. }
  25481. start = start.locale(lang);
  25482. return [start, start.add(1, unit)];
  25483. };
  25484. const buildPickerTable = (dimension, rows, {
  25485. columnIndexOffset,
  25486. startDate,
  25487. nextEndDate,
  25488. now,
  25489. unit,
  25490. relativeDateGetter,
  25491. setCellMetadata,
  25492. setRowMetadata
  25493. }) => {
  25494. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  25495. const row = rows[rowIndex];
  25496. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  25497. let cell = row[columnIndex + columnIndexOffset];
  25498. if (!cell) {
  25499. cell = {
  25500. row: rowIndex,
  25501. column: columnIndex,
  25502. type: "normal",
  25503. inRange: false,
  25504. start: false,
  25505. end: false
  25506. };
  25507. }
  25508. const index = rowIndex * dimension.column + columnIndex;
  25509. const nextStartDate = relativeDateGetter(index);
  25510. cell.dayjs = nextStartDate;
  25511. cell.date = nextStartDate.toDate();
  25512. cell.timestamp = nextStartDate.valueOf();
  25513. cell.type = "normal";
  25514. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  25515. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  25516. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25517. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  25518. } else {
  25519. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  25520. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25521. }
  25522. const isToday = nextStartDate.isSame(now, unit);
  25523. if (isToday) {
  25524. cell.type = "today";
  25525. }
  25526. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  25527. row[columnIndex + columnIndexOffset] = cell;
  25528. }
  25529. setRowMetadata == null ? void 0 : setRowMetadata(row);
  25530. }
  25531. };
  25532. const datesInMonth = (year, month, lang) => {
  25533. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  25534. const numOfDays = firstDay.daysInMonth();
  25535. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25536. };
  25537. const getValidDateOfMonth = (year, month, lang, disabledDate) => {
  25538. const _value = dayjs().year(year).month(month).startOf("month");
  25539. const _date = datesInMonth(year, month, lang).find((date) => {
  25540. return !(disabledDate == null ? void 0 : disabledDate(date));
  25541. });
  25542. if (_date) {
  25543. return dayjs(_date).locale(lang);
  25544. }
  25545. return _value.locale(lang);
  25546. };
  25547. const getValidDateOfYear = (value, lang, disabledDate) => {
  25548. const year = value.year();
  25549. if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
  25550. return value.locale(lang);
  25551. }
  25552. const month = value.month();
  25553. if (!datesInMonth(year, month, lang).every(disabledDate)) {
  25554. return getValidDateOfMonth(year, month, lang, disabledDate);
  25555. }
  25556. for (let i = 0; i < 12; i++) {
  25557. if (!datesInMonth(year, i, lang).every(disabledDate)) {
  25558. return getValidDateOfMonth(year, i, lang, disabledDate);
  25559. }
  25560. }
  25561. return value;
  25562. };
  25563. const basicDateTableProps = buildProps({
  25564. ...datePickerSharedProps,
  25565. cellClassName: {
  25566. type: definePropType(Function)
  25567. },
  25568. showWeekNumber: Boolean,
  25569. selectionMode: selectionModeWithDefault("date")
  25570. });
  25571. const basicDateTableEmits = ["changerange", "pick", "select"];
  25572. const isNormalDay = (type = "") => {
  25573. return ["normal", "today"].includes(type);
  25574. };
  25575. const useBasicDateTable = (props, emit) => {
  25576. const { lang } = useLocale();
  25577. const tbodyRef = vue.ref();
  25578. const currentCellRef = vue.ref();
  25579. const lastRow = vue.ref();
  25580. const lastColumn = vue.ref();
  25581. const tableRows = vue.ref([[], [], [], [], [], []]);
  25582. let focusWithClick = false;
  25583. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  25584. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  25585. const offsetDay = vue.computed(() => {
  25586. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  25587. });
  25588. const startDate = vue.computed(() => {
  25589. const startDayOfMonth = props.date.startOf("month");
  25590. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  25591. });
  25592. const WEEKS = vue.computed(() => {
  25593. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  25594. });
  25595. const hasCurrent = vue.computed(() => {
  25596. return flatten(vue.unref(rows)).some((row) => {
  25597. return row.isCurrent;
  25598. });
  25599. });
  25600. const days = vue.computed(() => {
  25601. const startOfMonth = props.date.startOf("month");
  25602. const startOfMonthDay = startOfMonth.day() || 7;
  25603. const dateCountOfMonth = startOfMonth.daysInMonth();
  25604. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  25605. return {
  25606. startOfMonthDay,
  25607. dateCountOfMonth,
  25608. dateCountOfLastMonth
  25609. };
  25610. });
  25611. const selectedDate = vue.computed(() => {
  25612. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  25613. });
  25614. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  25615. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  25616. const offset = vue.unref(offsetDay);
  25617. if (rowIndex >= 0 && rowIndex <= 1) {
  25618. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  25619. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  25620. cell.text = count;
  25621. return true;
  25622. } else {
  25623. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  25624. cell.type = "prev-month";
  25625. }
  25626. } else {
  25627. if (count <= dateCountOfMonth) {
  25628. cell.text = count;
  25629. } else {
  25630. cell.text = count - dateCountOfMonth;
  25631. cell.type = "next-month";
  25632. }
  25633. return true;
  25634. }
  25635. return false;
  25636. };
  25637. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  25638. const { disabledDate, cellClassName } = props;
  25639. const _selectedDate = vue.unref(selectedDate);
  25640. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  25641. const cellDate = cell.dayjs.toDate();
  25642. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  25643. cell.isSelected = !!cell.selected;
  25644. cell.isCurrent = isCurrent(cell);
  25645. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  25646. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  25647. return shouldIncrement;
  25648. };
  25649. const setRowMetadata = (row) => {
  25650. if (props.selectionMode === "week") {
  25651. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  25652. const isActive = isWeekActive(row[start + 1]);
  25653. row[start].inRange = isActive;
  25654. row[start].start = isActive;
  25655. row[end].inRange = isActive;
  25656. row[end].end = isActive;
  25657. }
  25658. };
  25659. const rows = vue.computed(() => {
  25660. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  25661. const offset = vue.unref(offsetDay);
  25662. const rows_ = vue.unref(tableRows);
  25663. const dateUnit = "day";
  25664. let count = 1;
  25665. if (showWeekNumber) {
  25666. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  25667. if (!rows_[rowIndex][0]) {
  25668. rows_[rowIndex][0] = {
  25669. type: "week",
  25670. text: vue.unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
  25671. };
  25672. }
  25673. }
  25674. }
  25675. buildPickerTable({ row: 6, column: 7 }, rows_, {
  25676. startDate: minDate,
  25677. columnIndexOffset: showWeekNumber ? 1 : 0,
  25678. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  25679. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  25680. unit: dateUnit,
  25681. relativeDateGetter: (idx) => vue.unref(startDate).add(idx - offset, dateUnit),
  25682. setCellMetadata: (...args) => {
  25683. if (setCellMetadata(...args, count)) {
  25684. count += 1;
  25685. }
  25686. },
  25687. setRowMetadata
  25688. });
  25689. return rows_;
  25690. });
  25691. vue.watch(() => props.date, async () => {
  25692. var _a;
  25693. if ((_a = vue.unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  25694. await vue.nextTick();
  25695. await focus();
  25696. }
  25697. });
  25698. const focus = async () => {
  25699. var _a;
  25700. return (_a = vue.unref(currentCellRef)) == null ? void 0 : _a.focus();
  25701. };
  25702. const isCurrent = (cell) => {
  25703. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  25704. };
  25705. const cellMatchesDate = (cell, date) => {
  25706. if (!date)
  25707. return false;
  25708. return dayjs(date).locale(vue.unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  25709. };
  25710. const getDateOfCell = (row, column) => {
  25711. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - vue.unref(offsetDay);
  25712. return vue.unref(startDate).add(offsetFromStart, "day");
  25713. };
  25714. const handleMouseMove = (event) => {
  25715. var _a;
  25716. if (!props.rangeState.selecting)
  25717. return;
  25718. let target = event.target;
  25719. if (target.tagName === "SPAN") {
  25720. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  25721. }
  25722. if (target.tagName === "DIV") {
  25723. target = target.parentNode;
  25724. }
  25725. if (target.tagName !== "TD")
  25726. return;
  25727. const row = target.parentNode.rowIndex - 1;
  25728. const column = target.cellIndex;
  25729. if (vue.unref(rows)[row][column].disabled)
  25730. return;
  25731. if (row !== vue.unref(lastRow) || column !== vue.unref(lastColumn)) {
  25732. lastRow.value = row;
  25733. lastColumn.value = column;
  25734. emit("changerange", {
  25735. selecting: true,
  25736. endDate: getDateOfCell(row, column)
  25737. });
  25738. }
  25739. };
  25740. const isSelectedCell = (cell) => {
  25741. return !vue.unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  25742. };
  25743. const handleFocus = (event) => {
  25744. if (focusWithClick || vue.unref(hasCurrent) || props.selectionMode !== "date")
  25745. return;
  25746. handlePickDate(event, true);
  25747. };
  25748. const handleMouseDown = (event) => {
  25749. const target = event.target.closest("td");
  25750. if (!target)
  25751. return;
  25752. focusWithClick = true;
  25753. };
  25754. const handleMouseUp = (event) => {
  25755. const target = event.target.closest("td");
  25756. if (!target)
  25757. return;
  25758. focusWithClick = false;
  25759. };
  25760. const handleRangePick = (newDate) => {
  25761. if (!props.rangeState.selecting || !props.minDate) {
  25762. emit("pick", { minDate: newDate, maxDate: null });
  25763. emit("select", true);
  25764. } else {
  25765. if (newDate >= props.minDate) {
  25766. emit("pick", { minDate: props.minDate, maxDate: newDate });
  25767. } else {
  25768. emit("pick", { minDate: newDate, maxDate: props.minDate });
  25769. }
  25770. emit("select", false);
  25771. }
  25772. };
  25773. const handleWeekPick = (newDate) => {
  25774. const weekNumber = newDate.week();
  25775. const value = `${newDate.year()}w${weekNumber}`;
  25776. emit("pick", {
  25777. year: newDate.year(),
  25778. week: weekNumber,
  25779. value,
  25780. date: newDate.startOf("week")
  25781. });
  25782. };
  25783. const handleDatesPick = (newDate, selected) => {
  25784. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  25785. emit("pick", newValue);
  25786. };
  25787. const handlePickDate = (event, isKeyboardMovement = false) => {
  25788. const target = event.target.closest("td");
  25789. if (!target)
  25790. return;
  25791. const row = target.parentNode.rowIndex - 1;
  25792. const column = target.cellIndex;
  25793. const cell = vue.unref(rows)[row][column];
  25794. if (cell.disabled || cell.type === "week")
  25795. return;
  25796. const newDate = getDateOfCell(row, column);
  25797. switch (props.selectionMode) {
  25798. case "range": {
  25799. handleRangePick(newDate);
  25800. break;
  25801. }
  25802. case "date": {
  25803. emit("pick", newDate, isKeyboardMovement);
  25804. break;
  25805. }
  25806. case "week": {
  25807. handleWeekPick(newDate);
  25808. break;
  25809. }
  25810. case "dates": {
  25811. handleDatesPick(newDate, !!cell.selected);
  25812. break;
  25813. }
  25814. }
  25815. };
  25816. const isWeekActive = (cell) => {
  25817. if (props.selectionMode !== "week")
  25818. return false;
  25819. let newDate = props.date.startOf("day");
  25820. if (cell.type === "prev-month") {
  25821. newDate = newDate.subtract(1, "month");
  25822. }
  25823. if (cell.type === "next-month") {
  25824. newDate = newDate.add(1, "month");
  25825. }
  25826. newDate = newDate.date(Number.parseInt(cell.text, 10));
  25827. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  25828. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  25829. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  25830. return weekDate.isSame(newDate, "day");
  25831. }
  25832. return false;
  25833. };
  25834. return {
  25835. WEEKS,
  25836. rows,
  25837. tbodyRef,
  25838. currentCellRef,
  25839. focus,
  25840. isCurrent,
  25841. isWeekActive,
  25842. isSelectedCell,
  25843. handlePickDate,
  25844. handleMouseUp,
  25845. handleMouseDown,
  25846. handleMouseMove,
  25847. handleFocus
  25848. };
  25849. };
  25850. const useBasicDateTableDOM = (props, {
  25851. isCurrent,
  25852. isWeekActive
  25853. }) => {
  25854. const ns = useNamespace("date-table");
  25855. const { t } = useLocale();
  25856. const tableKls = vue.computed(() => [
  25857. ns.b(),
  25858. { "is-week-mode": props.selectionMode === "week" }
  25859. ]);
  25860. const tableLabel = vue.computed(() => t("el.datepicker.dateTablePrompt"));
  25861. const weekLabel = vue.computed(() => t("el.datepicker.week"));
  25862. const getCellClasses = (cell) => {
  25863. const classes = [];
  25864. if (isNormalDay(cell.type) && !cell.disabled) {
  25865. classes.push("available");
  25866. if (cell.type === "today") {
  25867. classes.push("today");
  25868. }
  25869. } else {
  25870. classes.push(cell.type);
  25871. }
  25872. if (isCurrent(cell)) {
  25873. classes.push("current");
  25874. }
  25875. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  25876. classes.push("in-range");
  25877. if (cell.start) {
  25878. classes.push("start-date");
  25879. }
  25880. if (cell.end) {
  25881. classes.push("end-date");
  25882. }
  25883. }
  25884. if (cell.disabled) {
  25885. classes.push("disabled");
  25886. }
  25887. if (cell.selected) {
  25888. classes.push("selected");
  25889. }
  25890. if (cell.customClass) {
  25891. classes.push(cell.customClass);
  25892. }
  25893. return classes.join(" ");
  25894. };
  25895. const getRowKls = (cell) => [
  25896. ns.e("row"),
  25897. { current: isWeekActive(cell) }
  25898. ];
  25899. return {
  25900. tableKls,
  25901. tableLabel,
  25902. weekLabel,
  25903. getCellClasses,
  25904. getRowKls,
  25905. t
  25906. };
  25907. };
  25908. const basicCellProps = buildProps({
  25909. cell: {
  25910. type: definePropType(Object)
  25911. }
  25912. });
  25913. var ElDatePickerCell = vue.defineComponent({
  25914. name: "ElDatePickerCell",
  25915. props: basicCellProps,
  25916. setup(props) {
  25917. const ns = useNamespace("date-table-cell");
  25918. const {
  25919. slots
  25920. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  25921. return () => {
  25922. const {
  25923. cell
  25924. } = props;
  25925. return vue.renderSlot(slots, "default", {
  25926. ...cell
  25927. }, () => {
  25928. var _a;
  25929. return [vue.createVNode("div", {
  25930. "class": ns.b()
  25931. }, [vue.createVNode("span", {
  25932. "class": ns.e("text")
  25933. }, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
  25934. });
  25935. };
  25936. }
  25937. });
  25938. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  25939. __name: "basic-date-table",
  25940. props: basicDateTableProps,
  25941. emits: basicDateTableEmits,
  25942. setup(__props, { expose, emit }) {
  25943. const props = __props;
  25944. const {
  25945. WEEKS,
  25946. rows,
  25947. tbodyRef,
  25948. currentCellRef,
  25949. focus,
  25950. isCurrent,
  25951. isWeekActive,
  25952. isSelectedCell,
  25953. handlePickDate,
  25954. handleMouseUp,
  25955. handleMouseDown,
  25956. handleMouseMove,
  25957. handleFocus
  25958. } = useBasicDateTable(props, emit);
  25959. const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
  25960. isCurrent,
  25961. isWeekActive
  25962. });
  25963. expose({
  25964. focus
  25965. });
  25966. return (_ctx, _cache) => {
  25967. return vue.openBlock(), vue.createElementBlock("table", {
  25968. "aria-label": vue.unref(tableLabel),
  25969. class: vue.normalizeClass(vue.unref(tableKls)),
  25970. cellspacing: "0",
  25971. cellpadding: "0",
  25972. role: "grid",
  25973. onClick: vue.unref(handlePickDate),
  25974. onMousemove: vue.unref(handleMouseMove),
  25975. onMousedown: vue.withModifiers(vue.unref(handleMouseDown), ["prevent"]),
  25976. onMouseup: vue.unref(handleMouseUp)
  25977. }, [
  25978. vue.createElementVNode("tbody", {
  25979. ref_key: "tbodyRef",
  25980. ref: tbodyRef
  25981. }, [
  25982. vue.createElementVNode("tr", null, [
  25983. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", {
  25984. key: 0,
  25985. scope: "col"
  25986. }, vue.toDisplayString(vue.unref(weekLabel)), 1)) : vue.createCommentVNode("v-if", true),
  25987. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  25988. return vue.openBlock(), vue.createElementBlock("th", {
  25989. key,
  25990. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week),
  25991. scope: "col"
  25992. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
  25993. }), 128))
  25994. ]),
  25995. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  25996. return vue.openBlock(), vue.createElementBlock("tr", {
  25997. key: rowKey,
  25998. class: vue.normalizeClass(vue.unref(getRowKls)(row[1]))
  25999. }, [
  26000. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  26001. return vue.openBlock(), vue.createElementBlock("td", {
  26002. key: `${rowKey}.${columnKey}`,
  26003. ref_for: true,
  26004. ref: (el) => vue.unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  26005. class: vue.normalizeClass(vue.unref(getCellClasses)(cell)),
  26006. "aria-current": cell.isCurrent ? "date" : void 0,
  26007. "aria-selected": cell.isCurrent,
  26008. tabindex: vue.unref(isSelectedCell)(cell) ? 0 : -1,
  26009. onFocus: vue.unref(handleFocus)
  26010. }, [
  26011. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26012. ], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
  26013. }), 128))
  26014. ], 2);
  26015. }), 128))
  26016. ], 512)
  26017. ], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
  26018. };
  26019. }
  26020. });
  26021. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "basic-date-table.vue"]]);
  26022. const basicMonthTableProps = buildProps({
  26023. ...datePickerSharedProps,
  26024. selectionMode: selectionModeWithDefault("month")
  26025. });
  26026. const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({
  26027. __name: "basic-month-table",
  26028. props: basicMonthTableProps,
  26029. emits: ["changerange", "pick", "select"],
  26030. setup(__props, { expose, emit }) {
  26031. const props = __props;
  26032. const ns = useNamespace("month-table");
  26033. const { t, lang } = useLocale();
  26034. const tbodyRef = vue.ref();
  26035. const currentCellRef = vue.ref();
  26036. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  26037. const tableRows = vue.ref([
  26038. [],
  26039. [],
  26040. []
  26041. ]);
  26042. const lastRow = vue.ref();
  26043. const lastColumn = vue.ref();
  26044. const rows = vue.computed(() => {
  26045. var _a, _b;
  26046. const rows2 = tableRows.value;
  26047. const now = dayjs().locale(lang.value).startOf("month");
  26048. for (let i = 0; i < 3; i++) {
  26049. const row = rows2[i];
  26050. for (let j = 0; j < 4; j++) {
  26051. const cell = row[j] || (row[j] = {
  26052. row: i,
  26053. column: j,
  26054. type: "normal",
  26055. inRange: false,
  26056. start: false,
  26057. end: false,
  26058. text: -1,
  26059. disabled: false
  26060. });
  26061. cell.type = "normal";
  26062. const index = i * 4 + j;
  26063. const calTime = props.date.startOf("year").month(index);
  26064. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26065. 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"));
  26066. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26067. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26068. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  26069. } else {
  26070. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  26071. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26072. }
  26073. const isToday = now.isSame(calTime);
  26074. if (isToday) {
  26075. cell.type = "today";
  26076. }
  26077. cell.text = index;
  26078. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  26079. }
  26080. }
  26081. return rows2;
  26082. });
  26083. const focus = () => {
  26084. var _a;
  26085. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26086. };
  26087. const getCellStyle = (cell) => {
  26088. const style = {};
  26089. const year = props.date.year();
  26090. const today = new Date();
  26091. const month = cell.text;
  26092. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  26093. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  26094. style.today = today.getFullYear() === year && today.getMonth() === month;
  26095. if (cell.inRange) {
  26096. style["in-range"] = true;
  26097. if (cell.start) {
  26098. style["start-date"] = true;
  26099. }
  26100. if (cell.end) {
  26101. style["end-date"] = true;
  26102. }
  26103. }
  26104. return style;
  26105. };
  26106. const isSelectedCell = (cell) => {
  26107. const year = props.date.year();
  26108. const month = cell.text;
  26109. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  26110. };
  26111. const handleMouseMove = (event) => {
  26112. var _a;
  26113. if (!props.rangeState.selecting)
  26114. return;
  26115. let target = event.target;
  26116. if (target.tagName === "SPAN") {
  26117. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26118. }
  26119. if (target.tagName === "DIV") {
  26120. target = target.parentNode;
  26121. }
  26122. if (target.tagName !== "TD")
  26123. return;
  26124. const row = target.parentNode.rowIndex;
  26125. const column = target.cellIndex;
  26126. if (rows.value[row][column].disabled)
  26127. return;
  26128. if (row !== lastRow.value || column !== lastColumn.value) {
  26129. lastRow.value = row;
  26130. lastColumn.value = column;
  26131. emit("changerange", {
  26132. selecting: true,
  26133. endDate: props.date.startOf("year").month(row * 4 + column)
  26134. });
  26135. }
  26136. };
  26137. const handleMonthTableClick = (event) => {
  26138. var _a;
  26139. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26140. if ((target == null ? void 0 : target.tagName) !== "TD")
  26141. return;
  26142. if (hasClass(target, "disabled"))
  26143. return;
  26144. const column = target.cellIndex;
  26145. const row = target.parentNode.rowIndex;
  26146. const month = row * 4 + column;
  26147. const newDate = props.date.startOf("year").month(month);
  26148. if (props.selectionMode === "months") {
  26149. if (event.type === "keydown") {
  26150. emit("pick", castArray(props.parsedValue), false);
  26151. return;
  26152. }
  26153. const newMonth = getValidDateOfMonth(props.date.year(), month, lang.value, props.disabledDate);
  26154. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([dayjs(newMonth)]);
  26155. emit("pick", newValue);
  26156. } else if (props.selectionMode === "range") {
  26157. if (!props.rangeState.selecting) {
  26158. emit("pick", { minDate: newDate, maxDate: null });
  26159. emit("select", true);
  26160. } else {
  26161. if (props.minDate && newDate >= props.minDate) {
  26162. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26163. } else {
  26164. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26165. }
  26166. emit("select", false);
  26167. }
  26168. } else {
  26169. emit("pick", month);
  26170. }
  26171. };
  26172. vue.watch(() => props.date, async () => {
  26173. var _a, _b;
  26174. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26175. await vue.nextTick();
  26176. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26177. }
  26178. });
  26179. expose({
  26180. focus
  26181. });
  26182. return (_ctx, _cache) => {
  26183. return vue.openBlock(), vue.createElementBlock("table", {
  26184. role: "grid",
  26185. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  26186. class: vue.normalizeClass(vue.unref(ns).b()),
  26187. onClick: handleMonthTableClick,
  26188. onMousemove: handleMouseMove
  26189. }, [
  26190. vue.createElementVNode("tbody", {
  26191. ref_key: "tbodyRef",
  26192. ref: tbodyRef
  26193. }, [
  26194. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  26195. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  26196. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  26197. return vue.openBlock(), vue.createElementBlock("td", {
  26198. key: key_,
  26199. ref_for: true,
  26200. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26201. class: vue.normalizeClass(getCellStyle(cell)),
  26202. "aria-selected": `${isSelectedCell(cell)}`,
  26203. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  26204. tabindex: isSelectedCell(cell) ? 0 : -1,
  26205. onKeydown: [
  26206. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  26207. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  26208. ]
  26209. }, [
  26210. vue.createVNode(vue.unref(ElDatePickerCell), {
  26211. cell: {
  26212. ...cell,
  26213. renderText: vue.unref(t)("el.datepicker.months." + months.value[cell.text])
  26214. }
  26215. }, null, 8, ["cell"])
  26216. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26217. }), 128))
  26218. ]);
  26219. }), 128))
  26220. ], 512)
  26221. ], 42, ["aria-label"]);
  26222. };
  26223. }
  26224. });
  26225. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "basic-month-table.vue"]]);
  26226. const basicYearTableProps = buildProps({
  26227. ...datePickerSharedProps,
  26228. selectionMode: selectionModeWithDefault("year")
  26229. });
  26230. const _sfc_main$1u = /* @__PURE__ */ vue.defineComponent({
  26231. __name: "basic-year-table",
  26232. props: basicYearTableProps,
  26233. emits: ["changerange", "pick", "select"],
  26234. setup(__props, { expose, emit }) {
  26235. const props = __props;
  26236. const datesInYear = (year, lang2) => {
  26237. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  26238. const lastDay = firstDay.endOf("year");
  26239. const numOfDays = lastDay.dayOfYear();
  26240. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  26241. };
  26242. const ns = useNamespace("year-table");
  26243. const { t, lang } = useLocale();
  26244. const tbodyRef = vue.ref();
  26245. const currentCellRef = vue.ref();
  26246. const startYear = vue.computed(() => {
  26247. return Math.floor(props.date.year() / 10) * 10;
  26248. });
  26249. const tableRows = vue.ref([[], [], []]);
  26250. const lastRow = vue.ref();
  26251. const lastColumn = vue.ref();
  26252. const rows = vue.computed(() => {
  26253. var _a;
  26254. const rows2 = tableRows.value;
  26255. const now = dayjs().locale(lang.value).startOf("year");
  26256. for (let i = 0; i < 3; i++) {
  26257. const row = rows2[i];
  26258. for (let j = 0; j < 4; j++) {
  26259. if (i * 4 + j >= 10) {
  26260. break;
  26261. }
  26262. let cell = row[j];
  26263. if (!cell) {
  26264. cell = {
  26265. row: i,
  26266. column: j,
  26267. type: "normal",
  26268. inRange: false,
  26269. start: false,
  26270. end: false,
  26271. text: -1,
  26272. disabled: false
  26273. };
  26274. }
  26275. cell.type = "normal";
  26276. const index = i * 4 + j + startYear.value;
  26277. const calTime = dayjs().year(index);
  26278. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26279. cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "year") && calEndDate && calTime.isSameOrBefore(calEndDate, "year")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "year") && calEndDate && calTime.isSameOrAfter(calEndDate, "year"));
  26280. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26281. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26282. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26283. } else {
  26284. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26285. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26286. }
  26287. const isToday = now.isSame(calTime);
  26288. if (isToday) {
  26289. cell.type = "today";
  26290. }
  26291. cell.text = index;
  26292. const cellDate = calTime.toDate();
  26293. cell.disabled = props.disabledDate && props.disabledDate(cellDate) || false;
  26294. row[j] = cell;
  26295. }
  26296. }
  26297. return rows2;
  26298. });
  26299. const focus = () => {
  26300. var _a;
  26301. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26302. };
  26303. const getCellKls = (cell) => {
  26304. const kls = {};
  26305. const today = dayjs().locale(lang.value);
  26306. const year = cell.text;
  26307. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  26308. kls.today = today.year() === year;
  26309. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  26310. if (cell.inRange) {
  26311. kls["in-range"] = true;
  26312. if (cell.start) {
  26313. kls["start-date"] = true;
  26314. }
  26315. if (cell.end) {
  26316. kls["end-date"] = true;
  26317. }
  26318. }
  26319. return kls;
  26320. };
  26321. const isSelectedCell = (cell) => {
  26322. const year = cell.text;
  26323. return castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  26324. };
  26325. const handleYearTableClick = (event) => {
  26326. var _a;
  26327. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26328. if (!target || !target.textContent || hasClass(target, "disabled"))
  26329. return;
  26330. const column = target.cellIndex;
  26331. const row = target.parentNode.rowIndex;
  26332. const selectedYear = row * 4 + column + startYear.value;
  26333. const newDate = dayjs().year(selectedYear);
  26334. if (props.selectionMode === "range") {
  26335. if (!props.rangeState.selecting) {
  26336. emit("pick", { minDate: newDate, maxDate: null });
  26337. emit("select", true);
  26338. } else {
  26339. if (props.minDate && newDate >= props.minDate) {
  26340. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26341. } else {
  26342. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26343. }
  26344. emit("select", false);
  26345. }
  26346. } else if (props.selectionMode === "years") {
  26347. if (event.type === "keydown") {
  26348. emit("pick", castArray(props.parsedValue), false);
  26349. return;
  26350. }
  26351. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  26352. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
  26353. emit("pick", newValue);
  26354. } else {
  26355. emit("pick", selectedYear);
  26356. }
  26357. };
  26358. const handleMouseMove = (event) => {
  26359. var _a;
  26360. if (!props.rangeState.selecting)
  26361. return;
  26362. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26363. if (!target)
  26364. return;
  26365. const row = target.parentNode.rowIndex;
  26366. const column = target.cellIndex;
  26367. if (rows.value[row][column].disabled)
  26368. return;
  26369. if (row !== lastRow.value || column !== lastColumn.value) {
  26370. lastRow.value = row;
  26371. lastColumn.value = column;
  26372. emit("changerange", {
  26373. selecting: true,
  26374. endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
  26375. });
  26376. }
  26377. };
  26378. vue.watch(() => props.date, async () => {
  26379. var _a, _b;
  26380. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26381. await vue.nextTick();
  26382. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26383. }
  26384. });
  26385. expose({
  26386. focus
  26387. });
  26388. return (_ctx, _cache) => {
  26389. return vue.openBlock(), vue.createElementBlock("table", {
  26390. role: "grid",
  26391. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  26392. class: vue.normalizeClass(vue.unref(ns).b()),
  26393. onClick: handleYearTableClick,
  26394. onMousemove: handleMouseMove
  26395. }, [
  26396. vue.createElementVNode("tbody", {
  26397. ref_key: "tbodyRef",
  26398. ref: tbodyRef
  26399. }, [
  26400. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  26401. return vue.openBlock(), vue.createElementBlock("tr", { key: rowKey }, [
  26402. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, cellKey) => {
  26403. return vue.openBlock(), vue.createElementBlock("td", {
  26404. key: `${rowKey}_${cellKey}`,
  26405. ref_for: true,
  26406. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26407. class: vue.normalizeClass(["available", getCellKls(cell)]),
  26408. "aria-selected": isSelectedCell(cell),
  26409. "aria-label": String(cell.text),
  26410. tabindex: isSelectedCell(cell) ? 0 : -1,
  26411. onKeydown: [
  26412. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  26413. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  26414. ]
  26415. }, [
  26416. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26417. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26418. }), 128))
  26419. ]);
  26420. }), 128))
  26421. ], 512)
  26422. ], 42, ["aria-label"]);
  26423. };
  26424. }
  26425. });
  26426. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "basic-year-table.vue"]]);
  26427. const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
  26428. __name: "panel-date-pick",
  26429. props: panelDatePickProps,
  26430. emits: ["pick", "set-picker-option", "panel-change"],
  26431. setup(__props, { emit: contextEmit }) {
  26432. const props = __props;
  26433. const timeWithinRange = (_, __, ___) => true;
  26434. const ppNs = useNamespace("picker-panel");
  26435. const dpNs = useNamespace("date-picker");
  26436. const attrs = vue.useAttrs();
  26437. const slots = vue.useSlots();
  26438. const { t, lang } = useLocale();
  26439. const pickerBase = vue.inject("EP_PICKER_BASE");
  26440. const popper = vue.inject(TOOLTIP_INJECTION_KEY);
  26441. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  26442. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  26443. const currentViewRef = vue.ref();
  26444. const innerDate = vue.ref(dayjs().locale(lang.value));
  26445. const isChangeToNow = vue.ref(false);
  26446. let isShortcut = false;
  26447. const defaultTimeD = vue.computed(() => {
  26448. return dayjs(defaultTime).locale(lang.value);
  26449. });
  26450. const month = vue.computed(() => {
  26451. return innerDate.value.month();
  26452. });
  26453. const year = vue.computed(() => {
  26454. return innerDate.value.year();
  26455. });
  26456. const selectableRange = vue.ref([]);
  26457. const userInputDate = vue.ref(null);
  26458. const userInputTime = vue.ref(null);
  26459. const checkDateWithinRange = (date) => {
  26460. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  26461. };
  26462. const formatEmit = (emitDayjs) => {
  26463. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  26464. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  26465. }
  26466. if (showTime.value)
  26467. return emitDayjs.millisecond(0);
  26468. return emitDayjs.startOf("day");
  26469. };
  26470. const emit = (value, ...args) => {
  26471. if (!value) {
  26472. contextEmit("pick", value, ...args);
  26473. } else if (isArray$1(value)) {
  26474. const dates = value.map(formatEmit);
  26475. contextEmit("pick", dates, ...args);
  26476. } else {
  26477. contextEmit("pick", formatEmit(value), ...args);
  26478. }
  26479. userInputDate.value = null;
  26480. userInputTime.value = null;
  26481. isChangeToNow.value = false;
  26482. isShortcut = false;
  26483. };
  26484. const handleDatePick = async (value, keepOpen) => {
  26485. if (selectionMode.value === "date") {
  26486. value = value;
  26487. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  26488. if (!checkDateWithinRange(newDate)) {
  26489. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  26490. }
  26491. innerDate.value = newDate;
  26492. emit(newDate, showTime.value || keepOpen);
  26493. if (props.type === "datetime") {
  26494. await vue.nextTick();
  26495. handleFocusPicker();
  26496. }
  26497. } else if (selectionMode.value === "week") {
  26498. emit(value.date);
  26499. } else if (selectionMode.value === "dates") {
  26500. emit(value, true);
  26501. }
  26502. };
  26503. const moveByMonth = (forward) => {
  26504. const action = forward ? "add" : "subtract";
  26505. innerDate.value = innerDate.value[action](1, "month");
  26506. handlePanelChange("month");
  26507. };
  26508. const moveByYear = (forward) => {
  26509. const currentDate = innerDate.value;
  26510. const action = forward ? "add" : "subtract";
  26511. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  26512. handlePanelChange("year");
  26513. };
  26514. const currentView = vue.ref("date");
  26515. const yearLabel = vue.computed(() => {
  26516. const yearTranslation = t("el.datepicker.year");
  26517. if (currentView.value === "year") {
  26518. const startYear = Math.floor(year.value / 10) * 10;
  26519. if (yearTranslation) {
  26520. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  26521. }
  26522. return `${startYear} - ${startYear + 9}`;
  26523. }
  26524. return `${year.value} ${yearTranslation}`;
  26525. });
  26526. const handleShortcutClick = (shortcut) => {
  26527. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26528. if (shortcutValue) {
  26529. isShortcut = true;
  26530. emit(dayjs(shortcutValue).locale(lang.value));
  26531. return;
  26532. }
  26533. if (shortcut.onClick) {
  26534. shortcut.onClick({
  26535. attrs,
  26536. slots,
  26537. emit: contextEmit
  26538. });
  26539. }
  26540. };
  26541. const selectionMode = vue.computed(() => {
  26542. const { type } = props;
  26543. if (["week", "month", "months", "year", "years", "dates"].includes(type))
  26544. return type;
  26545. return "date";
  26546. });
  26547. const isMultipleType = vue.computed(() => {
  26548. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  26549. });
  26550. const keyboardMode = vue.computed(() => {
  26551. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  26552. });
  26553. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  26554. const handleMonthPick = async (month2, keepOpen) => {
  26555. if (selectionMode.value === "month") {
  26556. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26557. emit(innerDate.value, false);
  26558. } else if (selectionMode.value === "months") {
  26559. emit(month2, keepOpen != null ? keepOpen : true);
  26560. } else {
  26561. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26562. currentView.value = "date";
  26563. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26564. emit(innerDate.value, true);
  26565. await vue.nextTick();
  26566. handleFocusPicker();
  26567. }
  26568. }
  26569. handlePanelChange("month");
  26570. };
  26571. const handleYearPick = async (year2, keepOpen) => {
  26572. if (selectionMode.value === "year") {
  26573. const data = innerDate.value.startOf("year").year(year2);
  26574. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26575. emit(innerDate.value, false);
  26576. } else if (selectionMode.value === "years") {
  26577. emit(year2, keepOpen != null ? keepOpen : true);
  26578. } else {
  26579. const data = innerDate.value.year(year2);
  26580. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26581. currentView.value = "month";
  26582. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26583. emit(innerDate.value, true);
  26584. await vue.nextTick();
  26585. handleFocusPicker();
  26586. }
  26587. }
  26588. handlePanelChange("year");
  26589. };
  26590. const showPicker = async (view) => {
  26591. currentView.value = view;
  26592. await vue.nextTick();
  26593. handleFocusPicker();
  26594. };
  26595. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  26596. const footerVisible = vue.computed(() => {
  26597. const showDateFooter = showTime.value || selectionMode.value === "dates";
  26598. const showYearFooter = selectionMode.value === "years";
  26599. const showMonthFooter = selectionMode.value === "months";
  26600. const isDateView = currentView.value === "date";
  26601. const isYearView = currentView.value === "year";
  26602. const isMonthView = currentView.value === "month";
  26603. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  26604. });
  26605. const disabledConfirm = vue.computed(() => {
  26606. if (!disabledDate)
  26607. return false;
  26608. if (!props.parsedValue)
  26609. return true;
  26610. if (isArray$1(props.parsedValue)) {
  26611. return disabledDate(props.parsedValue[0].toDate());
  26612. }
  26613. return disabledDate(props.parsedValue.toDate());
  26614. });
  26615. const onConfirm = () => {
  26616. if (isMultipleType.value) {
  26617. emit(props.parsedValue);
  26618. } else {
  26619. let result = props.parsedValue;
  26620. if (!result) {
  26621. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  26622. const defaultValueD = getDefaultValue();
  26623. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  26624. }
  26625. innerDate.value = result;
  26626. emit(result);
  26627. }
  26628. };
  26629. const disabledNow = vue.computed(() => {
  26630. if (!disabledDate)
  26631. return false;
  26632. return disabledDate(dayjs().locale(lang.value).toDate());
  26633. });
  26634. const changeToNow = () => {
  26635. const now = dayjs().locale(lang.value);
  26636. const nowDate = now.toDate();
  26637. isChangeToNow.value = true;
  26638. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  26639. innerDate.value = dayjs().locale(lang.value);
  26640. emit(innerDate.value);
  26641. }
  26642. };
  26643. const timeFormat = vue.computed(() => {
  26644. return props.timeFormat || extractTimeFormat(props.format);
  26645. });
  26646. const dateFormat = vue.computed(() => {
  26647. return props.dateFormat || extractDateFormat(props.format);
  26648. });
  26649. const visibleTime = vue.computed(() => {
  26650. if (userInputTime.value)
  26651. return userInputTime.value;
  26652. if (!props.parsedValue && !defaultValue.value)
  26653. return;
  26654. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  26655. });
  26656. const visibleDate = vue.computed(() => {
  26657. if (userInputDate.value)
  26658. return userInputDate.value;
  26659. if (!props.parsedValue && !defaultValue.value)
  26660. return;
  26661. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  26662. });
  26663. const timePickerVisible = vue.ref(false);
  26664. const onTimePickerInputFocus = () => {
  26665. timePickerVisible.value = true;
  26666. };
  26667. const handleTimePickClose = () => {
  26668. timePickerVisible.value = false;
  26669. };
  26670. const getUnits = (date) => {
  26671. return {
  26672. hour: date.hour(),
  26673. minute: date.minute(),
  26674. second: date.second(),
  26675. year: date.year(),
  26676. month: date.month(),
  26677. date: date.date()
  26678. };
  26679. };
  26680. const handleTimePick = (value, visible, first) => {
  26681. const { hour, minute, second } = getUnits(value);
  26682. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  26683. innerDate.value = newDate;
  26684. emit(innerDate.value, true);
  26685. if (!first) {
  26686. timePickerVisible.value = visible;
  26687. }
  26688. };
  26689. const handleVisibleTimeChange = (value) => {
  26690. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  26691. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  26692. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  26693. innerDate.value = newDate.year(year2).month(month2).date(date);
  26694. userInputTime.value = null;
  26695. timePickerVisible.value = false;
  26696. emit(innerDate.value, true);
  26697. }
  26698. };
  26699. const handleVisibleDateChange = (value) => {
  26700. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  26701. if (newDate.isValid()) {
  26702. if (disabledDate && disabledDate(newDate.toDate())) {
  26703. return;
  26704. }
  26705. const { hour, minute, second } = getUnits(innerDate.value);
  26706. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  26707. userInputDate.value = null;
  26708. emit(innerDate.value, true);
  26709. }
  26710. };
  26711. const isValidValue = (date) => {
  26712. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  26713. };
  26714. const formatToString = (value) => {
  26715. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  26716. };
  26717. const parseUserInput = (value) => {
  26718. return dayjs(value, props.format).locale(lang.value);
  26719. };
  26720. const getDefaultValue = () => {
  26721. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  26722. if (!defaultValue.value) {
  26723. const defaultTimeDValue = defaultTimeD.value;
  26724. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  26725. }
  26726. return parseDate;
  26727. };
  26728. const handleFocusPicker = async () => {
  26729. var _a;
  26730. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  26731. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  26732. if (selectionMode.value === "week") {
  26733. handleKeyControl(EVENT_CODE.down);
  26734. }
  26735. }
  26736. };
  26737. const handleKeydownTable = (event) => {
  26738. const { code } = event;
  26739. const validCode = [
  26740. EVENT_CODE.up,
  26741. EVENT_CODE.down,
  26742. EVENT_CODE.left,
  26743. EVENT_CODE.right,
  26744. EVENT_CODE.home,
  26745. EVENT_CODE.end,
  26746. EVENT_CODE.pageUp,
  26747. EVENT_CODE.pageDown
  26748. ];
  26749. if (validCode.includes(code)) {
  26750. handleKeyControl(code);
  26751. event.stopPropagation();
  26752. event.preventDefault();
  26753. }
  26754. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  26755. event.preventDefault();
  26756. emit(innerDate.value, false);
  26757. }
  26758. };
  26759. const handleKeyControl = (code) => {
  26760. var _a;
  26761. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  26762. const mapping = {
  26763. year: {
  26764. [up]: -4,
  26765. [down]: 4,
  26766. [left]: -1,
  26767. [right]: 1,
  26768. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  26769. },
  26770. month: {
  26771. [up]: -4,
  26772. [down]: 4,
  26773. [left]: -1,
  26774. [right]: 1,
  26775. offset: (date, step) => date.setMonth(date.getMonth() + step)
  26776. },
  26777. week: {
  26778. [up]: -1,
  26779. [down]: 1,
  26780. [left]: -1,
  26781. [right]: 1,
  26782. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  26783. },
  26784. date: {
  26785. [up]: -7,
  26786. [down]: 7,
  26787. [left]: -1,
  26788. [right]: 1,
  26789. [home]: (date) => -date.getDay(),
  26790. [end]: (date) => -date.getDay() + 6,
  26791. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  26792. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  26793. offset: (date, step) => date.setDate(date.getDate() + step)
  26794. }
  26795. };
  26796. const newDate = innerDate.value.toDate();
  26797. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  26798. const map = mapping[keyboardMode.value];
  26799. if (!map)
  26800. return;
  26801. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  26802. if (disabledDate && disabledDate(newDate)) {
  26803. break;
  26804. }
  26805. const result = dayjs(newDate).locale(lang.value);
  26806. innerDate.value = result;
  26807. contextEmit("pick", result, true);
  26808. break;
  26809. }
  26810. };
  26811. const handlePanelChange = (mode) => {
  26812. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  26813. };
  26814. vue.watch(() => selectionMode.value, (val) => {
  26815. if (["month", "year"].includes(val)) {
  26816. currentView.value = val;
  26817. return;
  26818. } else if (val === "years") {
  26819. currentView.value = "year";
  26820. return;
  26821. } else if (val === "months") {
  26822. currentView.value = "month";
  26823. return;
  26824. }
  26825. currentView.value = "date";
  26826. }, { immediate: true });
  26827. vue.watch(() => currentView.value, () => {
  26828. popper == null ? void 0 : popper.updatePopper();
  26829. });
  26830. vue.watch(() => defaultValue.value, (val) => {
  26831. if (val) {
  26832. innerDate.value = getDefaultValue();
  26833. }
  26834. }, { immediate: true });
  26835. vue.watch(() => props.parsedValue, (val) => {
  26836. if (val) {
  26837. if (isMultipleType.value)
  26838. return;
  26839. if (Array.isArray(val))
  26840. return;
  26841. innerDate.value = val;
  26842. } else {
  26843. innerDate.value = getDefaultValue();
  26844. }
  26845. }, { immediate: true });
  26846. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  26847. contextEmit("set-picker-option", ["formatToString", formatToString]);
  26848. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  26849. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  26850. return (_ctx, _cache) => {
  26851. return vue.openBlock(), vue.createElementBlock("div", {
  26852. class: vue.normalizeClass([
  26853. vue.unref(ppNs).b(),
  26854. vue.unref(dpNs).b(),
  26855. {
  26856. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  26857. "has-time": vue.unref(showTime)
  26858. }
  26859. ])
  26860. }, [
  26861. vue.createElementVNode("div", {
  26862. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  26863. }, [
  26864. vue.renderSlot(_ctx.$slots, "sidebar", {
  26865. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  26866. }),
  26867. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  26868. key: 0,
  26869. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  26870. }, [
  26871. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  26872. return vue.openBlock(), vue.createElementBlock("button", {
  26873. key,
  26874. type: "button",
  26875. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  26876. onClick: ($event) => handleShortcutClick(shortcut)
  26877. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  26878. }), 128))
  26879. ], 2)) : vue.createCommentVNode("v-if", true),
  26880. vue.createElementVNode("div", {
  26881. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  26882. }, [
  26883. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  26884. key: 0,
  26885. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  26886. }, [
  26887. vue.createElementVNode("span", {
  26888. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  26889. }, [
  26890. vue.createVNode(vue.unref(ElInput), {
  26891. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  26892. "model-value": vue.unref(visibleDate),
  26893. size: "small",
  26894. "validate-event": false,
  26895. onInput: (val) => userInputDate.value = val,
  26896. onChange: handleVisibleDateChange
  26897. }, null, 8, ["placeholder", "model-value", "onInput"])
  26898. ], 2),
  26899. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  26900. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  26901. }, [
  26902. vue.createVNode(vue.unref(ElInput), {
  26903. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  26904. "model-value": vue.unref(visibleTime),
  26905. size: "small",
  26906. "validate-event": false,
  26907. onFocus: onTimePickerInputFocus,
  26908. onInput: (val) => userInputTime.value = val,
  26909. onChange: handleVisibleTimeChange
  26910. }, null, 8, ["placeholder", "model-value", "onInput"]),
  26911. vue.createVNode(vue.unref(TimePickPanel), {
  26912. visible: timePickerVisible.value,
  26913. format: vue.unref(timeFormat),
  26914. "parsed-value": innerDate.value,
  26915. onPick: handleTimePick
  26916. }, null, 8, ["visible", "format", "parsed-value"])
  26917. ], 2)), [
  26918. [vue.unref(ClickOutside), handleTimePickClose]
  26919. ])
  26920. ], 2)) : vue.createCommentVNode("v-if", true),
  26921. vue.withDirectives(vue.createElementVNode("div", {
  26922. class: vue.normalizeClass([
  26923. vue.unref(dpNs).e("header"),
  26924. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered")
  26925. ])
  26926. }, [
  26927. vue.createElementVNode("span", {
  26928. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  26929. }, [
  26930. vue.createElementVNode("button", {
  26931. type: "button",
  26932. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  26933. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  26934. onClick: ($event) => moveByYear(false)
  26935. }, [
  26936. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  26937. vue.createVNode(vue.unref(ElIcon), null, {
  26938. default: vue.withCtx(() => [
  26939. vue.createVNode(vue.unref(d_arrow_left_default))
  26940. ]),
  26941. _: 1
  26942. })
  26943. ])
  26944. ], 10, ["aria-label", "onClick"]),
  26945. vue.withDirectives(vue.createElementVNode("button", {
  26946. type: "button",
  26947. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  26948. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  26949. onClick: ($event) => moveByMonth(false)
  26950. }, [
  26951. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  26952. vue.createVNode(vue.unref(ElIcon), null, {
  26953. default: vue.withCtx(() => [
  26954. vue.createVNode(vue.unref(arrow_left_default))
  26955. ]),
  26956. _: 1
  26957. })
  26958. ])
  26959. ], 10, ["aria-label", "onClick"]), [
  26960. [vue.vShow, currentView.value === "date"]
  26961. ])
  26962. ], 2),
  26963. vue.createElementVNode("span", {
  26964. role: "button",
  26965. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  26966. "aria-live": "polite",
  26967. tabindex: "0",
  26968. onKeydown: vue.withKeys(($event) => showPicker("year"), ["enter"]),
  26969. onClick: ($event) => showPicker("year")
  26970. }, vue.toDisplayString(vue.unref(yearLabel)), 43, ["onKeydown", "onClick"]),
  26971. vue.withDirectives(vue.createElementVNode("span", {
  26972. role: "button",
  26973. "aria-live": "polite",
  26974. tabindex: "0",
  26975. class: vue.normalizeClass([
  26976. vue.unref(dpNs).e("header-label"),
  26977. { active: currentView.value === "month" }
  26978. ]),
  26979. onKeydown: vue.withKeys(($event) => showPicker("month"), ["enter"]),
  26980. onClick: ($event) => showPicker("month")
  26981. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
  26982. [vue.vShow, currentView.value === "date"]
  26983. ]),
  26984. vue.createElementVNode("span", {
  26985. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  26986. }, [
  26987. vue.withDirectives(vue.createElementVNode("button", {
  26988. type: "button",
  26989. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  26990. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  26991. onClick: ($event) => moveByMonth(true)
  26992. }, [
  26993. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  26994. vue.createVNode(vue.unref(ElIcon), null, {
  26995. default: vue.withCtx(() => [
  26996. vue.createVNode(vue.unref(arrow_right_default))
  26997. ]),
  26998. _: 1
  26999. })
  27000. ])
  27001. ], 10, ["aria-label", "onClick"]), [
  27002. [vue.vShow, currentView.value === "date"]
  27003. ]),
  27004. vue.createElementVNode("button", {
  27005. type: "button",
  27006. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27007. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27008. onClick: ($event) => moveByYear(true)
  27009. }, [
  27010. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  27011. vue.createVNode(vue.unref(ElIcon), null, {
  27012. default: vue.withCtx(() => [
  27013. vue.createVNode(vue.unref(d_arrow_right_default))
  27014. ]),
  27015. _: 1
  27016. })
  27017. ])
  27018. ], 10, ["aria-label", "onClick"])
  27019. ], 2)
  27020. ], 2), [
  27021. [vue.vShow, currentView.value !== "time"]
  27022. ]),
  27023. vue.createElementVNode("div", {
  27024. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  27025. onKeydown: handleKeydownTable
  27026. }, [
  27027. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  27028. key: 0,
  27029. ref_key: "currentViewRef",
  27030. ref: currentViewRef,
  27031. "selection-mode": vue.unref(selectionMode),
  27032. date: innerDate.value,
  27033. "parsed-value": _ctx.parsedValue,
  27034. "disabled-date": vue.unref(disabledDate),
  27035. "cell-class-name": vue.unref(cellClassName),
  27036. onPick: handleDatePick
  27037. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  27038. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  27039. key: 1,
  27040. ref_key: "currentViewRef",
  27041. ref: currentViewRef,
  27042. "selection-mode": vue.unref(selectionMode),
  27043. date: innerDate.value,
  27044. "disabled-date": vue.unref(disabledDate),
  27045. "parsed-value": _ctx.parsedValue,
  27046. onPick: handleYearPick
  27047. }, null, 8, ["selection-mode", "date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true),
  27048. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  27049. key: 2,
  27050. ref_key: "currentViewRef",
  27051. ref: currentViewRef,
  27052. "selection-mode": vue.unref(selectionMode),
  27053. date: innerDate.value,
  27054. "parsed-value": _ctx.parsedValue,
  27055. "disabled-date": vue.unref(disabledDate),
  27056. onPick: handleMonthPick
  27057. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true)
  27058. ], 34)
  27059. ], 2)
  27060. ], 2),
  27061. vue.withDirectives(vue.createElementVNode("div", {
  27062. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  27063. }, [
  27064. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  27065. text: "",
  27066. size: "small",
  27067. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27068. disabled: vue.unref(disabledNow),
  27069. onClick: changeToNow
  27070. }, {
  27071. default: vue.withCtx(() => [
  27072. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  27073. ]),
  27074. _: 1
  27075. }, 8, ["class", "disabled"]), [
  27076. [vue.vShow, !vue.unref(isMultipleType)]
  27077. ]),
  27078. vue.createVNode(vue.unref(ElButton), {
  27079. plain: "",
  27080. size: "small",
  27081. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27082. disabled: vue.unref(disabledConfirm),
  27083. onClick: onConfirm
  27084. }, {
  27085. default: vue.withCtx(() => [
  27086. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  27087. ]),
  27088. _: 1
  27089. }, 8, ["class", "disabled"])
  27090. ], 2), [
  27091. [vue.vShow, vue.unref(footerVisible)]
  27092. ])
  27093. ], 2);
  27094. };
  27095. }
  27096. });
  27097. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "panel-date-pick.vue"]]);
  27098. const panelDateRangeProps = buildProps({
  27099. ...panelSharedProps,
  27100. ...panelRangeSharedProps,
  27101. visible: Boolean
  27102. });
  27103. const useShortcut = (lang) => {
  27104. const { emit } = vue.getCurrentInstance();
  27105. const attrs = vue.useAttrs();
  27106. const slots = vue.useSlots();
  27107. const handleShortcutClick = (shortcut) => {
  27108. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  27109. if (shortcutValues) {
  27110. emit("pick", [
  27111. dayjs(shortcutValues[0]).locale(lang.value),
  27112. dayjs(shortcutValues[1]).locale(lang.value)
  27113. ]);
  27114. return;
  27115. }
  27116. if (shortcut.onClick) {
  27117. shortcut.onClick({
  27118. attrs,
  27119. slots,
  27120. emit
  27121. });
  27122. }
  27123. };
  27124. return handleShortcutClick;
  27125. };
  27126. const useRangePicker = (props, {
  27127. defaultValue,
  27128. leftDate,
  27129. rightDate,
  27130. unit,
  27131. onParsedValueChanged
  27132. }) => {
  27133. const { emit } = vue.getCurrentInstance();
  27134. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  27135. const drpNs = useNamespace("date-range-picker");
  27136. const { t, lang } = useLocale();
  27137. const handleShortcutClick = useShortcut(lang);
  27138. const minDate = vue.ref();
  27139. const maxDate = vue.ref();
  27140. const rangeState = vue.ref({
  27141. endDate: null,
  27142. selecting: false
  27143. });
  27144. const handleChangeRange = (val) => {
  27145. rangeState.value = val;
  27146. };
  27147. const handleRangeConfirm = (visible = false) => {
  27148. const _minDate = vue.unref(minDate);
  27149. const _maxDate = vue.unref(maxDate);
  27150. if (isValidRange([_minDate, _maxDate])) {
  27151. emit("pick", [_minDate, _maxDate], visible);
  27152. }
  27153. };
  27154. const onSelect = (selecting) => {
  27155. rangeState.value.selecting = selecting;
  27156. if (!selecting) {
  27157. rangeState.value.endDate = null;
  27158. }
  27159. };
  27160. const onReset = (parsedValue) => {
  27161. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  27162. const [start, end] = parsedValue;
  27163. minDate.value = start;
  27164. leftDate.value = start;
  27165. maxDate.value = end;
  27166. onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate));
  27167. } else {
  27168. restoreDefault();
  27169. }
  27170. };
  27171. const restoreDefault = () => {
  27172. const [start, end] = getDefaultValue(vue.unref(defaultValue), {
  27173. lang: vue.unref(lang),
  27174. unit,
  27175. unlinkPanels: props.unlinkPanels
  27176. });
  27177. minDate.value = void 0;
  27178. maxDate.value = void 0;
  27179. leftDate.value = start;
  27180. rightDate.value = end;
  27181. };
  27182. vue.watch(defaultValue, (val) => {
  27183. if (val) {
  27184. restoreDefault();
  27185. }
  27186. }, { immediate: true });
  27187. vue.watch(() => props.parsedValue, onReset, { immediate: true });
  27188. return {
  27189. minDate,
  27190. maxDate,
  27191. rangeState,
  27192. lang,
  27193. ppNs: pickerNs,
  27194. drpNs,
  27195. handleChangeRange,
  27196. handleRangeConfirm,
  27197. handleShortcutClick,
  27198. onSelect,
  27199. onReset,
  27200. t
  27201. };
  27202. };
  27203. const unit$2 = "month";
  27204. const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
  27205. __name: "panel-date-range",
  27206. props: panelDateRangeProps,
  27207. emits: [
  27208. "pick",
  27209. "set-picker-option",
  27210. "calendar-change",
  27211. "panel-change"
  27212. ],
  27213. setup(__props, { emit }) {
  27214. const props = __props;
  27215. const pickerBase = vue.inject("EP_PICKER_BASE");
  27216. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  27217. const format = vue.toRef(pickerBase.props, "format");
  27218. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  27219. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  27220. const { lang } = useLocale();
  27221. const leftDate = vue.ref(dayjs().locale(lang.value));
  27222. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$2));
  27223. const {
  27224. minDate,
  27225. maxDate,
  27226. rangeState,
  27227. ppNs,
  27228. drpNs,
  27229. handleChangeRange,
  27230. handleRangeConfirm,
  27231. handleShortcutClick,
  27232. onSelect,
  27233. onReset,
  27234. t
  27235. } = useRangePicker(props, {
  27236. defaultValue,
  27237. leftDate,
  27238. rightDate,
  27239. unit: unit$2,
  27240. onParsedValueChanged
  27241. });
  27242. vue.watch(() => props.visible, (visible) => {
  27243. if (!visible && rangeState.value.selecting) {
  27244. onReset(props.parsedValue);
  27245. onSelect(false);
  27246. }
  27247. });
  27248. const dateUserInput = vue.ref({
  27249. min: null,
  27250. max: null
  27251. });
  27252. const timeUserInput = vue.ref({
  27253. min: null,
  27254. max: null
  27255. });
  27256. const leftLabel = vue.computed(() => {
  27257. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  27258. });
  27259. const rightLabel = vue.computed(() => {
  27260. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  27261. });
  27262. const leftYear = vue.computed(() => {
  27263. return leftDate.value.year();
  27264. });
  27265. const leftMonth = vue.computed(() => {
  27266. return leftDate.value.month();
  27267. });
  27268. const rightYear = vue.computed(() => {
  27269. return rightDate.value.year();
  27270. });
  27271. const rightMonth = vue.computed(() => {
  27272. return rightDate.value.month();
  27273. });
  27274. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  27275. const minVisibleDate = vue.computed(() => {
  27276. if (dateUserInput.value.min !== null)
  27277. return dateUserInput.value.min;
  27278. if (minDate.value)
  27279. return minDate.value.format(dateFormat.value);
  27280. return "";
  27281. });
  27282. const maxVisibleDate = vue.computed(() => {
  27283. if (dateUserInput.value.max !== null)
  27284. return dateUserInput.value.max;
  27285. if (maxDate.value || minDate.value)
  27286. return (maxDate.value || minDate.value).format(dateFormat.value);
  27287. return "";
  27288. });
  27289. const minVisibleTime = vue.computed(() => {
  27290. if (timeUserInput.value.min !== null)
  27291. return timeUserInput.value.min;
  27292. if (minDate.value)
  27293. return minDate.value.format(timeFormat.value);
  27294. return "";
  27295. });
  27296. const maxVisibleTime = vue.computed(() => {
  27297. if (timeUserInput.value.max !== null)
  27298. return timeUserInput.value.max;
  27299. if (maxDate.value || minDate.value)
  27300. return (maxDate.value || minDate.value).format(timeFormat.value);
  27301. return "";
  27302. });
  27303. const timeFormat = vue.computed(() => {
  27304. return props.timeFormat || extractTimeFormat(format.value);
  27305. });
  27306. const dateFormat = vue.computed(() => {
  27307. return props.dateFormat || extractDateFormat(format.value);
  27308. });
  27309. const isValidValue = (date) => {
  27310. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  27311. };
  27312. const leftPrevYear = () => {
  27313. leftDate.value = leftDate.value.subtract(1, "year");
  27314. if (!props.unlinkPanels) {
  27315. rightDate.value = leftDate.value.add(1, "month");
  27316. }
  27317. handlePanelChange("year");
  27318. };
  27319. const leftPrevMonth = () => {
  27320. leftDate.value = leftDate.value.subtract(1, "month");
  27321. if (!props.unlinkPanels) {
  27322. rightDate.value = leftDate.value.add(1, "month");
  27323. }
  27324. handlePanelChange("month");
  27325. };
  27326. const rightNextYear = () => {
  27327. if (!props.unlinkPanels) {
  27328. leftDate.value = leftDate.value.add(1, "year");
  27329. rightDate.value = leftDate.value.add(1, "month");
  27330. } else {
  27331. rightDate.value = rightDate.value.add(1, "year");
  27332. }
  27333. handlePanelChange("year");
  27334. };
  27335. const rightNextMonth = () => {
  27336. if (!props.unlinkPanels) {
  27337. leftDate.value = leftDate.value.add(1, "month");
  27338. rightDate.value = leftDate.value.add(1, "month");
  27339. } else {
  27340. rightDate.value = rightDate.value.add(1, "month");
  27341. }
  27342. handlePanelChange("month");
  27343. };
  27344. const leftNextYear = () => {
  27345. leftDate.value = leftDate.value.add(1, "year");
  27346. handlePanelChange("year");
  27347. };
  27348. const leftNextMonth = () => {
  27349. leftDate.value = leftDate.value.add(1, "month");
  27350. handlePanelChange("month");
  27351. };
  27352. const rightPrevYear = () => {
  27353. rightDate.value = rightDate.value.subtract(1, "year");
  27354. handlePanelChange("year");
  27355. };
  27356. const rightPrevMonth = () => {
  27357. rightDate.value = rightDate.value.subtract(1, "month");
  27358. handlePanelChange("month");
  27359. };
  27360. const handlePanelChange = (mode) => {
  27361. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  27362. };
  27363. const enableMonthArrow = vue.computed(() => {
  27364. const nextMonth = (leftMonth.value + 1) % 12;
  27365. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  27366. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  27367. });
  27368. const enableYearArrow = vue.computed(() => {
  27369. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  27370. });
  27371. const btnDisabled = vue.computed(() => {
  27372. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  27373. });
  27374. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  27375. const formatEmit = (emitDayjs, index) => {
  27376. if (!emitDayjs)
  27377. return;
  27378. if (defaultTime) {
  27379. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  27380. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  27381. }
  27382. return emitDayjs;
  27383. };
  27384. const handleRangePick = (val, close = true) => {
  27385. const min_ = val.minDate;
  27386. const max_ = val.maxDate;
  27387. const minDate_ = formatEmit(min_, 0);
  27388. const maxDate_ = formatEmit(max_, 1);
  27389. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27390. return;
  27391. }
  27392. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  27393. maxDate.value = maxDate_;
  27394. minDate.value = minDate_;
  27395. if (!close || showTime.value)
  27396. return;
  27397. handleRangeConfirm();
  27398. };
  27399. const minTimePickerVisible = vue.ref(false);
  27400. const maxTimePickerVisible = vue.ref(false);
  27401. const handleMinTimeClose = () => {
  27402. minTimePickerVisible.value = false;
  27403. };
  27404. const handleMaxTimeClose = () => {
  27405. maxTimePickerVisible.value = false;
  27406. };
  27407. const handleDateInput = (value, type) => {
  27408. dateUserInput.value[type] = value;
  27409. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  27410. if (parsedValueD.isValid()) {
  27411. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  27412. return;
  27413. }
  27414. if (type === "min") {
  27415. leftDate.value = parsedValueD;
  27416. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27417. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  27418. rightDate.value = parsedValueD.add(1, "month");
  27419. maxDate.value = minDate.value.add(1, "month");
  27420. }
  27421. } else {
  27422. rightDate.value = parsedValueD;
  27423. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27424. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  27425. leftDate.value = parsedValueD.subtract(1, "month");
  27426. minDate.value = maxDate.value.subtract(1, "month");
  27427. }
  27428. }
  27429. }
  27430. };
  27431. const handleDateChange = (_, type) => {
  27432. dateUserInput.value[type] = null;
  27433. };
  27434. const handleTimeInput = (value, type) => {
  27435. timeUserInput.value[type] = value;
  27436. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  27437. if (parsedValueD.isValid()) {
  27438. if (type === "min") {
  27439. minTimePickerVisible.value = true;
  27440. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27441. } else {
  27442. maxTimePickerVisible.value = true;
  27443. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27444. rightDate.value = maxDate.value;
  27445. }
  27446. }
  27447. };
  27448. const handleTimeChange = (value, type) => {
  27449. timeUserInput.value[type] = null;
  27450. if (type === "min") {
  27451. leftDate.value = minDate.value;
  27452. minTimePickerVisible.value = false;
  27453. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27454. maxDate.value = minDate.value;
  27455. }
  27456. } else {
  27457. rightDate.value = maxDate.value;
  27458. maxTimePickerVisible.value = false;
  27459. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27460. minDate.value = maxDate.value;
  27461. }
  27462. }
  27463. };
  27464. const handleMinTimePick = (value, visible, first) => {
  27465. if (timeUserInput.value.min)
  27466. return;
  27467. if (value) {
  27468. leftDate.value = value;
  27469. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27470. }
  27471. if (!first) {
  27472. minTimePickerVisible.value = visible;
  27473. }
  27474. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27475. maxDate.value = minDate.value;
  27476. rightDate.value = value;
  27477. }
  27478. };
  27479. const handleMaxTimePick = (value, visible, first) => {
  27480. if (timeUserInput.value.max)
  27481. return;
  27482. if (value) {
  27483. rightDate.value = value;
  27484. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27485. }
  27486. if (!first) {
  27487. maxTimePickerVisible.value = visible;
  27488. }
  27489. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27490. minDate.value = maxDate.value;
  27491. }
  27492. };
  27493. const handleClear = () => {
  27494. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  27495. lang: vue.unref(lang),
  27496. unit: "month",
  27497. unlinkPanels: props.unlinkPanels
  27498. })[0];
  27499. rightDate.value = leftDate.value.add(1, "month");
  27500. maxDate.value = void 0;
  27501. minDate.value = void 0;
  27502. emit("pick", null);
  27503. };
  27504. const formatToString = (value) => {
  27505. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  27506. };
  27507. const parseUserInput = (value) => {
  27508. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  27509. };
  27510. function onParsedValueChanged(minDate2, maxDate2) {
  27511. if (props.unlinkPanels && maxDate2) {
  27512. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  27513. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  27514. const maxDateYear = maxDate2.year();
  27515. const maxDateMonth = maxDate2.month();
  27516. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
  27517. } else {
  27518. rightDate.value = leftDate.value.add(1, unit$2);
  27519. if (maxDate2) {
  27520. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  27521. }
  27522. }
  27523. }
  27524. emit("set-picker-option", ["isValidValue", isValidValue]);
  27525. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  27526. emit("set-picker-option", ["formatToString", formatToString]);
  27527. emit("set-picker-option", ["handleClear", handleClear]);
  27528. return (_ctx, _cache) => {
  27529. return vue.openBlock(), vue.createElementBlock("div", {
  27530. class: vue.normalizeClass([
  27531. vue.unref(ppNs).b(),
  27532. vue.unref(drpNs).b(),
  27533. {
  27534. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  27535. "has-time": vue.unref(showTime)
  27536. }
  27537. ])
  27538. }, [
  27539. vue.createElementVNode("div", {
  27540. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27541. }, [
  27542. vue.renderSlot(_ctx.$slots, "sidebar", {
  27543. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27544. }),
  27545. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27546. key: 0,
  27547. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27548. }, [
  27549. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27550. return vue.openBlock(), vue.createElementBlock("button", {
  27551. key,
  27552. type: "button",
  27553. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27554. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  27555. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  27556. }), 128))
  27557. ], 2)) : vue.createCommentVNode("v-if", true),
  27558. vue.createElementVNode("div", {
  27559. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27560. }, [
  27561. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27562. key: 0,
  27563. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  27564. }, [
  27565. vue.createElementVNode("span", {
  27566. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  27567. }, [
  27568. vue.createElementVNode("span", {
  27569. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27570. }, [
  27571. vue.createVNode(vue.unref(ElInput), {
  27572. size: "small",
  27573. disabled: vue.unref(rangeState).selecting,
  27574. placeholder: vue.unref(t)("el.datepicker.startDate"),
  27575. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27576. "model-value": vue.unref(minVisibleDate),
  27577. "validate-event": false,
  27578. onInput: (val) => handleDateInput(val, "min"),
  27579. onChange: (val) => handleDateChange(val, "min")
  27580. }, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
  27581. ], 2),
  27582. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27583. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27584. }, [
  27585. vue.createVNode(vue.unref(ElInput), {
  27586. size: "small",
  27587. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27588. disabled: vue.unref(rangeState).selecting,
  27589. placeholder: vue.unref(t)("el.datepicker.startTime"),
  27590. "model-value": vue.unref(minVisibleTime),
  27591. "validate-event": false,
  27592. onFocus: ($event) => minTimePickerVisible.value = true,
  27593. onInput: (val) => handleTimeInput(val, "min"),
  27594. onChange: (val) => handleTimeChange(val, "min")
  27595. }, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
  27596. vue.createVNode(vue.unref(TimePickPanel), {
  27597. visible: minTimePickerVisible.value,
  27598. format: vue.unref(timeFormat),
  27599. "datetime-role": "start",
  27600. "parsed-value": leftDate.value,
  27601. onPick: handleMinTimePick
  27602. }, null, 8, ["visible", "format", "parsed-value"])
  27603. ], 2)), [
  27604. [vue.unref(ClickOutside), handleMinTimeClose]
  27605. ])
  27606. ], 2),
  27607. vue.createElementVNode("span", null, [
  27608. vue.createVNode(vue.unref(ElIcon), null, {
  27609. default: vue.withCtx(() => [
  27610. vue.createVNode(vue.unref(arrow_right_default))
  27611. ]),
  27612. _: 1
  27613. })
  27614. ]),
  27615. vue.createElementVNode("span", {
  27616. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  27617. }, [
  27618. vue.createElementVNode("span", {
  27619. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27620. }, [
  27621. vue.createVNode(vue.unref(ElInput), {
  27622. size: "small",
  27623. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27624. disabled: vue.unref(rangeState).selecting,
  27625. placeholder: vue.unref(t)("el.datepicker.endDate"),
  27626. "model-value": vue.unref(maxVisibleDate),
  27627. readonly: !vue.unref(minDate),
  27628. "validate-event": false,
  27629. onInput: (val) => handleDateInput(val, "max"),
  27630. onChange: (val) => handleDateChange(val, "max")
  27631. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
  27632. ], 2),
  27633. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27634. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27635. }, [
  27636. vue.createVNode(vue.unref(ElInput), {
  27637. size: "small",
  27638. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27639. disabled: vue.unref(rangeState).selecting,
  27640. placeholder: vue.unref(t)("el.datepicker.endTime"),
  27641. "model-value": vue.unref(maxVisibleTime),
  27642. readonly: !vue.unref(minDate),
  27643. "validate-event": false,
  27644. onFocus: ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true),
  27645. onInput: (val) => handleTimeInput(val, "max"),
  27646. onChange: (val) => handleTimeChange(val, "max")
  27647. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
  27648. vue.createVNode(vue.unref(TimePickPanel), {
  27649. "datetime-role": "end",
  27650. visible: maxTimePickerVisible.value,
  27651. format: vue.unref(timeFormat),
  27652. "parsed-value": rightDate.value,
  27653. onPick: handleMaxTimePick
  27654. }, null, 8, ["visible", "format", "parsed-value"])
  27655. ], 2)), [
  27656. [vue.unref(ClickOutside), handleMaxTimeClose]
  27657. ])
  27658. ], 2)
  27659. ], 2)) : vue.createCommentVNode("v-if", true),
  27660. vue.createElementVNode("div", {
  27661. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  27662. }, [
  27663. vue.createElementVNode("div", {
  27664. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27665. }, [
  27666. vue.createElementVNode("button", {
  27667. type: "button",
  27668. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  27669. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  27670. onClick: leftPrevYear
  27671. }, [
  27672. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27673. vue.createVNode(vue.unref(ElIcon), null, {
  27674. default: vue.withCtx(() => [
  27675. vue.createVNode(vue.unref(d_arrow_left_default))
  27676. ]),
  27677. _: 1
  27678. })
  27679. ])
  27680. ], 10, ["aria-label"]),
  27681. vue.createElementVNode("button", {
  27682. type: "button",
  27683. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  27684. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  27685. onClick: leftPrevMonth
  27686. }, [
  27687. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27688. vue.createVNode(vue.unref(ElIcon), null, {
  27689. default: vue.withCtx(() => [
  27690. vue.createVNode(vue.unref(arrow_left_default))
  27691. ]),
  27692. _: 1
  27693. })
  27694. ])
  27695. ], 10, ["aria-label"]),
  27696. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27697. key: 0,
  27698. type: "button",
  27699. disabled: !vue.unref(enableYearArrow),
  27700. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]),
  27701. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27702. onClick: leftNextYear
  27703. }, [
  27704. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  27705. vue.createVNode(vue.unref(ElIcon), null, {
  27706. default: vue.withCtx(() => [
  27707. vue.createVNode(vue.unref(d_arrow_right_default))
  27708. ]),
  27709. _: 1
  27710. })
  27711. ])
  27712. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  27713. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27714. key: 1,
  27715. type: "button",
  27716. disabled: !vue.unref(enableMonthArrow),
  27717. class: vue.normalizeClass([[
  27718. vue.unref(ppNs).e("icon-btn"),
  27719. { "is-disabled": !vue.unref(enableMonthArrow) }
  27720. ], "arrow-right"]),
  27721. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  27722. onClick: leftNextMonth
  27723. }, [
  27724. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  27725. vue.createVNode(vue.unref(ElIcon), null, {
  27726. default: vue.withCtx(() => [
  27727. vue.createVNode(vue.unref(arrow_right_default))
  27728. ]),
  27729. _: 1
  27730. })
  27731. ])
  27732. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  27733. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  27734. ], 2),
  27735. vue.createVNode(DateTable, {
  27736. "selection-mode": "range",
  27737. date: leftDate.value,
  27738. "min-date": vue.unref(minDate),
  27739. "max-date": vue.unref(maxDate),
  27740. "range-state": vue.unref(rangeState),
  27741. "disabled-date": vue.unref(disabledDate),
  27742. "cell-class-name": vue.unref(cellClassName),
  27743. onChangerange: vue.unref(handleChangeRange),
  27744. onPick: handleRangePick,
  27745. onSelect: vue.unref(onSelect)
  27746. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  27747. ], 2),
  27748. vue.createElementVNode("div", {
  27749. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  27750. }, [
  27751. vue.createElementVNode("div", {
  27752. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27753. }, [
  27754. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27755. key: 0,
  27756. type: "button",
  27757. disabled: !vue.unref(enableYearArrow),
  27758. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  27759. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  27760. onClick: rightPrevYear
  27761. }, [
  27762. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27763. vue.createVNode(vue.unref(ElIcon), null, {
  27764. default: vue.withCtx(() => [
  27765. vue.createVNode(vue.unref(d_arrow_left_default))
  27766. ]),
  27767. _: 1
  27768. })
  27769. ])
  27770. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  27771. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27772. key: 1,
  27773. type: "button",
  27774. disabled: !vue.unref(enableMonthArrow),
  27775. class: vue.normalizeClass([[
  27776. vue.unref(ppNs).e("icon-btn"),
  27777. { "is-disabled": !vue.unref(enableMonthArrow) }
  27778. ], "arrow-left"]),
  27779. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  27780. onClick: rightPrevMonth
  27781. }, [
  27782. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27783. vue.createVNode(vue.unref(ElIcon), null, {
  27784. default: vue.withCtx(() => [
  27785. vue.createVNode(vue.unref(arrow_left_default))
  27786. ]),
  27787. _: 1
  27788. })
  27789. ])
  27790. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  27791. vue.createElementVNode("button", {
  27792. type: "button",
  27793. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27794. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27795. onClick: rightNextYear
  27796. }, [
  27797. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  27798. vue.createVNode(vue.unref(ElIcon), null, {
  27799. default: vue.withCtx(() => [
  27800. vue.createVNode(vue.unref(d_arrow_right_default))
  27801. ]),
  27802. _: 1
  27803. })
  27804. ])
  27805. ], 10, ["aria-label"]),
  27806. vue.createElementVNode("button", {
  27807. type: "button",
  27808. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  27809. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  27810. onClick: rightNextMonth
  27811. }, [
  27812. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  27813. vue.createVNode(vue.unref(ElIcon), null, {
  27814. default: vue.withCtx(() => [
  27815. vue.createVNode(vue.unref(arrow_right_default))
  27816. ]),
  27817. _: 1
  27818. })
  27819. ])
  27820. ], 10, ["aria-label"]),
  27821. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  27822. ], 2),
  27823. vue.createVNode(DateTable, {
  27824. "selection-mode": "range",
  27825. date: rightDate.value,
  27826. "min-date": vue.unref(minDate),
  27827. "max-date": vue.unref(maxDate),
  27828. "range-state": vue.unref(rangeState),
  27829. "disabled-date": vue.unref(disabledDate),
  27830. "cell-class-name": vue.unref(cellClassName),
  27831. onChangerange: vue.unref(handleChangeRange),
  27832. onPick: handleRangePick,
  27833. onSelect: vue.unref(onSelect)
  27834. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  27835. ], 2)
  27836. ], 2)
  27837. ], 2),
  27838. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27839. key: 0,
  27840. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  27841. }, [
  27842. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  27843. key: 0,
  27844. text: "",
  27845. size: "small",
  27846. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27847. onClick: handleClear
  27848. }, {
  27849. default: vue.withCtx(() => [
  27850. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  27851. ]),
  27852. _: 1
  27853. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  27854. vue.createVNode(vue.unref(ElButton), {
  27855. plain: "",
  27856. size: "small",
  27857. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27858. disabled: vue.unref(btnDisabled),
  27859. onClick: ($event) => vue.unref(handleRangeConfirm)(false)
  27860. }, {
  27861. default: vue.withCtx(() => [
  27862. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  27863. ]),
  27864. _: 1
  27865. }, 8, ["class", "disabled", "onClick"])
  27866. ], 2)) : vue.createCommentVNode("v-if", true)
  27867. ], 2);
  27868. };
  27869. }
  27870. });
  27871. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "panel-date-range.vue"]]);
  27872. const panelMonthRangeProps = buildProps({
  27873. ...panelRangeSharedProps
  27874. });
  27875. const panelMonthRangeEmits = [
  27876. "pick",
  27877. "set-picker-option",
  27878. "calendar-change"
  27879. ];
  27880. const useMonthRangeHeader = ({
  27881. unlinkPanels,
  27882. leftDate,
  27883. rightDate
  27884. }) => {
  27885. const { t } = useLocale();
  27886. const leftPrevYear = () => {
  27887. leftDate.value = leftDate.value.subtract(1, "year");
  27888. if (!unlinkPanels.value) {
  27889. rightDate.value = rightDate.value.subtract(1, "year");
  27890. }
  27891. };
  27892. const rightNextYear = () => {
  27893. if (!unlinkPanels.value) {
  27894. leftDate.value = leftDate.value.add(1, "year");
  27895. }
  27896. rightDate.value = rightDate.value.add(1, "year");
  27897. };
  27898. const leftNextYear = () => {
  27899. leftDate.value = leftDate.value.add(1, "year");
  27900. };
  27901. const rightPrevYear = () => {
  27902. rightDate.value = rightDate.value.subtract(1, "year");
  27903. };
  27904. const leftLabel = vue.computed(() => {
  27905. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  27906. });
  27907. const rightLabel = vue.computed(() => {
  27908. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  27909. });
  27910. const leftYear = vue.computed(() => {
  27911. return leftDate.value.year();
  27912. });
  27913. const rightYear = vue.computed(() => {
  27914. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  27915. });
  27916. return {
  27917. leftPrevYear,
  27918. rightNextYear,
  27919. leftNextYear,
  27920. rightPrevYear,
  27921. leftLabel,
  27922. rightLabel,
  27923. leftYear,
  27924. rightYear
  27925. };
  27926. };
  27927. const unit$1 = "year";
  27928. const __default__$11 = vue.defineComponent({
  27929. name: "DatePickerMonthRange"
  27930. });
  27931. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  27932. ...__default__$11,
  27933. props: panelMonthRangeProps,
  27934. emits: panelMonthRangeEmits,
  27935. setup(__props, { emit }) {
  27936. const props = __props;
  27937. const { lang } = useLocale();
  27938. const pickerBase = vue.inject("EP_PICKER_BASE");
  27939. const { shortcuts, disabledDate } = pickerBase.props;
  27940. const format = vue.toRef(pickerBase.props, "format");
  27941. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  27942. const leftDate = vue.ref(dayjs().locale(lang.value));
  27943. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  27944. const {
  27945. minDate,
  27946. maxDate,
  27947. rangeState,
  27948. ppNs,
  27949. drpNs,
  27950. handleChangeRange,
  27951. handleRangeConfirm,
  27952. handleShortcutClick,
  27953. onSelect
  27954. } = useRangePicker(props, {
  27955. defaultValue,
  27956. leftDate,
  27957. rightDate,
  27958. unit: unit$1,
  27959. onParsedValueChanged
  27960. });
  27961. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  27962. const {
  27963. leftPrevYear,
  27964. rightNextYear,
  27965. leftNextYear,
  27966. rightPrevYear,
  27967. leftLabel,
  27968. rightLabel,
  27969. leftYear,
  27970. rightYear
  27971. } = useMonthRangeHeader({
  27972. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  27973. leftDate,
  27974. rightDate
  27975. });
  27976. const enableYearArrow = vue.computed(() => {
  27977. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  27978. });
  27979. const handleRangePick = (val, close = true) => {
  27980. const minDate_ = val.minDate;
  27981. const maxDate_ = val.maxDate;
  27982. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27983. return;
  27984. }
  27985. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  27986. maxDate.value = maxDate_;
  27987. minDate.value = minDate_;
  27988. if (!close)
  27989. return;
  27990. handleRangeConfirm();
  27991. };
  27992. const handleClear = () => {
  27993. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  27994. lang: vue.unref(lang),
  27995. unit: "year",
  27996. unlinkPanels: props.unlinkPanels
  27997. })[0];
  27998. rightDate.value = leftDate.value.add(1, "year");
  27999. emit("pick", null);
  28000. };
  28001. const formatToString = (value) => {
  28002. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  28003. };
  28004. const parseUserInput = (value) => {
  28005. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  28006. };
  28007. function onParsedValueChanged(minDate2, maxDate2) {
  28008. if (props.unlinkPanels && maxDate2) {
  28009. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  28010. const maxDateYear = maxDate2.year();
  28011. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
  28012. } else {
  28013. rightDate.value = leftDate.value.add(1, unit$1);
  28014. }
  28015. }
  28016. emit("set-picker-option", ["isValidValue", isValidRange]);
  28017. emit("set-picker-option", ["formatToString", formatToString]);
  28018. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28019. emit("set-picker-option", ["handleClear", handleClear]);
  28020. return (_ctx, _cache) => {
  28021. return vue.openBlock(), vue.createElementBlock("div", {
  28022. class: vue.normalizeClass([
  28023. vue.unref(ppNs).b(),
  28024. vue.unref(drpNs).b(),
  28025. {
  28026. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  28027. }
  28028. ])
  28029. }, [
  28030. vue.createElementVNode("div", {
  28031. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  28032. }, [
  28033. vue.renderSlot(_ctx.$slots, "sidebar", {
  28034. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28035. }),
  28036. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  28037. key: 0,
  28038. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28039. }, [
  28040. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  28041. return vue.openBlock(), vue.createElementBlock("button", {
  28042. key,
  28043. type: "button",
  28044. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  28045. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  28046. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  28047. }), 128))
  28048. ], 2)) : vue.createCommentVNode("v-if", true),
  28049. vue.createElementVNode("div", {
  28050. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  28051. }, [
  28052. vue.createElementVNode("div", {
  28053. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  28054. }, [
  28055. vue.createElementVNode("div", {
  28056. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28057. }, [
  28058. vue.createElementVNode("button", {
  28059. type: "button",
  28060. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28061. onClick: vue.unref(leftPrevYear)
  28062. }, [
  28063. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28064. vue.createVNode(vue.unref(ElIcon), null, {
  28065. default: vue.withCtx(() => [
  28066. vue.createVNode(vue.unref(d_arrow_left_default))
  28067. ]),
  28068. _: 1
  28069. })
  28070. ])
  28071. ], 10, ["onClick"]),
  28072. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28073. key: 0,
  28074. type: "button",
  28075. disabled: !vue.unref(enableYearArrow),
  28076. class: vue.normalizeClass([[
  28077. vue.unref(ppNs).e("icon-btn"),
  28078. { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) }
  28079. ], "d-arrow-right"]),
  28080. onClick: vue.unref(leftNextYear)
  28081. }, [
  28082. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28083. vue.createVNode(vue.unref(ElIcon), null, {
  28084. default: vue.withCtx(() => [
  28085. vue.createVNode(vue.unref(d_arrow_right_default))
  28086. ]),
  28087. _: 1
  28088. })
  28089. ])
  28090. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28091. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  28092. ], 2),
  28093. vue.createVNode(MonthTable, {
  28094. "selection-mode": "range",
  28095. date: leftDate.value,
  28096. "min-date": vue.unref(minDate),
  28097. "max-date": vue.unref(maxDate),
  28098. "range-state": vue.unref(rangeState),
  28099. "disabled-date": vue.unref(disabledDate),
  28100. onChangerange: vue.unref(handleChangeRange),
  28101. onPick: handleRangePick,
  28102. onSelect: vue.unref(onSelect)
  28103. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28104. ], 2),
  28105. vue.createElementVNode("div", {
  28106. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  28107. }, [
  28108. vue.createElementVNode("div", {
  28109. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28110. }, [
  28111. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28112. key: 0,
  28113. type: "button",
  28114. disabled: !vue.unref(enableYearArrow),
  28115. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  28116. onClick: vue.unref(rightPrevYear)
  28117. }, [
  28118. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28119. vue.createVNode(vue.unref(ElIcon), null, {
  28120. default: vue.withCtx(() => [
  28121. vue.createVNode(vue.unref(d_arrow_left_default))
  28122. ]),
  28123. _: 1
  28124. })
  28125. ])
  28126. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28127. vue.createElementVNode("button", {
  28128. type: "button",
  28129. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28130. onClick: vue.unref(rightNextYear)
  28131. }, [
  28132. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28133. vue.createVNode(vue.unref(ElIcon), null, {
  28134. default: vue.withCtx(() => [
  28135. vue.createVNode(vue.unref(d_arrow_right_default))
  28136. ]),
  28137. _: 1
  28138. })
  28139. ])
  28140. ], 10, ["onClick"]),
  28141. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28142. ], 2),
  28143. vue.createVNode(MonthTable, {
  28144. "selection-mode": "range",
  28145. date: rightDate.value,
  28146. "min-date": vue.unref(minDate),
  28147. "max-date": vue.unref(maxDate),
  28148. "range-state": vue.unref(rangeState),
  28149. "disabled-date": vue.unref(disabledDate),
  28150. onChangerange: vue.unref(handleChangeRange),
  28151. onPick: handleRangePick,
  28152. onSelect: vue.unref(onSelect)
  28153. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28154. ], 2)
  28155. ], 2)
  28156. ], 2)
  28157. ], 2);
  28158. };
  28159. }
  28160. });
  28161. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "panel-month-range.vue"]]);
  28162. const panelYearRangeProps = buildProps({
  28163. ...panelRangeSharedProps
  28164. });
  28165. const panelYearRangeEmits = [
  28166. "pick",
  28167. "set-picker-option",
  28168. "calendar-change"
  28169. ];
  28170. const useYearRangeHeader = ({
  28171. unlinkPanels,
  28172. leftDate,
  28173. rightDate
  28174. }) => {
  28175. const leftPrevYear = () => {
  28176. leftDate.value = leftDate.value.subtract(10, "year");
  28177. if (!unlinkPanels.value) {
  28178. rightDate.value = rightDate.value.subtract(10, "year");
  28179. }
  28180. };
  28181. const rightNextYear = () => {
  28182. if (!unlinkPanels.value) {
  28183. leftDate.value = leftDate.value.add(10, "year");
  28184. }
  28185. rightDate.value = rightDate.value.add(10, "year");
  28186. };
  28187. const leftNextYear = () => {
  28188. leftDate.value = leftDate.value.add(10, "year");
  28189. };
  28190. const rightPrevYear = () => {
  28191. rightDate.value = rightDate.value.subtract(10, "year");
  28192. };
  28193. const leftLabel = vue.computed(() => {
  28194. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  28195. return `${leftStartDate}-${leftStartDate + 9}`;
  28196. });
  28197. const rightLabel = vue.computed(() => {
  28198. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28199. return `${rightStartDate}-${rightStartDate + 9}`;
  28200. });
  28201. const leftYear = vue.computed(() => {
  28202. const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
  28203. return leftEndDate;
  28204. });
  28205. const rightYear = vue.computed(() => {
  28206. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28207. return rightStartDate;
  28208. });
  28209. return {
  28210. leftPrevYear,
  28211. rightNextYear,
  28212. leftNextYear,
  28213. rightPrevYear,
  28214. leftLabel,
  28215. rightLabel,
  28216. leftYear,
  28217. rightYear
  28218. };
  28219. };
  28220. const unit = "year";
  28221. const __default__$10 = vue.defineComponent({
  28222. name: "DatePickerYearRange"
  28223. });
  28224. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  28225. ...__default__$10,
  28226. props: panelYearRangeProps,
  28227. emits: panelYearRangeEmits,
  28228. setup(__props, { emit }) {
  28229. const props = __props;
  28230. const { lang } = useLocale();
  28231. const leftDate = vue.ref(dayjs().locale(lang.value));
  28232. const rightDate = vue.ref(leftDate.value.add(10, "year"));
  28233. const { pickerNs: ppNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  28234. const drpNs = useNamespace("date-range-picker");
  28235. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  28236. const panelKls = vue.computed(() => [
  28237. ppNs.b(),
  28238. drpNs.b(),
  28239. {
  28240. "has-sidebar": Boolean(vue.useSlots().sidebar) || hasShortcuts.value
  28241. }
  28242. ]);
  28243. const leftPanelKls = vue.computed(() => {
  28244. return {
  28245. content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
  28246. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  28247. arrowRightBtn: [
  28248. ppNs.e("icon-btn"),
  28249. { [ppNs.is("disabled")]: !enableYearArrow.value },
  28250. "d-arrow-right"
  28251. ]
  28252. };
  28253. });
  28254. const rightPanelKls = vue.computed(() => {
  28255. return {
  28256. content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
  28257. arrowLeftBtn: [
  28258. ppNs.e("icon-btn"),
  28259. { "is-disabled": !enableYearArrow.value },
  28260. "d-arrow-left"
  28261. ],
  28262. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  28263. };
  28264. });
  28265. const handleShortcutClick = useShortcut(lang);
  28266. const {
  28267. leftPrevYear,
  28268. rightNextYear,
  28269. leftNextYear,
  28270. rightPrevYear,
  28271. leftLabel,
  28272. rightLabel,
  28273. leftYear,
  28274. rightYear
  28275. } = useYearRangeHeader({
  28276. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  28277. leftDate,
  28278. rightDate
  28279. });
  28280. const enableYearArrow = vue.computed(() => {
  28281. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28282. });
  28283. const minDate = vue.ref();
  28284. const maxDate = vue.ref();
  28285. const rangeState = vue.ref({
  28286. endDate: null,
  28287. selecting: false
  28288. });
  28289. const handleChangeRange = (val) => {
  28290. rangeState.value = val;
  28291. };
  28292. const handleRangePick = (val, close = true) => {
  28293. const minDate_ = val.minDate;
  28294. const maxDate_ = val.maxDate;
  28295. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28296. return;
  28297. }
  28298. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28299. maxDate.value = maxDate_;
  28300. minDate.value = minDate_;
  28301. if (!close)
  28302. return;
  28303. handleConfirm();
  28304. };
  28305. const handleConfirm = (visible = false) => {
  28306. if (isValidRange([minDate.value, maxDate.value])) {
  28307. emit("pick", [minDate.value, maxDate.value], visible);
  28308. }
  28309. };
  28310. const onSelect = (selecting) => {
  28311. rangeState.value.selecting = selecting;
  28312. if (!selecting) {
  28313. rangeState.value.endDate = null;
  28314. }
  28315. };
  28316. const pickerBase = vue.inject("EP_PICKER_BASE");
  28317. const { shortcuts, disabledDate } = pickerBase.props;
  28318. const format = vue.toRef(pickerBase.props, "format");
  28319. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  28320. const getDefaultValue = () => {
  28321. let start;
  28322. if (isArray$1(defaultValue.value)) {
  28323. const left = dayjs(defaultValue.value[0]);
  28324. let right = dayjs(defaultValue.value[1]);
  28325. if (!props.unlinkPanels) {
  28326. right = left.add(10, unit);
  28327. }
  28328. return [left, right];
  28329. } else if (defaultValue.value) {
  28330. start = dayjs(defaultValue.value);
  28331. } else {
  28332. start = dayjs();
  28333. }
  28334. start = start.locale(lang.value);
  28335. return [start, start.add(10, unit)];
  28336. };
  28337. vue.watch(() => defaultValue.value, (val) => {
  28338. if (val) {
  28339. const defaultArr = getDefaultValue();
  28340. leftDate.value = defaultArr[0];
  28341. rightDate.value = defaultArr[1];
  28342. }
  28343. }, { immediate: true });
  28344. vue.watch(() => props.parsedValue, (newVal) => {
  28345. if (newVal && newVal.length === 2) {
  28346. minDate.value = newVal[0];
  28347. maxDate.value = newVal[1];
  28348. leftDate.value = minDate.value;
  28349. if (props.unlinkPanels && maxDate.value) {
  28350. const minDateYear = minDate.value.year();
  28351. const maxDateYear = maxDate.value.year();
  28352. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(10, "year") : maxDate.value;
  28353. } else {
  28354. rightDate.value = leftDate.value.add(10, "year");
  28355. }
  28356. } else {
  28357. const defaultArr = getDefaultValue();
  28358. minDate.value = void 0;
  28359. maxDate.value = void 0;
  28360. leftDate.value = defaultArr[0];
  28361. rightDate.value = defaultArr[1];
  28362. }
  28363. }, { immediate: true });
  28364. const parseUserInput = (value) => {
  28365. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  28366. };
  28367. const formatToString = (value) => {
  28368. return isArray$1(value) ? value.map((day) => day.format(format.value)) : value.format(format.value);
  28369. };
  28370. const isValidValue = (date) => {
  28371. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  28372. };
  28373. const handleClear = () => {
  28374. const defaultArr = getDefaultValue();
  28375. leftDate.value = defaultArr[0];
  28376. rightDate.value = defaultArr[1];
  28377. maxDate.value = void 0;
  28378. minDate.value = void 0;
  28379. emit("pick", null);
  28380. };
  28381. emit("set-picker-option", ["isValidValue", isValidValue]);
  28382. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28383. emit("set-picker-option", ["formatToString", formatToString]);
  28384. emit("set-picker-option", ["handleClear", handleClear]);
  28385. return (_ctx, _cache) => {
  28386. return vue.openBlock(), vue.createElementBlock("div", {
  28387. class: vue.normalizeClass(vue.unref(panelKls))
  28388. }, [
  28389. vue.createElementVNode("div", {
  28390. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  28391. }, [
  28392. vue.renderSlot(_ctx.$slots, "sidebar", {
  28393. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28394. }),
  28395. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  28396. key: 0,
  28397. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28398. }, [
  28399. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  28400. return vue.openBlock(), vue.createElementBlock("button", {
  28401. key,
  28402. type: "button",
  28403. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  28404. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  28405. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  28406. }), 128))
  28407. ], 2)) : vue.createCommentVNode("v-if", true),
  28408. vue.createElementVNode("div", {
  28409. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  28410. }, [
  28411. vue.createElementVNode("div", {
  28412. class: vue.normalizeClass(vue.unref(leftPanelKls).content)
  28413. }, [
  28414. vue.createElementVNode("div", {
  28415. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28416. }, [
  28417. vue.createElementVNode("button", {
  28418. type: "button",
  28419. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowLeftBtn),
  28420. onClick: vue.unref(leftPrevYear)
  28421. }, [
  28422. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28423. vue.createVNode(vue.unref(ElIcon), null, {
  28424. default: vue.withCtx(() => [
  28425. vue.createVNode(vue.unref(d_arrow_left_default))
  28426. ]),
  28427. _: 1
  28428. })
  28429. ])
  28430. ], 10, ["onClick"]),
  28431. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28432. key: 0,
  28433. type: "button",
  28434. disabled: !vue.unref(enableYearArrow),
  28435. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowRightBtn),
  28436. onClick: vue.unref(leftNextYear)
  28437. }, [
  28438. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28439. vue.createVNode(vue.unref(ElIcon), null, {
  28440. default: vue.withCtx(() => [
  28441. vue.createVNode(vue.unref(d_arrow_right_default))
  28442. ]),
  28443. _: 1
  28444. })
  28445. ])
  28446. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28447. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  28448. ], 2),
  28449. vue.createVNode(YearTable, {
  28450. "selection-mode": "range",
  28451. date: leftDate.value,
  28452. "min-date": minDate.value,
  28453. "max-date": maxDate.value,
  28454. "range-state": rangeState.value,
  28455. "disabled-date": vue.unref(disabledDate),
  28456. onChangerange: handleChangeRange,
  28457. onPick: handleRangePick,
  28458. onSelect
  28459. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28460. ], 2),
  28461. vue.createElementVNode("div", {
  28462. class: vue.normalizeClass(vue.unref(rightPanelKls).content)
  28463. }, [
  28464. vue.createElementVNode("div", {
  28465. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28466. }, [
  28467. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28468. key: 0,
  28469. type: "button",
  28470. disabled: !vue.unref(enableYearArrow),
  28471. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowLeftBtn),
  28472. onClick: vue.unref(rightPrevYear)
  28473. }, [
  28474. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28475. vue.createVNode(vue.unref(ElIcon), null, {
  28476. default: vue.withCtx(() => [
  28477. vue.createVNode(vue.unref(d_arrow_left_default))
  28478. ]),
  28479. _: 1
  28480. })
  28481. ])
  28482. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28483. vue.createElementVNode("button", {
  28484. type: "button",
  28485. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowRightBtn),
  28486. onClick: vue.unref(rightNextYear)
  28487. }, [
  28488. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28489. vue.createVNode(vue.unref(ElIcon), null, {
  28490. default: vue.withCtx(() => [
  28491. vue.createVNode(vue.unref(d_arrow_right_default))
  28492. ]),
  28493. _: 1
  28494. })
  28495. ])
  28496. ], 10, ["onClick"]),
  28497. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28498. ], 2),
  28499. vue.createVNode(YearTable, {
  28500. "selection-mode": "range",
  28501. date: rightDate.value,
  28502. "min-date": minDate.value,
  28503. "max-date": maxDate.value,
  28504. "range-state": rangeState.value,
  28505. "disabled-date": vue.unref(disabledDate),
  28506. onChangerange: handleChangeRange,
  28507. onPick: handleRangePick,
  28508. onSelect
  28509. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28510. ], 2)
  28511. ], 2)
  28512. ], 2)
  28513. ], 2);
  28514. };
  28515. }
  28516. });
  28517. var YearRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "panel-year-range.vue"]]);
  28518. const getPanel = function(type) {
  28519. switch (type) {
  28520. case "daterange":
  28521. case "datetimerange": {
  28522. return DateRangePickPanel;
  28523. }
  28524. case "monthrange": {
  28525. return MonthRangePickPanel;
  28526. }
  28527. case "yearrange": {
  28528. return YearRangePickPanel;
  28529. }
  28530. default: {
  28531. return DatePickPanel;
  28532. }
  28533. }
  28534. };
  28535. dayjs.extend(localeData);
  28536. dayjs.extend(advancedFormat);
  28537. dayjs.extend(customParseFormat);
  28538. dayjs.extend(weekOfYear);
  28539. dayjs.extend(weekYear);
  28540. dayjs.extend(dayOfYear);
  28541. dayjs.extend(isSameOrAfter);
  28542. dayjs.extend(isSameOrBefore);
  28543. var DatePicker = vue.defineComponent({
  28544. name: "ElDatePicker",
  28545. install: null,
  28546. props: datePickerProps,
  28547. emits: ["update:modelValue"],
  28548. setup(props, {
  28549. expose,
  28550. emit,
  28551. slots
  28552. }) {
  28553. const ns = useNamespace("picker-panel");
  28554. vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions")));
  28555. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  28556. slots,
  28557. pickerNs: ns
  28558. });
  28559. const commonPicker = vue.ref();
  28560. const refProps = {
  28561. focus: (focusStartInput = true) => {
  28562. var _a;
  28563. (_a = commonPicker.value) == null ? void 0 : _a.focus(focusStartInput);
  28564. },
  28565. handleOpen: () => {
  28566. var _a;
  28567. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  28568. },
  28569. handleClose: () => {
  28570. var _a;
  28571. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  28572. }
  28573. };
  28574. expose(refProps);
  28575. const onModelValueUpdated = (val) => {
  28576. emit("update:modelValue", val);
  28577. };
  28578. return () => {
  28579. var _a;
  28580. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  28581. const Component = getPanel(props.type);
  28582. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  28583. "format": format,
  28584. "type": props.type,
  28585. "ref": commonPicker,
  28586. "onUpdate:modelValue": onModelValueUpdated
  28587. }), {
  28588. default: (scopedProps) => vue.createVNode(Component, scopedProps, {
  28589. "prev-month": slots["prev-month"],
  28590. "next-month": slots["next-month"],
  28591. "prev-year": slots["prev-year"],
  28592. "next-year": slots["next-year"]
  28593. }),
  28594. "range-separator": slots["range-separator"]
  28595. });
  28596. };
  28597. }
  28598. });
  28599. const ElDatePicker = withInstall(DatePicker);
  28600. const descriptionsKey = Symbol("elDescriptions");
  28601. var ElDescriptionsCell = vue.defineComponent({
  28602. name: "ElDescriptionsCell",
  28603. props: {
  28604. cell: {
  28605. type: Object
  28606. },
  28607. tag: {
  28608. type: String,
  28609. default: "td"
  28610. },
  28611. type: {
  28612. type: String
  28613. }
  28614. },
  28615. setup() {
  28616. const descriptions = vue.inject(descriptionsKey, {});
  28617. return {
  28618. descriptions
  28619. };
  28620. },
  28621. render() {
  28622. var _a, _b, _c, _d, _e, _f, _g;
  28623. const item = getNormalizedProps(this.cell);
  28624. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  28625. const { dir, arg, modifiers, value } = dire;
  28626. return [dir, value, arg, modifiers];
  28627. });
  28628. const { border, direction } = this.descriptions;
  28629. const isVertical = direction === "vertical";
  28630. const label = ((_d = (_c = (_b = this.cell) == null ? void 0 : _b.children) == null ? void 0 : _c.label) == null ? void 0 : _d.call(_c)) || item.label;
  28631. const content = (_g = (_f = (_e = this.cell) == null ? void 0 : _e.children) == null ? void 0 : _f.default) == null ? void 0 : _g.call(_f);
  28632. const span = item.span;
  28633. const rowspan = item.rowspan;
  28634. const align = item.align ? `is-${item.align}` : "";
  28635. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  28636. const className = item.className;
  28637. const labelClassName = item.labelClassName;
  28638. const style = {
  28639. width: addUnit(item.width),
  28640. minWidth: addUnit(item.minWidth)
  28641. };
  28642. const ns = useNamespace("descriptions");
  28643. switch (this.type) {
  28644. case "label":
  28645. return vue.withDirectives(vue.h(this.tag, {
  28646. style,
  28647. class: [
  28648. ns.e("cell"),
  28649. ns.e("label"),
  28650. ns.is("bordered-label", border),
  28651. ns.is("vertical-label", isVertical),
  28652. labelAlign,
  28653. labelClassName
  28654. ],
  28655. colSpan: isVertical ? span : 1,
  28656. rowspan: isVertical ? 1 : rowspan
  28657. }, label), directives);
  28658. case "content":
  28659. return vue.withDirectives(vue.h(this.tag, {
  28660. style,
  28661. class: [
  28662. ns.e("cell"),
  28663. ns.e("content"),
  28664. ns.is("bordered-content", border),
  28665. ns.is("vertical-content", isVertical),
  28666. align,
  28667. className
  28668. ],
  28669. colSpan: isVertical ? span : span * 2 - 1,
  28670. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  28671. }, content), directives);
  28672. default:
  28673. return vue.withDirectives(vue.h("td", {
  28674. style,
  28675. class: [ns.e("cell"), align],
  28676. colSpan: span,
  28677. rowspan
  28678. }, [
  28679. !isNil(label) ? vue.h("span", {
  28680. class: [ns.e("label"), labelClassName]
  28681. }, label) : void 0,
  28682. vue.h("span", {
  28683. class: [ns.e("content"), className]
  28684. }, content)
  28685. ]), directives);
  28686. }
  28687. }
  28688. });
  28689. const descriptionsRowProps = buildProps({
  28690. row: {
  28691. type: definePropType(Array),
  28692. default: () => []
  28693. }
  28694. });
  28695. const __default__$$ = vue.defineComponent({
  28696. name: "ElDescriptionsRow"
  28697. });
  28698. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  28699. ...__default__$$,
  28700. props: descriptionsRowProps,
  28701. setup(__props) {
  28702. const descriptions = vue.inject(descriptionsKey, {});
  28703. return (_ctx, _cache) => {
  28704. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  28705. vue.createElementVNode("tr", null, [
  28706. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28707. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28708. key: `tr1-${_index}`,
  28709. cell,
  28710. tag: "th",
  28711. type: "label"
  28712. }, null, 8, ["cell"]);
  28713. }), 128))
  28714. ]),
  28715. vue.createElementVNode("tr", null, [
  28716. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28717. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28718. key: `tr2-${_index}`,
  28719. cell,
  28720. tag: "td",
  28721. type: "content"
  28722. }, null, 8, ["cell"]);
  28723. }), 128))
  28724. ])
  28725. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", { key: 1 }, [
  28726. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28727. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  28728. key: `tr3-${_index}`
  28729. }, [
  28730. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  28731. vue.createVNode(vue.unref(ElDescriptionsCell), {
  28732. cell,
  28733. tag: "td",
  28734. type: "label"
  28735. }, null, 8, ["cell"]),
  28736. vue.createVNode(vue.unref(ElDescriptionsCell), {
  28737. cell,
  28738. tag: "td",
  28739. type: "content"
  28740. }, null, 8, ["cell"])
  28741. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28742. key: 1,
  28743. cell,
  28744. tag: "td",
  28745. type: "both"
  28746. }, null, 8, ["cell"]))
  28747. ], 64);
  28748. }), 128))
  28749. ]));
  28750. };
  28751. }
  28752. });
  28753. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "descriptions-row.vue"]]);
  28754. const descriptionProps = buildProps({
  28755. border: Boolean,
  28756. column: {
  28757. type: Number,
  28758. default: 3
  28759. },
  28760. direction: {
  28761. type: String,
  28762. values: ["horizontal", "vertical"],
  28763. default: "horizontal"
  28764. },
  28765. size: useSizeProp,
  28766. title: {
  28767. type: String,
  28768. default: ""
  28769. },
  28770. extra: {
  28771. type: String,
  28772. default: ""
  28773. }
  28774. });
  28775. const __default__$_ = vue.defineComponent({
  28776. name: "ElDescriptions"
  28777. });
  28778. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  28779. ...__default__$_,
  28780. props: descriptionProps,
  28781. setup(__props) {
  28782. const props = __props;
  28783. const ns = useNamespace("descriptions");
  28784. const descriptionsSize = useFormSize();
  28785. const slots = vue.useSlots();
  28786. vue.provide(descriptionsKey, props);
  28787. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  28788. const filledNode = (node, span, count, isLast = false) => {
  28789. if (!node.props) {
  28790. node.props = {};
  28791. }
  28792. if (span > count) {
  28793. node.props.span = count;
  28794. }
  28795. if (isLast) {
  28796. node.props.span = span;
  28797. }
  28798. return node;
  28799. };
  28800. const getRows = () => {
  28801. if (!slots.default)
  28802. return [];
  28803. const children = flattedChildren(slots.default()).filter((node) => {
  28804. var _a;
  28805. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === "ElDescriptionsItem";
  28806. });
  28807. const rows = [];
  28808. let temp = [];
  28809. let count = props.column;
  28810. let totalSpan = 0;
  28811. const rowspanTemp = [];
  28812. children.forEach((node, index) => {
  28813. var _a, _b, _c;
  28814. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  28815. const rowspan = ((_b = node.props) == null ? void 0 : _b.rowspan) || 1;
  28816. const rowNo = rows.length;
  28817. rowspanTemp[rowNo] || (rowspanTemp[rowNo] = 0);
  28818. if (rowspan > 1) {
  28819. for (let i = 1; i < rowspan; i++) {
  28820. rowspanTemp[_c = rowNo + i] || (rowspanTemp[_c] = 0);
  28821. rowspanTemp[rowNo + i]++;
  28822. totalSpan++;
  28823. }
  28824. }
  28825. if (rowspanTemp[rowNo] > 0) {
  28826. count -= rowspanTemp[rowNo];
  28827. rowspanTemp[rowNo] = 0;
  28828. }
  28829. if (index < children.length - 1) {
  28830. totalSpan += span > count ? count : span;
  28831. }
  28832. if (index === children.length - 1) {
  28833. const lastSpan = props.column - totalSpan % props.column;
  28834. temp.push(filledNode(node, lastSpan, count, true));
  28835. rows.push(temp);
  28836. return;
  28837. }
  28838. if (span < count) {
  28839. count -= span;
  28840. temp.push(node);
  28841. } else {
  28842. temp.push(filledNode(node, span, count));
  28843. rows.push(temp);
  28844. count = props.column;
  28845. temp = [];
  28846. }
  28847. });
  28848. return rows;
  28849. };
  28850. return (_ctx, _cache) => {
  28851. return vue.openBlock(), vue.createElementBlock("div", {
  28852. class: vue.normalizeClass(vue.unref(descriptionKls))
  28853. }, [
  28854. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  28855. key: 0,
  28856. class: vue.normalizeClass(vue.unref(ns).e("header"))
  28857. }, [
  28858. vue.createElementVNode("div", {
  28859. class: vue.normalizeClass(vue.unref(ns).e("title"))
  28860. }, [
  28861. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  28862. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  28863. ])
  28864. ], 2),
  28865. vue.createElementVNode("div", {
  28866. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  28867. }, [
  28868. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  28869. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  28870. ])
  28871. ], 2)
  28872. ], 2)) : vue.createCommentVNode("v-if", true),
  28873. vue.createElementVNode("div", {
  28874. class: vue.normalizeClass(vue.unref(ns).e("body"))
  28875. }, [
  28876. vue.createElementVNode("table", {
  28877. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  28878. }, [
  28879. vue.createElementVNode("tbody", null, [
  28880. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, _index) => {
  28881. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  28882. key: _index,
  28883. row
  28884. }, null, 8, ["row"]);
  28885. }), 128))
  28886. ])
  28887. ], 2)
  28888. ], 2)
  28889. ], 2);
  28890. };
  28891. }
  28892. });
  28893. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "description.vue"]]);
  28894. const descriptionItemProps = buildProps({
  28895. label: {
  28896. type: String,
  28897. default: ""
  28898. },
  28899. span: {
  28900. type: Number,
  28901. default: 1
  28902. },
  28903. rowspan: {
  28904. type: Number,
  28905. default: 1
  28906. },
  28907. width: {
  28908. type: [String, Number],
  28909. default: ""
  28910. },
  28911. minWidth: {
  28912. type: [String, Number],
  28913. default: ""
  28914. },
  28915. align: {
  28916. type: String,
  28917. default: "left"
  28918. },
  28919. labelAlign: {
  28920. type: String,
  28921. default: ""
  28922. },
  28923. className: {
  28924. type: String,
  28925. default: ""
  28926. },
  28927. labelClassName: {
  28928. type: String,
  28929. default: ""
  28930. }
  28931. });
  28932. const DescriptionItem = vue.defineComponent({
  28933. name: "ElDescriptionsItem",
  28934. props: descriptionItemProps
  28935. });
  28936. const ElDescriptions = withInstall(Descriptions, {
  28937. DescriptionsItem: DescriptionItem
  28938. });
  28939. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  28940. const overlayProps = buildProps({
  28941. mask: {
  28942. type: Boolean,
  28943. default: true
  28944. },
  28945. customMaskEvent: Boolean,
  28946. overlayClass: {
  28947. type: definePropType([
  28948. String,
  28949. Array,
  28950. Object
  28951. ])
  28952. },
  28953. zIndex: {
  28954. type: definePropType([String, Number])
  28955. }
  28956. });
  28957. const overlayEmits = {
  28958. click: (evt) => evt instanceof MouseEvent
  28959. };
  28960. const BLOCK = "overlay";
  28961. var Overlay$1 = vue.defineComponent({
  28962. name: "ElOverlay",
  28963. props: overlayProps,
  28964. emits: overlayEmits,
  28965. setup(props, { slots, emit }) {
  28966. const ns = useNamespace(BLOCK);
  28967. const onMaskClick = (e) => {
  28968. emit("click", e);
  28969. };
  28970. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  28971. return () => {
  28972. return props.mask ? vue.createVNode("div", {
  28973. class: [ns.b(), props.overlayClass],
  28974. style: {
  28975. zIndex: props.zIndex
  28976. },
  28977. onClick,
  28978. onMousedown,
  28979. onMouseup
  28980. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  28981. class: props.overlayClass,
  28982. style: {
  28983. zIndex: props.zIndex,
  28984. position: "fixed",
  28985. top: "0px",
  28986. right: "0px",
  28987. bottom: "0px",
  28988. left: "0px"
  28989. }
  28990. }, [vue.renderSlot(slots, "default")]);
  28991. };
  28992. }
  28993. });
  28994. const ElOverlay = Overlay$1;
  28995. const dialogInjectionKey = Symbol("dialogInjectionKey");
  28996. const dialogContentProps = buildProps({
  28997. center: Boolean,
  28998. alignCenter: Boolean,
  28999. closeIcon: {
  29000. type: iconPropType
  29001. },
  29002. draggable: Boolean,
  29003. overflow: Boolean,
  29004. fullscreen: Boolean,
  29005. showClose: {
  29006. type: Boolean,
  29007. default: true
  29008. },
  29009. title: {
  29010. type: String,
  29011. default: ""
  29012. },
  29013. ariaLevel: {
  29014. type: String,
  29015. default: "2"
  29016. }
  29017. });
  29018. const dialogContentEmits = {
  29019. close: () => true
  29020. };
  29021. const __default__$Z = vue.defineComponent({ name: "ElDialogContent" });
  29022. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  29023. ...__default__$Z,
  29024. props: dialogContentProps,
  29025. emits: dialogContentEmits,
  29026. setup(__props, { expose }) {
  29027. const props = __props;
  29028. const { t } = useLocale();
  29029. const { Close } = CloseComponents;
  29030. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  29031. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  29032. const dialogKls = vue.computed(() => [
  29033. ns.b(),
  29034. ns.is("fullscreen", props.fullscreen),
  29035. ns.is("draggable", props.draggable),
  29036. ns.is("align-center", props.alignCenter),
  29037. { [ns.m("center")]: props.center }
  29038. ]);
  29039. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  29040. const draggable = vue.computed(() => props.draggable);
  29041. const overflow = vue.computed(() => props.overflow);
  29042. const { resetPosition } = useDraggable(dialogRef, headerRef, draggable, overflow);
  29043. expose({
  29044. resetPosition
  29045. });
  29046. return (_ctx, _cache) => {
  29047. return vue.openBlock(), vue.createElementBlock("div", {
  29048. ref: vue.unref(composedDialogRef),
  29049. class: vue.normalizeClass(vue.unref(dialogKls)),
  29050. style: vue.normalizeStyle(vue.unref(style)),
  29051. tabindex: "-1"
  29052. }, [
  29053. vue.createElementVNode("header", {
  29054. ref_key: "headerRef",
  29055. ref: headerRef,
  29056. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": _ctx.showClose }])
  29057. }, [
  29058. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  29059. vue.createElementVNode("span", {
  29060. role: "heading",
  29061. "aria-level": _ctx.ariaLevel,
  29062. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29063. }, vue.toDisplayString(_ctx.title), 11, ["aria-level"])
  29064. ]),
  29065. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  29066. key: 0,
  29067. "aria-label": vue.unref(t)("el.dialog.close"),
  29068. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  29069. type: "button",
  29070. onClick: ($event) => _ctx.$emit("close")
  29071. }, [
  29072. vue.createVNode(vue.unref(ElIcon), {
  29073. class: vue.normalizeClass(vue.unref(ns).e("close"))
  29074. }, {
  29075. default: vue.withCtx(() => [
  29076. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  29077. ]),
  29078. _: 1
  29079. }, 8, ["class"])
  29080. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  29081. ], 2),
  29082. vue.createElementVNode("div", {
  29083. id: vue.unref(bodyId),
  29084. class: vue.normalizeClass(vue.unref(ns).e("body"))
  29085. }, [
  29086. vue.renderSlot(_ctx.$slots, "default")
  29087. ], 10, ["id"]),
  29088. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  29089. key: 0,
  29090. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  29091. }, [
  29092. vue.renderSlot(_ctx.$slots, "footer")
  29093. ], 2)) : vue.createCommentVNode("v-if", true)
  29094. ], 6);
  29095. };
  29096. }
  29097. });
  29098. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "dialog-content.vue"]]);
  29099. const dialogProps = buildProps({
  29100. ...dialogContentProps,
  29101. appendToBody: Boolean,
  29102. appendTo: {
  29103. type: definePropType([String, Object]),
  29104. default: "body"
  29105. },
  29106. beforeClose: {
  29107. type: definePropType(Function)
  29108. },
  29109. destroyOnClose: Boolean,
  29110. closeOnClickModal: {
  29111. type: Boolean,
  29112. default: true
  29113. },
  29114. closeOnPressEscape: {
  29115. type: Boolean,
  29116. default: true
  29117. },
  29118. lockScroll: {
  29119. type: Boolean,
  29120. default: true
  29121. },
  29122. modal: {
  29123. type: Boolean,
  29124. default: true
  29125. },
  29126. openDelay: {
  29127. type: Number,
  29128. default: 0
  29129. },
  29130. closeDelay: {
  29131. type: Number,
  29132. default: 0
  29133. },
  29134. top: {
  29135. type: String
  29136. },
  29137. modelValue: Boolean,
  29138. modalClass: String,
  29139. width: {
  29140. type: [String, Number]
  29141. },
  29142. zIndex: {
  29143. type: Number
  29144. },
  29145. trapFocus: Boolean,
  29146. headerAriaLevel: {
  29147. type: String,
  29148. default: "2"
  29149. }
  29150. });
  29151. const dialogEmits = {
  29152. open: () => true,
  29153. opened: () => true,
  29154. close: () => true,
  29155. closed: () => true,
  29156. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  29157. openAutoFocus: () => true,
  29158. closeAutoFocus: () => true
  29159. };
  29160. const useDialog = (props, targetRef) => {
  29161. var _a;
  29162. const instance = vue.getCurrentInstance();
  29163. const emit = instance.emit;
  29164. const { nextZIndex } = useZIndex();
  29165. let lastPosition = "";
  29166. const titleId = useId();
  29167. const bodyId = useId();
  29168. const visible = vue.ref(false);
  29169. const closed = vue.ref(false);
  29170. const rendered = vue.ref(false);
  29171. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  29172. let openTimer = void 0;
  29173. let closeTimer = void 0;
  29174. const namespace = useGlobalConfig("namespace", defaultNamespace);
  29175. const style = vue.computed(() => {
  29176. const style2 = {};
  29177. const varPrefix = `--${namespace.value}-dialog`;
  29178. if (!props.fullscreen) {
  29179. if (props.top) {
  29180. style2[`${varPrefix}-margin-top`] = props.top;
  29181. }
  29182. if (props.width) {
  29183. style2[`${varPrefix}-width`] = addUnit(props.width);
  29184. }
  29185. }
  29186. return style2;
  29187. });
  29188. const overlayDialogStyle = vue.computed(() => {
  29189. if (props.alignCenter) {
  29190. return { display: "flex" };
  29191. }
  29192. return {};
  29193. });
  29194. function afterEnter() {
  29195. emit("opened");
  29196. }
  29197. function afterLeave() {
  29198. emit("closed");
  29199. emit(UPDATE_MODEL_EVENT, false);
  29200. if (props.destroyOnClose) {
  29201. rendered.value = false;
  29202. }
  29203. }
  29204. function beforeLeave() {
  29205. emit("close");
  29206. }
  29207. function open() {
  29208. closeTimer == null ? void 0 : closeTimer();
  29209. openTimer == null ? void 0 : openTimer();
  29210. if (props.openDelay && props.openDelay > 0) {
  29211. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  29212. } else {
  29213. doOpen();
  29214. }
  29215. }
  29216. function close() {
  29217. openTimer == null ? void 0 : openTimer();
  29218. closeTimer == null ? void 0 : closeTimer();
  29219. if (props.closeDelay && props.closeDelay > 0) {
  29220. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  29221. } else {
  29222. doClose();
  29223. }
  29224. }
  29225. function handleClose() {
  29226. function hide(shouldCancel) {
  29227. if (shouldCancel)
  29228. return;
  29229. closed.value = true;
  29230. visible.value = false;
  29231. }
  29232. if (props.beforeClose) {
  29233. props.beforeClose(hide);
  29234. } else {
  29235. close();
  29236. }
  29237. }
  29238. function onModalClick() {
  29239. if (props.closeOnClickModal) {
  29240. handleClose();
  29241. }
  29242. }
  29243. function doOpen() {
  29244. if (!isClient)
  29245. return;
  29246. visible.value = true;
  29247. }
  29248. function doClose() {
  29249. visible.value = false;
  29250. }
  29251. function onOpenAutoFocus() {
  29252. emit("openAutoFocus");
  29253. }
  29254. function onCloseAutoFocus() {
  29255. emit("closeAutoFocus");
  29256. }
  29257. function onFocusoutPrevented(event) {
  29258. var _a2;
  29259. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  29260. event.preventDefault();
  29261. }
  29262. }
  29263. if (props.lockScroll) {
  29264. useLockscreen(visible);
  29265. }
  29266. function onCloseRequested() {
  29267. if (props.closeOnPressEscape) {
  29268. handleClose();
  29269. }
  29270. }
  29271. vue.watch(() => props.modelValue, (val) => {
  29272. if (val) {
  29273. closed.value = false;
  29274. open();
  29275. rendered.value = true;
  29276. zIndex.value = isUndefined$1(props.zIndex) ? nextZIndex() : zIndex.value++;
  29277. vue.nextTick(() => {
  29278. emit("open");
  29279. if (targetRef.value) {
  29280. targetRef.value.scrollTop = 0;
  29281. }
  29282. });
  29283. } else {
  29284. if (visible.value) {
  29285. close();
  29286. }
  29287. }
  29288. });
  29289. vue.watch(() => props.fullscreen, (val) => {
  29290. if (!targetRef.value)
  29291. return;
  29292. if (val) {
  29293. lastPosition = targetRef.value.style.transform;
  29294. targetRef.value.style.transform = "";
  29295. } else {
  29296. targetRef.value.style.transform = lastPosition;
  29297. }
  29298. });
  29299. vue.onMounted(() => {
  29300. if (props.modelValue) {
  29301. visible.value = true;
  29302. rendered.value = true;
  29303. open();
  29304. }
  29305. });
  29306. return {
  29307. afterEnter,
  29308. afterLeave,
  29309. beforeLeave,
  29310. handleClose,
  29311. onModalClick,
  29312. close,
  29313. doClose,
  29314. onOpenAutoFocus,
  29315. onCloseAutoFocus,
  29316. onCloseRequested,
  29317. onFocusoutPrevented,
  29318. titleId,
  29319. bodyId,
  29320. closed,
  29321. style,
  29322. overlayDialogStyle,
  29323. rendered,
  29324. visible,
  29325. zIndex
  29326. };
  29327. };
  29328. const __default__$Y = vue.defineComponent({
  29329. name: "ElDialog",
  29330. inheritAttrs: false
  29331. });
  29332. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  29333. ...__default__$Y,
  29334. props: dialogProps,
  29335. emits: dialogEmits,
  29336. setup(__props, { expose }) {
  29337. const props = __props;
  29338. const slots = vue.useSlots();
  29339. useDeprecated({
  29340. scope: "el-dialog",
  29341. from: "the title slot",
  29342. replacement: "the header slot",
  29343. version: "3.0.0",
  29344. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  29345. }, vue.computed(() => !!slots.title));
  29346. const ns = useNamespace("dialog");
  29347. const dialogRef = vue.ref();
  29348. const headerRef = vue.ref();
  29349. const dialogContentRef = vue.ref();
  29350. const {
  29351. visible,
  29352. titleId,
  29353. bodyId,
  29354. style,
  29355. overlayDialogStyle,
  29356. rendered,
  29357. zIndex,
  29358. afterEnter,
  29359. afterLeave,
  29360. beforeLeave,
  29361. handleClose,
  29362. onModalClick,
  29363. onOpenAutoFocus,
  29364. onCloseAutoFocus,
  29365. onCloseRequested,
  29366. onFocusoutPrevented
  29367. } = useDialog(props, dialogRef);
  29368. vue.provide(dialogInjectionKey, {
  29369. dialogRef,
  29370. headerRef,
  29371. bodyId,
  29372. ns,
  29373. rendered,
  29374. style
  29375. });
  29376. const overlayEvent = useSameTarget(onModalClick);
  29377. const draggable = vue.computed(() => props.draggable && !props.fullscreen);
  29378. const resetPosition = () => {
  29379. var _a;
  29380. (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();
  29381. };
  29382. expose({
  29383. visible,
  29384. dialogContentRef,
  29385. resetPosition
  29386. });
  29387. return (_ctx, _cache) => {
  29388. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  29389. to: _ctx.appendTo,
  29390. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29391. }, {
  29392. default: vue.withCtx(() => [
  29393. vue.createVNode(vue.Transition, {
  29394. name: "dialog-fade",
  29395. onAfterEnter: vue.unref(afterEnter),
  29396. onAfterLeave: vue.unref(afterLeave),
  29397. onBeforeLeave: vue.unref(beforeLeave),
  29398. persisted: ""
  29399. }, {
  29400. default: vue.withCtx(() => [
  29401. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  29402. "custom-mask-event": "",
  29403. mask: _ctx.modal,
  29404. "overlay-class": _ctx.modalClass,
  29405. "z-index": vue.unref(zIndex)
  29406. }, {
  29407. default: vue.withCtx(() => [
  29408. vue.createElementVNode("div", {
  29409. role: "dialog",
  29410. "aria-modal": "true",
  29411. "aria-label": _ctx.title || void 0,
  29412. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  29413. "aria-describedby": vue.unref(bodyId),
  29414. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  29415. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  29416. onClick: vue.unref(overlayEvent).onClick,
  29417. onMousedown: vue.unref(overlayEvent).onMousedown,
  29418. onMouseup: vue.unref(overlayEvent).onMouseup
  29419. }, [
  29420. vue.createVNode(vue.unref(ElFocusTrap), {
  29421. loop: "",
  29422. trapped: vue.unref(visible),
  29423. "focus-start-el": "container",
  29424. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  29425. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  29426. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  29427. onReleaseRequested: vue.unref(onCloseRequested)
  29428. }, {
  29429. default: vue.withCtx(() => [
  29430. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  29431. key: 0,
  29432. ref_key: "dialogContentRef",
  29433. ref: dialogContentRef
  29434. }, _ctx.$attrs, {
  29435. center: _ctx.center,
  29436. "align-center": _ctx.alignCenter,
  29437. "close-icon": _ctx.closeIcon,
  29438. draggable: vue.unref(draggable),
  29439. overflow: _ctx.overflow,
  29440. fullscreen: _ctx.fullscreen,
  29441. "show-close": _ctx.showClose,
  29442. title: _ctx.title,
  29443. "aria-level": _ctx.headerAriaLevel,
  29444. onClose: vue.unref(handleClose)
  29445. }), vue.createSlots({
  29446. header: vue.withCtx(() => [
  29447. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  29448. key: 0,
  29449. close: vue.unref(handleClose),
  29450. titleId: vue.unref(titleId),
  29451. titleClass: vue.unref(ns).e("title")
  29452. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  29453. ]),
  29454. default: vue.withCtx(() => [
  29455. vue.renderSlot(_ctx.$slots, "default")
  29456. ]),
  29457. _: 2
  29458. }, [
  29459. _ctx.$slots.footer ? {
  29460. name: "footer",
  29461. fn: vue.withCtx(() => [
  29462. vue.renderSlot(_ctx.$slots, "footer")
  29463. ])
  29464. } : void 0
  29465. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : vue.createCommentVNode("v-if", true)
  29466. ]),
  29467. _: 3
  29468. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29469. ], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  29470. ]),
  29471. _: 3
  29472. }, 8, ["mask", "overlay-class", "z-index"]), [
  29473. [vue.vShow, vue.unref(visible)]
  29474. ])
  29475. ]),
  29476. _: 3
  29477. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29478. ]),
  29479. _: 3
  29480. }, 8, ["to", "disabled"]);
  29481. };
  29482. }
  29483. });
  29484. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "dialog.vue"]]);
  29485. const ElDialog = withInstall(Dialog);
  29486. const dividerProps = buildProps({
  29487. direction: {
  29488. type: String,
  29489. values: ["horizontal", "vertical"],
  29490. default: "horizontal"
  29491. },
  29492. contentPosition: {
  29493. type: String,
  29494. values: ["left", "center", "right"],
  29495. default: "center"
  29496. },
  29497. borderStyle: {
  29498. type: definePropType(String),
  29499. default: "solid"
  29500. }
  29501. });
  29502. const __default__$X = vue.defineComponent({
  29503. name: "ElDivider"
  29504. });
  29505. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  29506. ...__default__$X,
  29507. props: dividerProps,
  29508. setup(__props) {
  29509. const props = __props;
  29510. const ns = useNamespace("divider");
  29511. const dividerStyle = vue.computed(() => {
  29512. return ns.cssVar({
  29513. "border-style": props.borderStyle
  29514. });
  29515. });
  29516. return (_ctx, _cache) => {
  29517. return vue.openBlock(), vue.createElementBlock("div", {
  29518. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  29519. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  29520. role: "separator"
  29521. }, [
  29522. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  29523. key: 0,
  29524. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  29525. }, [
  29526. vue.renderSlot(_ctx.$slots, "default")
  29527. ], 2)) : vue.createCommentVNode("v-if", true)
  29528. ], 6);
  29529. };
  29530. }
  29531. });
  29532. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "divider.vue"]]);
  29533. const ElDivider = withInstall(Divider);
  29534. const drawerProps = buildProps({
  29535. ...dialogProps,
  29536. direction: {
  29537. type: String,
  29538. default: "rtl",
  29539. values: ["ltr", "rtl", "ttb", "btt"]
  29540. },
  29541. size: {
  29542. type: [String, Number],
  29543. default: "30%"
  29544. },
  29545. withHeader: {
  29546. type: Boolean,
  29547. default: true
  29548. },
  29549. modalFade: {
  29550. type: Boolean,
  29551. default: true
  29552. },
  29553. headerAriaLevel: {
  29554. type: String,
  29555. default: "2"
  29556. }
  29557. });
  29558. const drawerEmits = dialogEmits;
  29559. const __default__$W = vue.defineComponent({
  29560. name: "ElDrawer",
  29561. inheritAttrs: false
  29562. });
  29563. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  29564. ...__default__$W,
  29565. props: drawerProps,
  29566. emits: drawerEmits,
  29567. setup(__props, { expose }) {
  29568. const props = __props;
  29569. const slots = vue.useSlots();
  29570. useDeprecated({
  29571. scope: "el-drawer",
  29572. from: "the title slot",
  29573. replacement: "the header slot",
  29574. version: "3.0.0",
  29575. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  29576. }, vue.computed(() => !!slots.title));
  29577. const drawerRef = vue.ref();
  29578. const focusStartRef = vue.ref();
  29579. const ns = useNamespace("drawer");
  29580. const { t } = useLocale();
  29581. const {
  29582. afterEnter,
  29583. afterLeave,
  29584. beforeLeave,
  29585. visible,
  29586. rendered,
  29587. titleId,
  29588. bodyId,
  29589. zIndex,
  29590. onModalClick,
  29591. onOpenAutoFocus,
  29592. onCloseAutoFocus,
  29593. onFocusoutPrevented,
  29594. onCloseRequested,
  29595. handleClose
  29596. } = useDialog(props, drawerRef);
  29597. const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
  29598. const drawerSize = vue.computed(() => addUnit(props.size));
  29599. expose({
  29600. handleClose,
  29601. afterEnter,
  29602. afterLeave
  29603. });
  29604. return (_ctx, _cache) => {
  29605. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  29606. to: _ctx.appendTo,
  29607. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29608. }, {
  29609. default: vue.withCtx(() => [
  29610. vue.createVNode(vue.Transition, {
  29611. name: vue.unref(ns).b("fade"),
  29612. onAfterEnter: vue.unref(afterEnter),
  29613. onAfterLeave: vue.unref(afterLeave),
  29614. onBeforeLeave: vue.unref(beforeLeave),
  29615. persisted: ""
  29616. }, {
  29617. default: vue.withCtx(() => [
  29618. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  29619. mask: _ctx.modal,
  29620. "overlay-class": _ctx.modalClass,
  29621. "z-index": vue.unref(zIndex),
  29622. onClick: vue.unref(onModalClick)
  29623. }, {
  29624. default: vue.withCtx(() => [
  29625. vue.createVNode(vue.unref(ElFocusTrap), {
  29626. loop: "",
  29627. trapped: vue.unref(visible),
  29628. "focus-trap-el": drawerRef.value,
  29629. "focus-start-el": focusStartRef.value,
  29630. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  29631. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  29632. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  29633. onReleaseRequested: vue.unref(onCloseRequested)
  29634. }, {
  29635. default: vue.withCtx(() => [
  29636. vue.createElementVNode("div", vue.mergeProps({
  29637. ref_key: "drawerRef",
  29638. ref: drawerRef,
  29639. "aria-modal": "true",
  29640. "aria-label": _ctx.title || void 0,
  29641. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  29642. "aria-describedby": vue.unref(bodyId)
  29643. }, _ctx.$attrs, {
  29644. class: [vue.unref(ns).b(), _ctx.direction, vue.unref(visible) && "open"],
  29645. style: vue.unref(isHorizontal) ? "width: " + vue.unref(drawerSize) : "height: " + vue.unref(drawerSize),
  29646. role: "dialog",
  29647. onClick: vue.withModifiers(() => {
  29648. }, ["stop"])
  29649. }), [
  29650. vue.createElementVNode("span", {
  29651. ref_key: "focusStartRef",
  29652. ref: focusStartRef,
  29653. class: vue.normalizeClass(vue.unref(ns).e("sr-focus")),
  29654. tabindex: "-1"
  29655. }, null, 2),
  29656. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  29657. key: 0,
  29658. class: vue.normalizeClass(vue.unref(ns).e("header"))
  29659. }, [
  29660. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  29661. key: 0,
  29662. close: vue.unref(handleClose),
  29663. titleId: vue.unref(titleId),
  29664. titleClass: vue.unref(ns).e("title")
  29665. }, () => [
  29666. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  29667. key: 0,
  29668. id: vue.unref(titleId),
  29669. role: "heading",
  29670. "aria-level": _ctx.headerAriaLevel,
  29671. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29672. }, vue.toDisplayString(_ctx.title), 11, ["id", "aria-level"])) : vue.createCommentVNode("v-if", true)
  29673. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  29674. vue.createCommentVNode(" DEPRECATED SLOT ")
  29675. ]),
  29676. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  29677. key: 2,
  29678. "aria-label": vue.unref(t)("el.drawer.close"),
  29679. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  29680. type: "button",
  29681. onClick: vue.unref(handleClose)
  29682. }, [
  29683. vue.createVNode(vue.unref(ElIcon), {
  29684. class: vue.normalizeClass(vue.unref(ns).e("close"))
  29685. }, {
  29686. default: vue.withCtx(() => [
  29687. vue.createVNode(vue.unref(close_default))
  29688. ]),
  29689. _: 1
  29690. }, 8, ["class"])
  29691. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  29692. ], 2)) : vue.createCommentVNode("v-if", true),
  29693. vue.unref(rendered) ? (vue.openBlock(), vue.createElementBlock("div", {
  29694. key: 1,
  29695. id: vue.unref(bodyId),
  29696. class: vue.normalizeClass(vue.unref(ns).e("body"))
  29697. }, [
  29698. vue.renderSlot(_ctx.$slots, "default")
  29699. ], 10, ["id"])) : vue.createCommentVNode("v-if", true),
  29700. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  29701. key: 2,
  29702. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  29703. }, [
  29704. vue.renderSlot(_ctx.$slots, "footer")
  29705. ], 2)) : vue.createCommentVNode("v-if", true)
  29706. ], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
  29707. ]),
  29708. _: 3
  29709. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29710. ]),
  29711. _: 3
  29712. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  29713. [vue.vShow, vue.unref(visible)]
  29714. ])
  29715. ]),
  29716. _: 3
  29717. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29718. ]),
  29719. _: 3
  29720. }, 8, ["to", "disabled"]);
  29721. };
  29722. }
  29723. });
  29724. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "drawer.vue"]]);
  29725. const ElDrawer = withInstall(Drawer);
  29726. const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
  29727. inheritAttrs: false
  29728. });
  29729. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  29730. return vue.renderSlot(_ctx.$slots, "default");
  29731. }
  29732. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["render", _sfc_render$n], ["__file", "collection.vue"]]);
  29733. const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
  29734. name: "ElCollectionItem",
  29735. inheritAttrs: false
  29736. });
  29737. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  29738. return vue.renderSlot(_ctx.$slots, "default");
  29739. }
  29740. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$m], ["__file", "collection-item.vue"]]);
  29741. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  29742. const createCollectionWithScope = (name) => {
  29743. const COLLECTION_NAME = `El${name}Collection`;
  29744. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  29745. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  29746. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  29747. const ElCollection = {
  29748. ...Collection,
  29749. name: COLLECTION_NAME,
  29750. setup() {
  29751. const collectionRef = vue.ref(null);
  29752. const itemMap = /* @__PURE__ */ new Map();
  29753. const getItems = () => {
  29754. const collectionEl = vue.unref(collectionRef);
  29755. if (!collectionEl)
  29756. return [];
  29757. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  29758. const items = [...itemMap.values()];
  29759. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  29760. };
  29761. vue.provide(COLLECTION_INJECTION_KEY, {
  29762. itemMap,
  29763. getItems,
  29764. collectionRef
  29765. });
  29766. }
  29767. };
  29768. const ElCollectionItem = {
  29769. ...CollectionItem,
  29770. name: COLLECTION_ITEM_NAME,
  29771. setup(_, { attrs }) {
  29772. const collectionItemRef = vue.ref(null);
  29773. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  29774. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  29775. collectionItemRef
  29776. });
  29777. vue.onMounted(() => {
  29778. const collectionItemEl = vue.unref(collectionItemRef);
  29779. if (collectionItemEl) {
  29780. collectionInjection.itemMap.set(collectionItemEl, {
  29781. ref: collectionItemEl,
  29782. ...attrs
  29783. });
  29784. }
  29785. });
  29786. vue.onBeforeUnmount(() => {
  29787. const collectionItemEl = vue.unref(collectionItemRef);
  29788. collectionInjection.itemMap.delete(collectionItemEl);
  29789. });
  29790. }
  29791. };
  29792. return {
  29793. COLLECTION_INJECTION_KEY,
  29794. COLLECTION_ITEM_INJECTION_KEY,
  29795. ElCollection,
  29796. ElCollectionItem
  29797. };
  29798. };
  29799. const rovingFocusGroupProps = buildProps({
  29800. style: { type: definePropType([String, Array, Object]) },
  29801. currentTabId: {
  29802. type: definePropType(String)
  29803. },
  29804. defaultCurrentTabId: String,
  29805. loop: Boolean,
  29806. dir: {
  29807. type: String,
  29808. values: ["ltr", "rtl"],
  29809. default: "ltr"
  29810. },
  29811. orientation: {
  29812. type: definePropType(String)
  29813. },
  29814. onBlur: Function,
  29815. onFocus: Function,
  29816. onMousedown: Function
  29817. });
  29818. const {
  29819. ElCollection: ElCollection$1,
  29820. ElCollectionItem: ElCollectionItem$1,
  29821. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  29822. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  29823. } = createCollectionWithScope("RovingFocusGroup");
  29824. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  29825. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  29826. const MAP_KEY_TO_FOCUS_INTENT = {
  29827. ArrowLeft: "prev",
  29828. ArrowUp: "prev",
  29829. ArrowRight: "next",
  29830. ArrowDown: "next",
  29831. PageUp: "first",
  29832. Home: "first",
  29833. PageDown: "last",
  29834. End: "last"
  29835. };
  29836. const getDirectionAwareKey = (key, dir) => {
  29837. if (dir !== "rtl")
  29838. return key;
  29839. switch (key) {
  29840. case EVENT_CODE.right:
  29841. return EVENT_CODE.left;
  29842. case EVENT_CODE.left:
  29843. return EVENT_CODE.right;
  29844. default:
  29845. return key;
  29846. }
  29847. };
  29848. const getFocusIntent = (event, orientation, dir) => {
  29849. const key = getDirectionAwareKey(event.key, dir);
  29850. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  29851. return void 0;
  29852. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  29853. return void 0;
  29854. return MAP_KEY_TO_FOCUS_INTENT[key];
  29855. };
  29856. const reorderArray = (array, atIdx) => {
  29857. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  29858. };
  29859. const focusFirst = (elements) => {
  29860. const { activeElement: prevActive } = document;
  29861. for (const element of elements) {
  29862. if (element === prevActive)
  29863. return;
  29864. element.focus();
  29865. if (prevActive !== document.activeElement)
  29866. return;
  29867. }
  29868. };
  29869. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  29870. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  29871. const EVT_OPTS = { bubbles: false, cancelable: true };
  29872. const _sfc_main$1h = vue.defineComponent({
  29873. name: "ElRovingFocusGroupImpl",
  29874. inheritAttrs: false,
  29875. props: rovingFocusGroupProps,
  29876. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  29877. setup(props, { emit }) {
  29878. var _a;
  29879. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  29880. const isBackingOut = vue.ref(false);
  29881. const isClickFocus = vue.ref(false);
  29882. const rovingFocusGroupRef = vue.ref(null);
  29883. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  29884. const rovingFocusGroupRootStyle = vue.computed(() => {
  29885. return [
  29886. {
  29887. outline: "none"
  29888. },
  29889. props.style
  29890. ];
  29891. });
  29892. const onItemFocus = (tabbedId) => {
  29893. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  29894. };
  29895. const onItemShiftTab = () => {
  29896. isBackingOut.value = true;
  29897. };
  29898. const onMousedown = composeEventHandlers((e) => {
  29899. var _a2;
  29900. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  29901. }, () => {
  29902. isClickFocus.value = true;
  29903. });
  29904. const onFocus = composeEventHandlers((e) => {
  29905. var _a2;
  29906. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  29907. }, (e) => {
  29908. const isKeyboardFocus = !vue.unref(isClickFocus);
  29909. const { target, currentTarget } = e;
  29910. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  29911. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  29912. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  29913. if (!entryFocusEvt.defaultPrevented) {
  29914. const items = getItems().filter((item) => item.focusable);
  29915. const activeItem = items.find((item) => item.active);
  29916. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  29917. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  29918. const candidateNodes = candidates.map((item) => item.ref);
  29919. focusFirst(candidateNodes);
  29920. }
  29921. }
  29922. isClickFocus.value = false;
  29923. });
  29924. const onBlur = composeEventHandlers((e) => {
  29925. var _a2;
  29926. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  29927. }, () => {
  29928. isBackingOut.value = false;
  29929. });
  29930. const handleEntryFocus = (...args) => {
  29931. emit("entryFocus", ...args);
  29932. };
  29933. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  29934. currentTabbedId: vue.readonly(currentTabbedId),
  29935. loop: vue.toRef(props, "loop"),
  29936. tabIndex: vue.computed(() => {
  29937. return vue.unref(isBackingOut) ? -1 : 0;
  29938. }),
  29939. rovingFocusGroupRef,
  29940. rovingFocusGroupRootStyle,
  29941. orientation: vue.toRef(props, "orientation"),
  29942. dir: vue.toRef(props, "dir"),
  29943. onItemFocus,
  29944. onItemShiftTab,
  29945. onBlur,
  29946. onFocus,
  29947. onMousedown
  29948. });
  29949. vue.watch(() => props.currentTabId, (val) => {
  29950. currentTabbedId.value = val != null ? val : null;
  29951. });
  29952. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  29953. }
  29954. });
  29955. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  29956. return vue.renderSlot(_ctx.$slots, "default");
  29957. }
  29958. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$l], ["__file", "roving-focus-group-impl.vue"]]);
  29959. const _sfc_main$1g = vue.defineComponent({
  29960. name: "ElRovingFocusGroup",
  29961. components: {
  29962. ElFocusGroupCollection: ElCollection$1,
  29963. ElRovingFocusGroupImpl
  29964. }
  29965. });
  29966. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  29967. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  29968. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  29969. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  29970. default: vue.withCtx(() => [
  29971. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  29972. default: vue.withCtx(() => [
  29973. vue.renderSlot(_ctx.$slots, "default")
  29974. ]),
  29975. _: 3
  29976. }, 16)
  29977. ]),
  29978. _: 3
  29979. });
  29980. }
  29981. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$k], ["__file", "roving-focus-group.vue"]]);
  29982. const _sfc_main$1f = vue.defineComponent({
  29983. components: {
  29984. ElRovingFocusCollectionItem: ElCollectionItem$1
  29985. },
  29986. props: {
  29987. focusable: {
  29988. type: Boolean,
  29989. default: true
  29990. },
  29991. active: {
  29992. type: Boolean,
  29993. default: false
  29994. }
  29995. },
  29996. emits: ["mousedown", "focus", "keydown"],
  29997. setup(props, { emit }) {
  29998. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  29999. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30000. const id = useId();
  30001. const rovingFocusGroupItemRef = vue.ref(null);
  30002. const handleMousedown = composeEventHandlers((e) => {
  30003. emit("mousedown", e);
  30004. }, (e) => {
  30005. if (!props.focusable) {
  30006. e.preventDefault();
  30007. } else {
  30008. onItemFocus(vue.unref(id));
  30009. }
  30010. });
  30011. const handleFocus = composeEventHandlers((e) => {
  30012. emit("focus", e);
  30013. }, () => {
  30014. onItemFocus(vue.unref(id));
  30015. });
  30016. const handleKeydown = composeEventHandlers((e) => {
  30017. emit("keydown", e);
  30018. }, (e) => {
  30019. const { key, shiftKey, target, currentTarget } = e;
  30020. if (key === EVENT_CODE.tab && shiftKey) {
  30021. onItemShiftTab();
  30022. return;
  30023. }
  30024. if (target !== currentTarget)
  30025. return;
  30026. const focusIntent = getFocusIntent(e);
  30027. if (focusIntent) {
  30028. e.preventDefault();
  30029. const items = getItems().filter((item) => item.focusable);
  30030. let elements = items.map((item) => item.ref);
  30031. switch (focusIntent) {
  30032. case "last": {
  30033. elements.reverse();
  30034. break;
  30035. }
  30036. case "prev":
  30037. case "next": {
  30038. if (focusIntent === "prev") {
  30039. elements.reverse();
  30040. }
  30041. const currentIdx = elements.indexOf(currentTarget);
  30042. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  30043. break;
  30044. }
  30045. }
  30046. vue.nextTick(() => {
  30047. focusFirst(elements);
  30048. });
  30049. }
  30050. });
  30051. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  30052. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  30053. rovingFocusGroupItemRef,
  30054. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  30055. handleMousedown,
  30056. handleFocus,
  30057. handleKeydown
  30058. });
  30059. return {
  30060. id,
  30061. handleKeydown,
  30062. handleFocus,
  30063. handleMousedown
  30064. };
  30065. }
  30066. });
  30067. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  30068. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  30069. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  30070. id: _ctx.id,
  30071. focusable: _ctx.focusable,
  30072. active: _ctx.active
  30073. }, {
  30074. default: vue.withCtx(() => [
  30075. vue.renderSlot(_ctx.$slots, "default")
  30076. ]),
  30077. _: 3
  30078. }, 8, ["id", "focusable", "active"]);
  30079. }
  30080. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$j], ["__file", "roving-focus-item.vue"]]);
  30081. const dropdownProps = buildProps({
  30082. trigger: useTooltipTriggerProps.trigger,
  30083. effect: {
  30084. ...useTooltipContentProps.effect,
  30085. default: "light"
  30086. },
  30087. type: {
  30088. type: definePropType(String)
  30089. },
  30090. placement: {
  30091. type: definePropType(String),
  30092. default: "bottom"
  30093. },
  30094. popperOptions: {
  30095. type: definePropType(Object),
  30096. default: () => ({})
  30097. },
  30098. id: String,
  30099. size: {
  30100. type: String,
  30101. default: ""
  30102. },
  30103. splitButton: Boolean,
  30104. hideOnClick: {
  30105. type: Boolean,
  30106. default: true
  30107. },
  30108. loop: {
  30109. type: Boolean,
  30110. default: true
  30111. },
  30112. showTimeout: {
  30113. type: Number,
  30114. default: 150
  30115. },
  30116. hideTimeout: {
  30117. type: Number,
  30118. default: 150
  30119. },
  30120. tabindex: {
  30121. type: definePropType([Number, String]),
  30122. default: 0
  30123. },
  30124. maxHeight: {
  30125. type: definePropType([Number, String]),
  30126. default: ""
  30127. },
  30128. popperClass: {
  30129. type: String,
  30130. default: ""
  30131. },
  30132. disabled: Boolean,
  30133. role: {
  30134. type: String,
  30135. default: "menu"
  30136. },
  30137. buttonProps: {
  30138. type: definePropType(Object)
  30139. },
  30140. teleported: useTooltipContentProps.teleported
  30141. });
  30142. const dropdownItemProps = buildProps({
  30143. command: {
  30144. type: [Object, String, Number],
  30145. default: () => ({})
  30146. },
  30147. disabled: Boolean,
  30148. divided: Boolean,
  30149. textValue: String,
  30150. icon: {
  30151. type: iconPropType
  30152. }
  30153. });
  30154. const dropdownMenuProps = buildProps({
  30155. onKeydown: { type: definePropType(Function) }
  30156. });
  30157. const FIRST_KEYS = [
  30158. EVENT_CODE.down,
  30159. EVENT_CODE.pageDown,
  30160. EVENT_CODE.home
  30161. ];
  30162. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  30163. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  30164. const {
  30165. ElCollection,
  30166. ElCollectionItem,
  30167. COLLECTION_INJECTION_KEY,
  30168. COLLECTION_ITEM_INJECTION_KEY
  30169. } = createCollectionWithScope("Dropdown");
  30170. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  30171. const { ButtonGroup: ElButtonGroup } = ElButton;
  30172. const _sfc_main$1e = vue.defineComponent({
  30173. name: "ElDropdown",
  30174. components: {
  30175. ElButton,
  30176. ElButtonGroup,
  30177. ElScrollbar,
  30178. ElDropdownCollection: ElCollection,
  30179. ElTooltip,
  30180. ElRovingFocusGroup,
  30181. ElOnlyChild: OnlyChild,
  30182. ElIcon,
  30183. ArrowDown: arrow_down_default
  30184. },
  30185. props: dropdownProps,
  30186. emits: ["visible-change", "click", "command"],
  30187. setup(props, { emit }) {
  30188. const _instance = vue.getCurrentInstance();
  30189. const ns = useNamespace("dropdown");
  30190. const { t } = useLocale();
  30191. const triggeringElementRef = vue.ref();
  30192. const referenceElementRef = vue.ref();
  30193. const popperRef = vue.ref(null);
  30194. const contentRef = vue.ref(null);
  30195. const scrollbar = vue.ref(null);
  30196. const currentTabId = vue.ref(null);
  30197. const isUsingKeyboard = vue.ref(false);
  30198. const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down];
  30199. const wrapStyle = vue.computed(() => ({
  30200. maxHeight: addUnit(props.maxHeight)
  30201. }));
  30202. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  30203. const trigger = vue.computed(() => castArray$1(props.trigger));
  30204. const defaultTriggerId = useId().value;
  30205. const triggerId = vue.computed(() => props.id || defaultTriggerId);
  30206. vue.watch([triggeringElementRef, trigger], ([triggeringElement, trigger2], [prevTriggeringElement]) => {
  30207. var _a, _b, _c;
  30208. if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) {
  30209. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30210. }
  30211. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  30212. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30213. }
  30214. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger2.includes("hover")) {
  30215. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  30216. }
  30217. }, { immediate: true });
  30218. vue.onBeforeUnmount(() => {
  30219. var _a, _b;
  30220. if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) {
  30221. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30222. }
  30223. });
  30224. function handleClick() {
  30225. handleClose();
  30226. }
  30227. function handleClose() {
  30228. var _a;
  30229. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  30230. }
  30231. function handleOpen() {
  30232. var _a;
  30233. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  30234. }
  30235. const dropdownSize = useFormSize();
  30236. function commandHandler(...args) {
  30237. emit("command", ...args);
  30238. }
  30239. function onAutofocusTriggerEnter() {
  30240. var _a, _b;
  30241. (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus();
  30242. }
  30243. function onItemEnter() {
  30244. }
  30245. function onItemLeave() {
  30246. const contentEl = vue.unref(contentRef);
  30247. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus());
  30248. currentTabId.value = null;
  30249. }
  30250. function handleCurrentTabIdChange(id) {
  30251. currentTabId.value = id;
  30252. }
  30253. function handleEntryFocus(e) {
  30254. if (!isUsingKeyboard.value) {
  30255. e.preventDefault();
  30256. e.stopImmediatePropagation();
  30257. }
  30258. }
  30259. function handleBeforeShowTooltip() {
  30260. emit("visible-change", true);
  30261. }
  30262. function handleShowTooltip(event) {
  30263. if ((event == null ? void 0 : event.type) === "keydown") {
  30264. contentRef.value.focus();
  30265. }
  30266. }
  30267. function handleBeforeHideTooltip() {
  30268. emit("visible-change", false);
  30269. }
  30270. vue.provide(DROPDOWN_INJECTION_KEY, {
  30271. contentRef,
  30272. role: vue.computed(() => props.role),
  30273. triggerId,
  30274. isUsingKeyboard,
  30275. onItemEnter,
  30276. onItemLeave
  30277. });
  30278. vue.provide("elDropdown", {
  30279. instance: _instance,
  30280. dropdownSize,
  30281. handleClick,
  30282. commandHandler,
  30283. trigger: vue.toRef(props, "trigger"),
  30284. hideOnClick: vue.toRef(props, "hideOnClick")
  30285. });
  30286. const onFocusAfterTrapped = (e) => {
  30287. var _a, _b;
  30288. e.preventDefault();
  30289. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  30290. preventScroll: true
  30291. });
  30292. };
  30293. const handlerMainButtonClick = (event) => {
  30294. emit("click", event);
  30295. };
  30296. return {
  30297. t,
  30298. ns,
  30299. scrollbar,
  30300. wrapStyle,
  30301. dropdownTriggerKls,
  30302. dropdownSize,
  30303. triggerId,
  30304. triggerKeys,
  30305. currentTabId,
  30306. handleCurrentTabIdChange,
  30307. handlerMainButtonClick,
  30308. handleEntryFocus,
  30309. handleClose,
  30310. handleOpen,
  30311. handleBeforeShowTooltip,
  30312. handleShowTooltip,
  30313. handleBeforeHideTooltip,
  30314. onFocusAfterTrapped,
  30315. popperRef,
  30316. contentRef,
  30317. triggeringElementRef,
  30318. referenceElementRef
  30319. };
  30320. }
  30321. });
  30322. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  30323. var _a;
  30324. const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection");
  30325. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  30326. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  30327. const _component_el_only_child = vue.resolveComponent("el-only-child");
  30328. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  30329. const _component_el_button = vue.resolveComponent("el-button");
  30330. const _component_arrow_down = vue.resolveComponent("arrow-down");
  30331. const _component_el_icon = vue.resolveComponent("el-icon");
  30332. const _component_el_button_group = vue.resolveComponent("el-button-group");
  30333. return vue.openBlock(), vue.createElementBlock("div", {
  30334. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  30335. }, [
  30336. vue.createVNode(_component_el_tooltip, {
  30337. ref: "popperRef",
  30338. role: _ctx.role,
  30339. effect: _ctx.effect,
  30340. "fallback-placements": ["bottom", "top"],
  30341. "popper-options": _ctx.popperOptions,
  30342. "gpu-acceleration": false,
  30343. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  30344. "manual-mode": true,
  30345. placement: _ctx.placement,
  30346. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  30347. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  30348. trigger: _ctx.trigger,
  30349. "trigger-keys": _ctx.triggerKeys,
  30350. "trigger-target-el": _ctx.contentRef,
  30351. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  30352. "stop-popper-mouse-event": false,
  30353. "virtual-ref": _ctx.triggeringElementRef,
  30354. "virtual-triggering": _ctx.splitButton,
  30355. disabled: _ctx.disabled,
  30356. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  30357. teleported: _ctx.teleported,
  30358. pure: "",
  30359. persistent: "",
  30360. onBeforeShow: _ctx.handleBeforeShowTooltip,
  30361. onShow: _ctx.handleShowTooltip,
  30362. onBeforeHide: _ctx.handleBeforeHideTooltip
  30363. }, vue.createSlots({
  30364. content: vue.withCtx(() => [
  30365. vue.createVNode(_component_el_scrollbar, {
  30366. ref: "scrollbar",
  30367. "wrap-style": _ctx.wrapStyle,
  30368. tag: "div",
  30369. "view-class": _ctx.ns.e("list")
  30370. }, {
  30371. default: vue.withCtx(() => [
  30372. vue.createVNode(_component_el_roving_focus_group, {
  30373. loop: _ctx.loop,
  30374. "current-tab-id": _ctx.currentTabId,
  30375. orientation: "horizontal",
  30376. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  30377. onEntryFocus: _ctx.handleEntryFocus
  30378. }, {
  30379. default: vue.withCtx(() => [
  30380. vue.createVNode(_component_el_dropdown_collection, null, {
  30381. default: vue.withCtx(() => [
  30382. vue.renderSlot(_ctx.$slots, "dropdown")
  30383. ]),
  30384. _: 3
  30385. })
  30386. ]),
  30387. _: 3
  30388. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  30389. ]),
  30390. _: 3
  30391. }, 8, ["wrap-style", "view-class"])
  30392. ]),
  30393. _: 2
  30394. }, [
  30395. !_ctx.splitButton ? {
  30396. name: "default",
  30397. fn: vue.withCtx(() => [
  30398. vue.createVNode(_component_el_only_child, {
  30399. id: _ctx.triggerId,
  30400. ref: "triggeringElementRef",
  30401. role: "button",
  30402. tabindex: _ctx.tabindex
  30403. }, {
  30404. default: vue.withCtx(() => [
  30405. vue.renderSlot(_ctx.$slots, "default")
  30406. ]),
  30407. _: 3
  30408. }, 8, ["id", "tabindex"])
  30409. ])
  30410. } : void 0
  30411. ]), 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"]),
  30412. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  30413. default: vue.withCtx(() => [
  30414. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  30415. size: _ctx.dropdownSize,
  30416. type: _ctx.type,
  30417. disabled: _ctx.disabled,
  30418. tabindex: _ctx.tabindex,
  30419. onClick: _ctx.handlerMainButtonClick
  30420. }), {
  30421. default: vue.withCtx(() => [
  30422. vue.renderSlot(_ctx.$slots, "default")
  30423. ]),
  30424. _: 3
  30425. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  30426. vue.createVNode(_component_el_button, vue.mergeProps({
  30427. id: _ctx.triggerId,
  30428. ref: "triggeringElementRef"
  30429. }, _ctx.buttonProps, {
  30430. role: "button",
  30431. size: _ctx.dropdownSize,
  30432. type: _ctx.type,
  30433. class: _ctx.ns.e("caret-button"),
  30434. disabled: _ctx.disabled,
  30435. tabindex: _ctx.tabindex,
  30436. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  30437. }), {
  30438. default: vue.withCtx(() => [
  30439. vue.createVNode(_component_el_icon, {
  30440. class: vue.normalizeClass(_ctx.ns.e("icon"))
  30441. }, {
  30442. default: vue.withCtx(() => [
  30443. vue.createVNode(_component_arrow_down)
  30444. ]),
  30445. _: 1
  30446. }, 8, ["class"])
  30447. ]),
  30448. _: 1
  30449. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  30450. ]),
  30451. _: 3
  30452. })) : vue.createCommentVNode("v-if", true)
  30453. ], 2);
  30454. }
  30455. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$i], ["__file", "dropdown.vue"]]);
  30456. const _sfc_main$1d = vue.defineComponent({
  30457. name: "DropdownItemImpl",
  30458. components: {
  30459. ElIcon
  30460. },
  30461. props: dropdownItemProps,
  30462. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  30463. setup(_, { emit }) {
  30464. const ns = useNamespace("dropdown");
  30465. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30466. const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  30467. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  30468. const {
  30469. rovingFocusGroupItemRef,
  30470. tabIndex,
  30471. handleFocus,
  30472. handleKeydown: handleItemKeydown,
  30473. handleMousedown
  30474. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  30475. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  30476. const role = vue.computed(() => {
  30477. if (menuRole.value === "menu") {
  30478. return "menuitem";
  30479. } else if (menuRole.value === "navigation") {
  30480. return "link";
  30481. }
  30482. return "button";
  30483. });
  30484. const handleKeydown = composeEventHandlers((e) => {
  30485. const { code } = e;
  30486. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  30487. e.preventDefault();
  30488. e.stopImmediatePropagation();
  30489. emit("clickimpl", e);
  30490. return true;
  30491. }
  30492. }, handleItemKeydown);
  30493. return {
  30494. ns,
  30495. itemRef,
  30496. dataset: {
  30497. [COLLECTION_ITEM_SIGN]: ""
  30498. },
  30499. role,
  30500. tabIndex,
  30501. handleFocus,
  30502. handleKeydown,
  30503. handleMousedown
  30504. };
  30505. }
  30506. });
  30507. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  30508. const _component_el_icon = vue.resolveComponent("el-icon");
  30509. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  30510. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", vue.mergeProps({
  30511. key: 0,
  30512. role: "separator",
  30513. class: _ctx.ns.bem("menu", "item", "divided")
  30514. }, _ctx.$attrs), null, 16)) : vue.createCommentVNode("v-if", true),
  30515. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  30516. "aria-disabled": _ctx.disabled,
  30517. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  30518. tabindex: _ctx.tabIndex,
  30519. role: _ctx.role,
  30520. onClick: (e) => _ctx.$emit("clickimpl", e),
  30521. onFocus: _ctx.handleFocus,
  30522. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  30523. onMousedown: _ctx.handleMousedown,
  30524. onPointermove: (e) => _ctx.$emit("pointermove", e),
  30525. onPointerleave: (e) => _ctx.$emit("pointerleave", e)
  30526. }), [
  30527. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  30528. default: vue.withCtx(() => [
  30529. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  30530. ]),
  30531. _: 1
  30532. })) : vue.createCommentVNode("v-if", true),
  30533. vue.renderSlot(_ctx.$slots, "default")
  30534. ], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
  30535. ], 64);
  30536. }
  30537. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$h], ["__file", "dropdown-item-impl.vue"]]);
  30538. const useDropdown = () => {
  30539. const elDropdown = vue.inject("elDropdown", {});
  30540. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  30541. return {
  30542. elDropdown,
  30543. _elDropdownSize
  30544. };
  30545. };
  30546. const _sfc_main$1c = vue.defineComponent({
  30547. name: "ElDropdownItem",
  30548. components: {
  30549. ElDropdownCollectionItem: ElCollectionItem,
  30550. ElRovingFocusItem,
  30551. ElDropdownItemImpl
  30552. },
  30553. inheritAttrs: false,
  30554. props: dropdownItemProps,
  30555. emits: ["pointermove", "pointerleave", "click"],
  30556. setup(props, { emit, attrs }) {
  30557. const { elDropdown } = useDropdown();
  30558. const _instance = vue.getCurrentInstance();
  30559. const itemRef = vue.ref(null);
  30560. const textContent = vue.computed(() => {
  30561. var _a, _b;
  30562. return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  30563. });
  30564. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30565. const handlePointerMove = composeEventHandlers((e) => {
  30566. emit("pointermove", e);
  30567. return e.defaultPrevented;
  30568. }, whenMouse((e) => {
  30569. if (props.disabled) {
  30570. onItemLeave(e);
  30571. return;
  30572. }
  30573. const target = e.currentTarget;
  30574. if (target === document.activeElement || target.contains(document.activeElement)) {
  30575. return;
  30576. }
  30577. onItemEnter(e);
  30578. if (!e.defaultPrevented) {
  30579. target == null ? void 0 : target.focus();
  30580. }
  30581. }));
  30582. const handlePointerLeave = composeEventHandlers((e) => {
  30583. emit("pointerleave", e);
  30584. return e.defaultPrevented;
  30585. }, whenMouse(onItemLeave));
  30586. const handleClick = composeEventHandlers((e) => {
  30587. if (props.disabled) {
  30588. return;
  30589. }
  30590. emit("click", e);
  30591. return e.type !== "keydown" && e.defaultPrevented;
  30592. }, (e) => {
  30593. var _a, _b, _c;
  30594. if (props.disabled) {
  30595. e.stopImmediatePropagation();
  30596. return;
  30597. }
  30598. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  30599. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  30600. }
  30601. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  30602. });
  30603. const propsAndAttrs = vue.computed(() => ({ ...props, ...attrs }));
  30604. return {
  30605. handleClick,
  30606. handlePointerMove,
  30607. handlePointerLeave,
  30608. textContent,
  30609. propsAndAttrs
  30610. };
  30611. }
  30612. });
  30613. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  30614. var _a;
  30615. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  30616. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  30617. const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item");
  30618. return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, {
  30619. disabled: _ctx.disabled,
  30620. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  30621. }, {
  30622. default: vue.withCtx(() => [
  30623. vue.createVNode(_component_el_roving_focus_item, {
  30624. focusable: !_ctx.disabled
  30625. }, {
  30626. default: vue.withCtx(() => [
  30627. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  30628. onPointerleave: _ctx.handlePointerLeave,
  30629. onPointermove: _ctx.handlePointerMove,
  30630. onClickimpl: _ctx.handleClick
  30631. }), {
  30632. default: vue.withCtx(() => [
  30633. vue.renderSlot(_ctx.$slots, "default")
  30634. ]),
  30635. _: 3
  30636. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  30637. ]),
  30638. _: 3
  30639. }, 8, ["focusable"])
  30640. ]),
  30641. _: 3
  30642. }, 8, ["disabled", "text-value"]);
  30643. }
  30644. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["render", _sfc_render$g], ["__file", "dropdown-item.vue"]]);
  30645. const _sfc_main$1b = vue.defineComponent({
  30646. name: "ElDropdownMenu",
  30647. props: dropdownMenuProps,
  30648. setup(props) {
  30649. const ns = useNamespace("dropdown");
  30650. const { _elDropdownSize } = useDropdown();
  30651. const size = _elDropdownSize.value;
  30652. const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  30653. const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30654. const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  30655. const {
  30656. rovingFocusGroupRef,
  30657. rovingFocusGroupRootStyle,
  30658. tabIndex,
  30659. onBlur,
  30660. onFocus,
  30661. onMousedown
  30662. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30663. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30664. const dropdownKls = vue.computed(() => {
  30665. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  30666. });
  30667. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  30668. const composedKeydown = composeEventHandlers((e) => {
  30669. var _a;
  30670. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  30671. }, (e) => {
  30672. const { currentTarget, code, target } = e;
  30673. currentTarget.contains(target);
  30674. if (EVENT_CODE.tab === code) {
  30675. e.stopImmediatePropagation();
  30676. }
  30677. e.preventDefault();
  30678. if (target !== vue.unref(contentRef) || !FIRST_LAST_KEYS.includes(code))
  30679. return;
  30680. const items = getItems().filter((item) => !item.disabled);
  30681. const targets = items.map((item) => item.ref);
  30682. if (LAST_KEYS.includes(code)) {
  30683. targets.reverse();
  30684. }
  30685. focusFirst(targets);
  30686. });
  30687. const handleKeydown = (e) => {
  30688. composedKeydown(e);
  30689. onKeydown(e);
  30690. };
  30691. return {
  30692. size,
  30693. rovingFocusGroupRootStyle,
  30694. tabIndex,
  30695. dropdownKls,
  30696. role,
  30697. triggerId,
  30698. dropdownListWrapperRef,
  30699. handleKeydown,
  30700. onBlur,
  30701. onFocus,
  30702. onMousedown
  30703. };
  30704. }
  30705. });
  30706. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  30707. return vue.openBlock(), vue.createElementBlock("ul", {
  30708. ref: _ctx.dropdownListWrapperRef,
  30709. class: vue.normalizeClass(_ctx.dropdownKls),
  30710. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  30711. tabindex: -1,
  30712. role: _ctx.role,
  30713. "aria-labelledby": _ctx.triggerId,
  30714. onBlur: _ctx.onBlur,
  30715. onFocus: _ctx.onFocus,
  30716. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  30717. onMousedown: vue.withModifiers(_ctx.onMousedown, ["self"])
  30718. }, [
  30719. vue.renderSlot(_ctx.$slots, "default")
  30720. ], 46, ["role", "aria-labelledby", "onBlur", "onFocus", "onKeydown", "onMousedown"]);
  30721. }
  30722. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["render", _sfc_render$f], ["__file", "dropdown-menu.vue"]]);
  30723. const ElDropdown = withInstall(Dropdown, {
  30724. DropdownItem,
  30725. DropdownMenu
  30726. });
  30727. const ElDropdownItem = withNoopInstall(DropdownItem);
  30728. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  30729. const __default__$V = vue.defineComponent({
  30730. name: "ImgEmpty"
  30731. });
  30732. const _sfc_main$1a = /* @__PURE__ */ vue.defineComponent({
  30733. ...__default__$V,
  30734. setup(__props) {
  30735. const ns = useNamespace("empty");
  30736. const id = useId();
  30737. return (_ctx, _cache) => {
  30738. return vue.openBlock(), vue.createElementBlock("svg", {
  30739. viewBox: "0 0 79 86",
  30740. version: "1.1",
  30741. xmlns: "http://www.w3.org/2000/svg",
  30742. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  30743. }, [
  30744. vue.createElementVNode("defs", null, [
  30745. vue.createElementVNode("linearGradient", {
  30746. id: `linearGradient-1-${vue.unref(id)}`,
  30747. x1: "38.8503086%",
  30748. y1: "0%",
  30749. x2: "61.1496914%",
  30750. y2: "100%"
  30751. }, [
  30752. vue.createElementVNode("stop", {
  30753. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  30754. offset: "0%"
  30755. }, null, 8, ["stop-color"]),
  30756. vue.createElementVNode("stop", {
  30757. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-4")})`,
  30758. offset: "100%"
  30759. }, null, 8, ["stop-color"])
  30760. ], 8, ["id"]),
  30761. vue.createElementVNode("linearGradient", {
  30762. id: `linearGradient-2-${vue.unref(id)}`,
  30763. x1: "0%",
  30764. y1: "9.5%",
  30765. x2: "100%",
  30766. y2: "90.5%"
  30767. }, [
  30768. vue.createElementVNode("stop", {
  30769. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  30770. offset: "0%"
  30771. }, null, 8, ["stop-color"]),
  30772. vue.createElementVNode("stop", {
  30773. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-6")})`,
  30774. offset: "100%"
  30775. }, null, 8, ["stop-color"])
  30776. ], 8, ["id"]),
  30777. vue.createElementVNode("rect", {
  30778. id: `path-3-${vue.unref(id)}`,
  30779. x: "0",
  30780. y: "0",
  30781. width: "17",
  30782. height: "36"
  30783. }, null, 8, ["id"])
  30784. ]),
  30785. vue.createElementVNode("g", {
  30786. id: "Illustrations",
  30787. stroke: "none",
  30788. "stroke-width": "1",
  30789. fill: "none",
  30790. "fill-rule": "evenodd"
  30791. }, [
  30792. vue.createElementVNode("g", {
  30793. id: "B-type",
  30794. transform: "translate(-1268.000000, -535.000000)"
  30795. }, [
  30796. vue.createElementVNode("g", {
  30797. id: "Group-2",
  30798. transform: "translate(1268.000000, 535.000000)"
  30799. }, [
  30800. vue.createElementVNode("path", {
  30801. id: "Oval-Copy-2",
  30802. 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",
  30803. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-3")})`
  30804. }, null, 8, ["fill"]),
  30805. vue.createElementVNode("polygon", {
  30806. id: "Rectangle-Copy-14",
  30807. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  30808. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  30809. points: "13 58 53 58 42 45 2 45"
  30810. }, null, 8, ["fill"]),
  30811. vue.createElementVNode("g", {
  30812. id: "Group-Copy",
  30813. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  30814. }, [
  30815. vue.createElementVNode("polygon", {
  30816. id: "Rectangle-Copy-10",
  30817. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  30818. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  30819. points: "2.84078316e-14 3 18 3 23 7 5 7"
  30820. }, null, 8, ["fill"]),
  30821. vue.createElementVNode("polygon", {
  30822. id: "Rectangle-Copy-11",
  30823. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-5")})`,
  30824. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  30825. }, null, 8, ["fill"]),
  30826. vue.createElementVNode("rect", {
  30827. id: "Rectangle-Copy-12",
  30828. fill: `url(#linearGradient-1-${vue.unref(id)})`,
  30829. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  30830. x: "38",
  30831. y: "7",
  30832. width: "17",
  30833. height: "36"
  30834. }, null, 8, ["fill"]),
  30835. vue.createElementVNode("polygon", {
  30836. id: "Rectangle-Copy-13",
  30837. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  30838. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  30839. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  30840. }, null, 8, ["fill"])
  30841. ]),
  30842. vue.createElementVNode("rect", {
  30843. id: "Rectangle-Copy-15",
  30844. fill: `url(#linearGradient-2-${vue.unref(id)})`,
  30845. x: "13",
  30846. y: "45",
  30847. width: "40",
  30848. height: "36"
  30849. }, null, 8, ["fill"]),
  30850. vue.createElementVNode("g", {
  30851. id: "Rectangle-Copy-17",
  30852. transform: "translate(53.000000, 45.000000)"
  30853. }, [
  30854. vue.createElementVNode("use", {
  30855. id: "Mask",
  30856. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-8")})`,
  30857. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  30858. "xlink:href": `#path-3-${vue.unref(id)}`
  30859. }, null, 8, ["fill", "xlink:href"]),
  30860. vue.createElementVNode("polygon", {
  30861. id: "Rectangle-Copy",
  30862. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-9")})`,
  30863. mask: `url(#mask-4-${vue.unref(id)})`,
  30864. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  30865. points: "7 0 24 0 20 18 7 16.5"
  30866. }, null, 8, ["fill", "mask"])
  30867. ]),
  30868. vue.createElementVNode("polygon", {
  30869. id: "Rectangle-Copy-18",
  30870. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  30871. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  30872. points: "62 45 79 45 70 58 53 58"
  30873. }, null, 8, ["fill"])
  30874. ])
  30875. ])
  30876. ])
  30877. ]);
  30878. };
  30879. }
  30880. });
  30881. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__file", "img-empty.vue"]]);
  30882. const emptyProps = buildProps({
  30883. image: {
  30884. type: String,
  30885. default: ""
  30886. },
  30887. imageSize: Number,
  30888. description: {
  30889. type: String,
  30890. default: ""
  30891. }
  30892. });
  30893. const __default__$U = vue.defineComponent({
  30894. name: "ElEmpty"
  30895. });
  30896. const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
  30897. ...__default__$U,
  30898. props: emptyProps,
  30899. setup(__props) {
  30900. const props = __props;
  30901. const { t } = useLocale();
  30902. const ns = useNamespace("empty");
  30903. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  30904. const imageStyle = vue.computed(() => ({
  30905. width: addUnit(props.imageSize)
  30906. }));
  30907. return (_ctx, _cache) => {
  30908. return vue.openBlock(), vue.createElementBlock("div", {
  30909. class: vue.normalizeClass(vue.unref(ns).b())
  30910. }, [
  30911. vue.createElementVNode("div", {
  30912. class: vue.normalizeClass(vue.unref(ns).e("image")),
  30913. style: vue.normalizeStyle(vue.unref(imageStyle))
  30914. }, [
  30915. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  30916. key: 0,
  30917. src: _ctx.image,
  30918. ondragstart: "return false"
  30919. }, null, 8, ["src"])) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  30920. vue.createVNode(ImgEmpty)
  30921. ])
  30922. ], 6),
  30923. vue.createElementVNode("div", {
  30924. class: vue.normalizeClass(vue.unref(ns).e("description"))
  30925. }, [
  30926. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", { key: 1 }, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  30927. ], 2),
  30928. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  30929. key: 0,
  30930. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  30931. }, [
  30932. vue.renderSlot(_ctx.$slots, "default")
  30933. ], 2)) : vue.createCommentVNode("v-if", true)
  30934. ], 2);
  30935. };
  30936. }
  30937. });
  30938. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__file", "empty.vue"]]);
  30939. const ElEmpty = withInstall(Empty);
  30940. const imageViewerProps = buildProps({
  30941. urlList: {
  30942. type: definePropType(Array),
  30943. default: () => mutable([])
  30944. },
  30945. zIndex: {
  30946. type: Number
  30947. },
  30948. initialIndex: {
  30949. type: Number,
  30950. default: 0
  30951. },
  30952. infinite: {
  30953. type: Boolean,
  30954. default: true
  30955. },
  30956. hideOnClickModal: Boolean,
  30957. teleported: Boolean,
  30958. closeOnPressEscape: {
  30959. type: Boolean,
  30960. default: true
  30961. },
  30962. zoomRate: {
  30963. type: Number,
  30964. default: 1.2
  30965. },
  30966. minScale: {
  30967. type: Number,
  30968. default: 0.2
  30969. },
  30970. maxScale: {
  30971. type: Number,
  30972. default: 7
  30973. },
  30974. crossorigin: {
  30975. type: definePropType(String)
  30976. }
  30977. });
  30978. const imageViewerEmits = {
  30979. close: () => true,
  30980. switch: (index) => isNumber(index),
  30981. rotate: (deg) => isNumber(deg)
  30982. };
  30983. const __default__$T = vue.defineComponent({
  30984. name: "ElImageViewer"
  30985. });
  30986. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  30987. ...__default__$T,
  30988. props: imageViewerProps,
  30989. emits: imageViewerEmits,
  30990. setup(__props, { expose, emit }) {
  30991. var _a;
  30992. const props = __props;
  30993. const modes = {
  30994. CONTAIN: {
  30995. name: "contain",
  30996. icon: vue.markRaw(full_screen_default)
  30997. },
  30998. ORIGINAL: {
  30999. name: "original",
  31000. icon: vue.markRaw(scale_to_original_default)
  31001. }
  31002. };
  31003. const { t } = useLocale();
  31004. const ns = useNamespace("image-viewer");
  31005. const { nextZIndex } = useZIndex();
  31006. const wrapper = vue.ref();
  31007. const imgRefs = vue.ref([]);
  31008. const scopeEventListener = vue.effectScope();
  31009. const loading = vue.ref(true);
  31010. const activeIndex = vue.ref(props.initialIndex);
  31011. const mode = vue.shallowRef(modes.CONTAIN);
  31012. const transform = vue.ref({
  31013. scale: 1,
  31014. deg: 0,
  31015. offsetX: 0,
  31016. offsetY: 0,
  31017. enableTransition: false
  31018. });
  31019. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  31020. const isSingle = vue.computed(() => {
  31021. const { urlList } = props;
  31022. return urlList.length <= 1;
  31023. });
  31024. const isFirst = vue.computed(() => {
  31025. return activeIndex.value === 0;
  31026. });
  31027. const isLast = vue.computed(() => {
  31028. return activeIndex.value === props.urlList.length - 1;
  31029. });
  31030. const currentImg = vue.computed(() => {
  31031. return props.urlList[activeIndex.value];
  31032. });
  31033. const arrowPrevKls = vue.computed(() => [
  31034. ns.e("btn"),
  31035. ns.e("prev"),
  31036. ns.is("disabled", !props.infinite && isFirst.value)
  31037. ]);
  31038. const arrowNextKls = vue.computed(() => [
  31039. ns.e("btn"),
  31040. ns.e("next"),
  31041. ns.is("disabled", !props.infinite && isLast.value)
  31042. ]);
  31043. const imgStyle = vue.computed(() => {
  31044. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  31045. let translateX = offsetX / scale;
  31046. let translateY = offsetY / scale;
  31047. const radian = deg * Math.PI / 180;
  31048. const cosRadian = Math.cos(radian);
  31049. const sinRadian = Math.sin(radian);
  31050. translateX = translateX * cosRadian + translateY * sinRadian;
  31051. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  31052. const style = {
  31053. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  31054. transition: enableTransition ? "transform .3s" : ""
  31055. };
  31056. if (mode.value.name === modes.CONTAIN.name) {
  31057. style.maxWidth = style.maxHeight = "100%";
  31058. }
  31059. return style;
  31060. });
  31061. function hide() {
  31062. unregisterEventListener();
  31063. emit("close");
  31064. }
  31065. function registerEventListener() {
  31066. const keydownHandler = throttle((e) => {
  31067. switch (e.code) {
  31068. case EVENT_CODE.esc:
  31069. props.closeOnPressEscape && hide();
  31070. break;
  31071. case EVENT_CODE.space:
  31072. toggleMode();
  31073. break;
  31074. case EVENT_CODE.left:
  31075. prev();
  31076. break;
  31077. case EVENT_CODE.up:
  31078. handleActions("zoomIn");
  31079. break;
  31080. case EVENT_CODE.right:
  31081. next();
  31082. break;
  31083. case EVENT_CODE.down:
  31084. handleActions("zoomOut");
  31085. break;
  31086. }
  31087. });
  31088. const mousewheelHandler = throttle((e) => {
  31089. const delta = e.deltaY || e.deltaX;
  31090. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  31091. zoomRate: props.zoomRate,
  31092. enableTransition: false
  31093. });
  31094. });
  31095. scopeEventListener.run(() => {
  31096. useEventListener(document, "keydown", keydownHandler);
  31097. useEventListener(document, "wheel", mousewheelHandler);
  31098. });
  31099. }
  31100. function unregisterEventListener() {
  31101. scopeEventListener.stop();
  31102. }
  31103. function handleImgLoad() {
  31104. loading.value = false;
  31105. }
  31106. function handleImgError(e) {
  31107. loading.value = false;
  31108. e.target.alt = t("el.image.error");
  31109. }
  31110. function handleMouseDown(e) {
  31111. if (loading.value || e.button !== 0 || !wrapper.value)
  31112. return;
  31113. transform.value.enableTransition = false;
  31114. const { offsetX, offsetY } = transform.value;
  31115. const startX = e.pageX;
  31116. const startY = e.pageY;
  31117. const dragHandler = throttle((ev) => {
  31118. transform.value = {
  31119. ...transform.value,
  31120. offsetX: offsetX + ev.pageX - startX,
  31121. offsetY: offsetY + ev.pageY - startY
  31122. };
  31123. });
  31124. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  31125. useEventListener(document, "mouseup", () => {
  31126. removeMousemove();
  31127. });
  31128. e.preventDefault();
  31129. }
  31130. function reset() {
  31131. transform.value = {
  31132. scale: 1,
  31133. deg: 0,
  31134. offsetX: 0,
  31135. offsetY: 0,
  31136. enableTransition: false
  31137. };
  31138. }
  31139. function toggleMode() {
  31140. if (loading.value)
  31141. return;
  31142. const modeNames = keysOf(modes);
  31143. const modeValues = Object.values(modes);
  31144. const currentMode = mode.value.name;
  31145. const index = modeValues.findIndex((i) => i.name === currentMode);
  31146. const nextIndex = (index + 1) % modeNames.length;
  31147. mode.value = modes[modeNames[nextIndex]];
  31148. reset();
  31149. }
  31150. function setActiveItem(index) {
  31151. const len = props.urlList.length;
  31152. activeIndex.value = (index + len) % len;
  31153. }
  31154. function prev() {
  31155. if (isFirst.value && !props.infinite)
  31156. return;
  31157. setActiveItem(activeIndex.value - 1);
  31158. }
  31159. function next() {
  31160. if (isLast.value && !props.infinite)
  31161. return;
  31162. setActiveItem(activeIndex.value + 1);
  31163. }
  31164. function handleActions(action, options = {}) {
  31165. if (loading.value)
  31166. return;
  31167. const { minScale, maxScale } = props;
  31168. const { zoomRate, rotateDeg, enableTransition } = {
  31169. zoomRate: props.zoomRate,
  31170. rotateDeg: 90,
  31171. enableTransition: true,
  31172. ...options
  31173. };
  31174. switch (action) {
  31175. case "zoomOut":
  31176. if (transform.value.scale > minScale) {
  31177. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  31178. }
  31179. break;
  31180. case "zoomIn":
  31181. if (transform.value.scale < maxScale) {
  31182. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  31183. }
  31184. break;
  31185. case "clockwise":
  31186. transform.value.deg += rotateDeg;
  31187. emit("rotate", transform.value.deg);
  31188. break;
  31189. case "anticlockwise":
  31190. transform.value.deg -= rotateDeg;
  31191. emit("rotate", transform.value.deg);
  31192. break;
  31193. }
  31194. transform.value.enableTransition = enableTransition;
  31195. }
  31196. vue.watch(currentImg, () => {
  31197. vue.nextTick(() => {
  31198. const $img = imgRefs.value[0];
  31199. if (!($img == null ? void 0 : $img.complete)) {
  31200. loading.value = true;
  31201. }
  31202. });
  31203. });
  31204. vue.watch(activeIndex, (val) => {
  31205. reset();
  31206. emit("switch", val);
  31207. });
  31208. vue.onMounted(() => {
  31209. var _a2, _b;
  31210. registerEventListener();
  31211. (_b = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  31212. });
  31213. expose({
  31214. setActiveItem
  31215. });
  31216. return (_ctx, _cache) => {
  31217. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  31218. to: "body",
  31219. disabled: !_ctx.teleported
  31220. }, {
  31221. default: vue.withCtx(() => [
  31222. vue.createVNode(vue.Transition, {
  31223. name: "viewer-fade",
  31224. appear: ""
  31225. }, {
  31226. default: vue.withCtx(() => [
  31227. vue.createElementVNode("div", {
  31228. ref_key: "wrapper",
  31229. ref: wrapper,
  31230. tabindex: -1,
  31231. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  31232. style: vue.normalizeStyle({ zIndex: zIndex.value })
  31233. }, [
  31234. vue.createElementVNode("div", {
  31235. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  31236. onClick: vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
  31237. }, null, 10, ["onClick"]),
  31238. vue.createCommentVNode(" CLOSE "),
  31239. vue.createElementVNode("span", {
  31240. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  31241. onClick: hide
  31242. }, [
  31243. vue.createVNode(vue.unref(ElIcon), null, {
  31244. default: vue.withCtx(() => [
  31245. vue.createVNode(vue.unref(close_default))
  31246. ]),
  31247. _: 1
  31248. })
  31249. ], 2),
  31250. vue.createCommentVNode(" ARROW "),
  31251. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31252. vue.createElementVNode("span", {
  31253. class: vue.normalizeClass(vue.unref(arrowPrevKls)),
  31254. onClick: prev
  31255. }, [
  31256. vue.createVNode(vue.unref(ElIcon), null, {
  31257. default: vue.withCtx(() => [
  31258. vue.createVNode(vue.unref(arrow_left_default))
  31259. ]),
  31260. _: 1
  31261. })
  31262. ], 2),
  31263. vue.createElementVNode("span", {
  31264. class: vue.normalizeClass(vue.unref(arrowNextKls)),
  31265. onClick: next
  31266. }, [
  31267. vue.createVNode(vue.unref(ElIcon), null, {
  31268. default: vue.withCtx(() => [
  31269. vue.createVNode(vue.unref(arrow_right_default))
  31270. ]),
  31271. _: 1
  31272. })
  31273. ], 2)
  31274. ], 64)) : vue.createCommentVNode("v-if", true),
  31275. vue.createCommentVNode(" ACTIONS "),
  31276. vue.createElementVNode("div", {
  31277. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  31278. }, [
  31279. vue.createElementVNode("div", {
  31280. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  31281. }, [
  31282. vue.createVNode(vue.unref(ElIcon), {
  31283. onClick: ($event) => handleActions("zoomOut")
  31284. }, {
  31285. default: vue.withCtx(() => [
  31286. vue.createVNode(vue.unref(zoom_out_default))
  31287. ]),
  31288. _: 1
  31289. }, 8, ["onClick"]),
  31290. vue.createVNode(vue.unref(ElIcon), {
  31291. onClick: ($event) => handleActions("zoomIn")
  31292. }, {
  31293. default: vue.withCtx(() => [
  31294. vue.createVNode(vue.unref(zoom_in_default))
  31295. ]),
  31296. _: 1
  31297. }, 8, ["onClick"]),
  31298. vue.createElementVNode("i", {
  31299. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  31300. }, null, 2),
  31301. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  31302. default: vue.withCtx(() => [
  31303. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  31304. ]),
  31305. _: 1
  31306. }),
  31307. vue.createElementVNode("i", {
  31308. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  31309. }, null, 2),
  31310. vue.createVNode(vue.unref(ElIcon), {
  31311. onClick: ($event) => handleActions("anticlockwise")
  31312. }, {
  31313. default: vue.withCtx(() => [
  31314. vue.createVNode(vue.unref(refresh_left_default))
  31315. ]),
  31316. _: 1
  31317. }, 8, ["onClick"]),
  31318. vue.createVNode(vue.unref(ElIcon), {
  31319. onClick: ($event) => handleActions("clockwise")
  31320. }, {
  31321. default: vue.withCtx(() => [
  31322. vue.createVNode(vue.unref(refresh_right_default))
  31323. ]),
  31324. _: 1
  31325. }, 8, ["onClick"])
  31326. ], 2)
  31327. ], 2),
  31328. vue.createCommentVNode(" CANVAS "),
  31329. vue.createElementVNode("div", {
  31330. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  31331. }, [
  31332. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => {
  31333. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", {
  31334. ref_for: true,
  31335. ref: (el) => imgRefs.value[i] = el,
  31336. key: url,
  31337. src: url,
  31338. style: vue.normalizeStyle(vue.unref(imgStyle)),
  31339. class: vue.normalizeClass(vue.unref(ns).e("img")),
  31340. crossorigin: _ctx.crossorigin,
  31341. onLoad: handleImgLoad,
  31342. onError: handleImgError,
  31343. onMousedown: handleMouseDown
  31344. }, null, 46, ["src", "crossorigin"])), [
  31345. [vue.vShow, i === activeIndex.value]
  31346. ]);
  31347. }), 128))
  31348. ], 2),
  31349. vue.renderSlot(_ctx.$slots, "default")
  31350. ], 6)
  31351. ]),
  31352. _: 3
  31353. })
  31354. ]),
  31355. _: 3
  31356. }, 8, ["disabled"]);
  31357. };
  31358. }
  31359. });
  31360. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "image-viewer.vue"]]);
  31361. const ElImageViewer = withInstall(ImageViewer);
  31362. const imageProps = buildProps({
  31363. hideOnClickModal: Boolean,
  31364. src: {
  31365. type: String,
  31366. default: ""
  31367. },
  31368. fit: {
  31369. type: String,
  31370. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  31371. default: ""
  31372. },
  31373. loading: {
  31374. type: String,
  31375. values: ["eager", "lazy"]
  31376. },
  31377. lazy: Boolean,
  31378. scrollContainer: {
  31379. type: definePropType([String, Object])
  31380. },
  31381. previewSrcList: {
  31382. type: definePropType(Array),
  31383. default: () => mutable([])
  31384. },
  31385. previewTeleported: Boolean,
  31386. zIndex: {
  31387. type: Number
  31388. },
  31389. initialIndex: {
  31390. type: Number,
  31391. default: 0
  31392. },
  31393. infinite: {
  31394. type: Boolean,
  31395. default: true
  31396. },
  31397. closeOnPressEscape: {
  31398. type: Boolean,
  31399. default: true
  31400. },
  31401. zoomRate: {
  31402. type: Number,
  31403. default: 1.2
  31404. },
  31405. minScale: {
  31406. type: Number,
  31407. default: 0.2
  31408. },
  31409. maxScale: {
  31410. type: Number,
  31411. default: 7
  31412. },
  31413. crossorigin: {
  31414. type: definePropType(String)
  31415. }
  31416. });
  31417. const imageEmits = {
  31418. load: (evt) => evt instanceof Event,
  31419. error: (evt) => evt instanceof Event,
  31420. switch: (val) => isNumber(val),
  31421. close: () => true,
  31422. show: () => true
  31423. };
  31424. const __default__$S = vue.defineComponent({
  31425. name: "ElImage",
  31426. inheritAttrs: false
  31427. });
  31428. const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
  31429. ...__default__$S,
  31430. props: imageProps,
  31431. emits: imageEmits,
  31432. setup(__props, { emit }) {
  31433. const props = __props;
  31434. let prevOverflow = "";
  31435. const { t } = useLocale();
  31436. const ns = useNamespace("image");
  31437. const rawAttrs = vue.useAttrs();
  31438. const containerAttrs = vue.computed(() => {
  31439. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  31440. });
  31441. const imgAttrs = useAttrs({
  31442. excludeListeners: true,
  31443. excludeKeys: vue.computed(() => {
  31444. return Object.keys(containerAttrs.value);
  31445. })
  31446. });
  31447. const imageSrc = vue.ref();
  31448. const hasLoadError = vue.ref(false);
  31449. const isLoading = vue.ref(true);
  31450. const showViewer = vue.ref(false);
  31451. const container = vue.ref();
  31452. const _scrollContainer = vue.ref();
  31453. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  31454. let stopScrollListener;
  31455. let stopWheelListener;
  31456. const imageKls = vue.computed(() => [
  31457. ns.e("inner"),
  31458. preview.value && ns.e("preview"),
  31459. isLoading.value && ns.is("loading")
  31460. ]);
  31461. const imageStyle = vue.computed(() => {
  31462. const { fit } = props;
  31463. if (isClient && fit) {
  31464. return { objectFit: fit };
  31465. }
  31466. return {};
  31467. });
  31468. const preview = vue.computed(() => {
  31469. const { previewSrcList } = props;
  31470. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  31471. });
  31472. const imageIndex = vue.computed(() => {
  31473. const { previewSrcList, initialIndex } = props;
  31474. let previewIndex = initialIndex;
  31475. if (initialIndex > previewSrcList.length - 1) {
  31476. previewIndex = 0;
  31477. }
  31478. return previewIndex;
  31479. });
  31480. const isManual = vue.computed(() => {
  31481. if (props.loading === "eager")
  31482. return false;
  31483. return !supportLoading && props.loading === "lazy" || props.lazy;
  31484. });
  31485. const loadImage = () => {
  31486. if (!isClient)
  31487. return;
  31488. isLoading.value = true;
  31489. hasLoadError.value = false;
  31490. imageSrc.value = props.src;
  31491. };
  31492. function handleLoad(event) {
  31493. isLoading.value = false;
  31494. hasLoadError.value = false;
  31495. emit("load", event);
  31496. }
  31497. function handleError(event) {
  31498. isLoading.value = false;
  31499. hasLoadError.value = true;
  31500. emit("error", event);
  31501. }
  31502. function handleLazyLoad() {
  31503. if (isInContainer(container.value, _scrollContainer.value)) {
  31504. loadImage();
  31505. removeLazyLoadListener();
  31506. }
  31507. }
  31508. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  31509. async function addLazyLoadListener() {
  31510. var _a;
  31511. if (!isClient)
  31512. return;
  31513. await vue.nextTick();
  31514. const { scrollContainer } = props;
  31515. if (isElement$1(scrollContainer)) {
  31516. _scrollContainer.value = scrollContainer;
  31517. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  31518. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  31519. } else if (container.value) {
  31520. _scrollContainer.value = getScrollContainer(container.value);
  31521. }
  31522. if (_scrollContainer.value) {
  31523. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  31524. setTimeout(() => handleLazyLoad(), 100);
  31525. }
  31526. }
  31527. function removeLazyLoadListener() {
  31528. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  31529. return;
  31530. stopScrollListener == null ? void 0 : stopScrollListener();
  31531. _scrollContainer.value = void 0;
  31532. }
  31533. function wheelHandler(e) {
  31534. if (!e.ctrlKey)
  31535. return;
  31536. if (e.deltaY < 0) {
  31537. e.preventDefault();
  31538. return false;
  31539. } else if (e.deltaY > 0) {
  31540. e.preventDefault();
  31541. return false;
  31542. }
  31543. }
  31544. function clickHandler() {
  31545. if (!preview.value)
  31546. return;
  31547. stopWheelListener = useEventListener("wheel", wheelHandler, {
  31548. passive: false
  31549. });
  31550. prevOverflow = document.body.style.overflow;
  31551. document.body.style.overflow = "hidden";
  31552. showViewer.value = true;
  31553. emit("show");
  31554. }
  31555. function closeViewer() {
  31556. stopWheelListener == null ? void 0 : stopWheelListener();
  31557. document.body.style.overflow = prevOverflow;
  31558. showViewer.value = false;
  31559. emit("close");
  31560. }
  31561. function switchViewer(val) {
  31562. emit("switch", val);
  31563. }
  31564. vue.watch(() => props.src, () => {
  31565. if (isManual.value) {
  31566. isLoading.value = true;
  31567. hasLoadError.value = false;
  31568. removeLazyLoadListener();
  31569. addLazyLoadListener();
  31570. } else {
  31571. loadImage();
  31572. }
  31573. });
  31574. vue.onMounted(() => {
  31575. if (isManual.value) {
  31576. addLazyLoadListener();
  31577. } else {
  31578. loadImage();
  31579. }
  31580. });
  31581. return (_ctx, _cache) => {
  31582. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  31583. ref_key: "container",
  31584. ref: container
  31585. }, vue.unref(containerAttrs), {
  31586. class: [vue.unref(ns).b(), _ctx.$attrs.class]
  31587. }), [
  31588. hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  31589. vue.createElementVNode("div", {
  31590. class: vue.normalizeClass(vue.unref(ns).e("error"))
  31591. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  31592. ]) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  31593. imageSrc.value !== void 0 ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(imgAttrs), {
  31594. src: imageSrc.value,
  31595. loading: _ctx.loading,
  31596. style: vue.unref(imageStyle),
  31597. class: vue.unref(imageKls),
  31598. crossorigin: _ctx.crossorigin,
  31599. onClick: clickHandler,
  31600. onLoad: handleLoad,
  31601. onError: handleError
  31602. }), null, 16, ["src", "loading", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  31603. isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", {
  31604. key: 1,
  31605. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  31606. }, [
  31607. vue.renderSlot(_ctx.$slots, "placeholder", {}, () => [
  31608. vue.createElementVNode("div", {
  31609. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  31610. }, null, 2)
  31611. ])
  31612. ], 2)) : vue.createCommentVNode("v-if", true)
  31613. ], 64)),
  31614. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  31615. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  31616. key: 0,
  31617. "z-index": _ctx.zIndex,
  31618. "initial-index": vue.unref(imageIndex),
  31619. infinite: _ctx.infinite,
  31620. "zoom-rate": _ctx.zoomRate,
  31621. "min-scale": _ctx.minScale,
  31622. "max-scale": _ctx.maxScale,
  31623. "url-list": _ctx.previewSrcList,
  31624. crossorigin: _ctx.crossorigin,
  31625. "hide-on-click-modal": _ctx.hideOnClickModal,
  31626. teleported: _ctx.previewTeleported,
  31627. "close-on-press-escape": _ctx.closeOnPressEscape,
  31628. onClose: closeViewer,
  31629. onSwitch: switchViewer
  31630. }, {
  31631. default: vue.withCtx(() => [
  31632. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  31633. vue.renderSlot(_ctx.$slots, "viewer")
  31634. ])) : vue.createCommentVNode("v-if", true)
  31635. ]),
  31636. _: 3
  31637. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "url-list", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  31638. ], 64)) : vue.createCommentVNode("v-if", true)
  31639. ], 16);
  31640. };
  31641. }
  31642. });
  31643. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "image.vue"]]);
  31644. const ElImage = withInstall(Image$1);
  31645. const inputNumberProps = buildProps({
  31646. id: {
  31647. type: String,
  31648. default: void 0
  31649. },
  31650. step: {
  31651. type: Number,
  31652. default: 1
  31653. },
  31654. stepStrictly: Boolean,
  31655. max: {
  31656. type: Number,
  31657. default: Number.POSITIVE_INFINITY
  31658. },
  31659. min: {
  31660. type: Number,
  31661. default: Number.NEGATIVE_INFINITY
  31662. },
  31663. modelValue: Number,
  31664. readonly: Boolean,
  31665. disabled: Boolean,
  31666. size: useSizeProp,
  31667. controls: {
  31668. type: Boolean,
  31669. default: true
  31670. },
  31671. controlsPosition: {
  31672. type: String,
  31673. default: "",
  31674. values: ["", "right"]
  31675. },
  31676. valueOnClear: {
  31677. type: [String, Number, null],
  31678. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  31679. default: null
  31680. },
  31681. name: String,
  31682. placeholder: String,
  31683. precision: {
  31684. type: Number,
  31685. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  31686. },
  31687. validateEvent: {
  31688. type: Boolean,
  31689. default: true
  31690. },
  31691. ...useAriaProps(["ariaLabel"])
  31692. });
  31693. const inputNumberEmits = {
  31694. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  31695. blur: (e) => e instanceof FocusEvent,
  31696. focus: (e) => e instanceof FocusEvent,
  31697. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  31698. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  31699. };
  31700. const __default__$R = vue.defineComponent({
  31701. name: "ElInputNumber"
  31702. });
  31703. const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
  31704. ...__default__$R,
  31705. props: inputNumberProps,
  31706. emits: inputNumberEmits,
  31707. setup(__props, { expose, emit }) {
  31708. const props = __props;
  31709. const { t } = useLocale();
  31710. const ns = useNamespace("input-number");
  31711. const input = vue.ref();
  31712. const data = vue.reactive({
  31713. currentValue: props.modelValue,
  31714. userInput: null
  31715. });
  31716. const { formItem } = useFormItem();
  31717. const minDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  31718. const maxDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  31719. const numPrecision = vue.computed(() => {
  31720. const stepPrecision = getPrecision(props.step);
  31721. if (!isUndefined(props.precision)) {
  31722. if (stepPrecision > props.precision) ;
  31723. return props.precision;
  31724. } else {
  31725. return Math.max(getPrecision(props.modelValue), stepPrecision);
  31726. }
  31727. });
  31728. const controlsAtRight = vue.computed(() => {
  31729. return props.controls && props.controlsPosition === "right";
  31730. });
  31731. const inputNumberSize = useFormSize();
  31732. const inputNumberDisabled = useFormDisabled();
  31733. const displayValue = vue.computed(() => {
  31734. if (data.userInput !== null) {
  31735. return data.userInput;
  31736. }
  31737. let currentValue = data.currentValue;
  31738. if (isNil(currentValue))
  31739. return "";
  31740. if (isNumber(currentValue)) {
  31741. if (Number.isNaN(currentValue))
  31742. return "";
  31743. if (!isUndefined(props.precision)) {
  31744. currentValue = currentValue.toFixed(props.precision);
  31745. }
  31746. }
  31747. return currentValue;
  31748. });
  31749. const toPrecision = (num, pre) => {
  31750. if (isUndefined(pre))
  31751. pre = numPrecision.value;
  31752. if (pre === 0)
  31753. return Math.round(num);
  31754. let snum = String(num);
  31755. const pointPos = snum.indexOf(".");
  31756. if (pointPos === -1)
  31757. return num;
  31758. const nums = snum.replace(".", "").split("");
  31759. const datum = nums[pointPos + pre];
  31760. if (!datum)
  31761. return num;
  31762. const length = snum.length;
  31763. if (snum.charAt(length - 1) === "5") {
  31764. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  31765. }
  31766. return Number.parseFloat(Number(snum).toFixed(pre));
  31767. };
  31768. const getPrecision = (value) => {
  31769. if (isNil(value))
  31770. return 0;
  31771. const valueString = value.toString();
  31772. const dotPosition = valueString.indexOf(".");
  31773. let precision = 0;
  31774. if (dotPosition !== -1) {
  31775. precision = valueString.length - dotPosition - 1;
  31776. }
  31777. return precision;
  31778. };
  31779. const ensurePrecision = (val, coefficient = 1) => {
  31780. if (!isNumber(val))
  31781. return data.currentValue;
  31782. return toPrecision(val + props.step * coefficient);
  31783. };
  31784. const increase = () => {
  31785. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  31786. return;
  31787. const value = Number(displayValue.value) || 0;
  31788. const newVal = ensurePrecision(value);
  31789. setCurrentValue(newVal);
  31790. emit(INPUT_EVENT, data.currentValue);
  31791. setCurrentValueToModelValue();
  31792. };
  31793. const decrease = () => {
  31794. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  31795. return;
  31796. const value = Number(displayValue.value) || 0;
  31797. const newVal = ensurePrecision(value, -1);
  31798. setCurrentValue(newVal);
  31799. emit(INPUT_EVENT, data.currentValue);
  31800. setCurrentValueToModelValue();
  31801. };
  31802. const verifyValue = (value, update) => {
  31803. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  31804. if (max < min) {
  31805. throwError("InputNumber", "min should not be greater than max.");
  31806. }
  31807. let newVal = Number(value);
  31808. if (isNil(value) || Number.isNaN(newVal)) {
  31809. return null;
  31810. }
  31811. if (value === "") {
  31812. if (valueOnClear === null) {
  31813. return null;
  31814. }
  31815. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  31816. }
  31817. if (stepStrictly) {
  31818. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  31819. }
  31820. if (!isUndefined(precision)) {
  31821. newVal = toPrecision(newVal, precision);
  31822. }
  31823. if (newVal > max || newVal < min) {
  31824. newVal = newVal > max ? max : min;
  31825. update && emit(UPDATE_MODEL_EVENT, newVal);
  31826. }
  31827. return newVal;
  31828. };
  31829. const setCurrentValue = (value, emitChange = true) => {
  31830. var _a;
  31831. const oldVal = data.currentValue;
  31832. const newVal = verifyValue(value);
  31833. if (!emitChange) {
  31834. emit(UPDATE_MODEL_EVENT, newVal);
  31835. return;
  31836. }
  31837. if (oldVal === newVal && value)
  31838. return;
  31839. data.userInput = null;
  31840. emit(UPDATE_MODEL_EVENT, newVal);
  31841. if (oldVal !== newVal) {
  31842. emit(CHANGE_EVENT, newVal, oldVal);
  31843. }
  31844. if (props.validateEvent) {
  31845. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  31846. }
  31847. data.currentValue = newVal;
  31848. };
  31849. const handleInput = (value) => {
  31850. data.userInput = value;
  31851. const newVal = value === "" ? null : Number(value);
  31852. emit(INPUT_EVENT, newVal);
  31853. setCurrentValue(newVal, false);
  31854. };
  31855. const handleInputChange = (value) => {
  31856. const newVal = value !== "" ? Number(value) : "";
  31857. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  31858. setCurrentValue(newVal);
  31859. }
  31860. setCurrentValueToModelValue();
  31861. data.userInput = null;
  31862. };
  31863. const focus = () => {
  31864. var _a, _b;
  31865. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  31866. };
  31867. const blur = () => {
  31868. var _a, _b;
  31869. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  31870. };
  31871. const handleFocus = (event) => {
  31872. emit("focus", event);
  31873. };
  31874. const handleBlur = (event) => {
  31875. var _a;
  31876. data.userInput = null;
  31877. emit("blur", event);
  31878. if (props.validateEvent) {
  31879. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  31880. }
  31881. };
  31882. const setCurrentValueToModelValue = () => {
  31883. if (data.currentValue !== props.modelValue) {
  31884. data.currentValue = props.modelValue;
  31885. }
  31886. };
  31887. const handleWheel = (e) => {
  31888. if (document.activeElement === e.target)
  31889. e.preventDefault();
  31890. };
  31891. vue.watch(() => props.modelValue, (value, oldValue) => {
  31892. const newValue = verifyValue(value, true);
  31893. if (data.userInput === null && newValue !== oldValue) {
  31894. data.currentValue = newValue;
  31895. }
  31896. }, { immediate: true });
  31897. vue.onMounted(() => {
  31898. var _a;
  31899. const { min, max, modelValue } = props;
  31900. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  31901. innerInput.setAttribute("role", "spinbutton");
  31902. if (Number.isFinite(max)) {
  31903. innerInput.setAttribute("aria-valuemax", String(max));
  31904. } else {
  31905. innerInput.removeAttribute("aria-valuemax");
  31906. }
  31907. if (Number.isFinite(min)) {
  31908. innerInput.setAttribute("aria-valuemin", String(min));
  31909. } else {
  31910. innerInput.removeAttribute("aria-valuemin");
  31911. }
  31912. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  31913. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  31914. if (!isNumber(modelValue) && modelValue != null) {
  31915. let val = Number(modelValue);
  31916. if (Number.isNaN(val)) {
  31917. val = null;
  31918. }
  31919. emit(UPDATE_MODEL_EVENT, val);
  31920. }
  31921. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  31922. });
  31923. vue.onUpdated(() => {
  31924. var _a, _b;
  31925. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  31926. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  31927. });
  31928. expose({
  31929. focus,
  31930. blur
  31931. });
  31932. return (_ctx, _cache) => {
  31933. return vue.openBlock(), vue.createElementBlock("div", {
  31934. class: vue.normalizeClass([
  31935. vue.unref(ns).b(),
  31936. vue.unref(ns).m(vue.unref(inputNumberSize)),
  31937. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  31938. vue.unref(ns).is("without-controls", !_ctx.controls),
  31939. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight))
  31940. ]),
  31941. onDragstart: vue.withModifiers(() => {
  31942. }, ["prevent"])
  31943. }, [
  31944. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  31945. key: 0,
  31946. role: "button",
  31947. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  31948. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  31949. onKeydown: vue.withKeys(decrease, ["enter"])
  31950. }, [
  31951. vue.renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  31952. vue.createVNode(vue.unref(ElIcon), null, {
  31953. default: vue.withCtx(() => [
  31954. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  31955. ]),
  31956. _: 1
  31957. })
  31958. ])
  31959. ], 42, ["aria-label", "onKeydown"])), [
  31960. [vue.unref(vRepeatClick), decrease]
  31961. ]) : vue.createCommentVNode("v-if", true),
  31962. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  31963. key: 1,
  31964. role: "button",
  31965. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  31966. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  31967. onKeydown: vue.withKeys(increase, ["enter"])
  31968. }, [
  31969. vue.renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  31970. vue.createVNode(vue.unref(ElIcon), null, {
  31971. default: vue.withCtx(() => [
  31972. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  31973. ]),
  31974. _: 1
  31975. })
  31976. ])
  31977. ], 42, ["aria-label", "onKeydown"])), [
  31978. [vue.unref(vRepeatClick), increase]
  31979. ]) : vue.createCommentVNode("v-if", true),
  31980. vue.createVNode(vue.unref(ElInput), {
  31981. id: _ctx.id,
  31982. ref_key: "input",
  31983. ref: input,
  31984. type: "number",
  31985. step: _ctx.step,
  31986. "model-value": vue.unref(displayValue),
  31987. placeholder: _ctx.placeholder,
  31988. readonly: _ctx.readonly,
  31989. disabled: vue.unref(inputNumberDisabled),
  31990. size: vue.unref(inputNumberSize),
  31991. max: _ctx.max,
  31992. min: _ctx.min,
  31993. name: _ctx.name,
  31994. "aria-label": _ctx.ariaLabel,
  31995. "validate-event": false,
  31996. onKeydown: [
  31997. vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]),
  31998. vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"])
  31999. ],
  32000. onBlur: handleBlur,
  32001. onFocus: handleFocus,
  32002. onInput: handleInput,
  32003. onChange: handleInputChange
  32004. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
  32005. ], 42, ["onDragstart"]);
  32006. };
  32007. }
  32008. });
  32009. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "input-number.vue"]]);
  32010. const ElInputNumber = withInstall(InputNumber);
  32011. const linkProps = buildProps({
  32012. type: {
  32013. type: String,
  32014. values: ["primary", "success", "warning", "info", "danger", "default"],
  32015. default: "default"
  32016. },
  32017. underline: {
  32018. type: Boolean,
  32019. default: true
  32020. },
  32021. disabled: Boolean,
  32022. href: { type: String, default: "" },
  32023. target: {
  32024. type: String,
  32025. default: "_self"
  32026. },
  32027. icon: {
  32028. type: iconPropType
  32029. }
  32030. });
  32031. const linkEmits = {
  32032. click: (evt) => evt instanceof MouseEvent
  32033. };
  32034. const __default__$Q = vue.defineComponent({
  32035. name: "ElLink"
  32036. });
  32037. const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
  32038. ...__default__$Q,
  32039. props: linkProps,
  32040. emits: linkEmits,
  32041. setup(__props, { emit }) {
  32042. const props = __props;
  32043. const ns = useNamespace("link");
  32044. const linkKls = vue.computed(() => [
  32045. ns.b(),
  32046. ns.m(props.type),
  32047. ns.is("disabled", props.disabled),
  32048. ns.is("underline", props.underline && !props.disabled)
  32049. ]);
  32050. function handleClick(event) {
  32051. if (!props.disabled)
  32052. emit("click", event);
  32053. }
  32054. return (_ctx, _cache) => {
  32055. return vue.openBlock(), vue.createElementBlock("a", {
  32056. class: vue.normalizeClass(vue.unref(linkKls)),
  32057. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  32058. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  32059. onClick: handleClick
  32060. }, [
  32061. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  32062. default: vue.withCtx(() => [
  32063. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  32064. ]),
  32065. _: 1
  32066. })) : vue.createCommentVNode("v-if", true),
  32067. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  32068. key: 1,
  32069. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  32070. }, [
  32071. vue.renderSlot(_ctx.$slots, "default")
  32072. ], 2)) : vue.createCommentVNode("v-if", true),
  32073. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  32074. ], 10, ["href", "target"]);
  32075. };
  32076. }
  32077. });
  32078. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__file", "link.vue"]]);
  32079. const ElLink = withInstall(Link);
  32080. class SubMenu$1 {
  32081. constructor(parent, domNode) {
  32082. this.parent = parent;
  32083. this.domNode = domNode;
  32084. this.subIndex = 0;
  32085. this.subIndex = 0;
  32086. this.init();
  32087. }
  32088. init() {
  32089. this.subMenuItems = this.domNode.querySelectorAll("li");
  32090. this.addListeners();
  32091. }
  32092. gotoSubIndex(idx) {
  32093. if (idx === this.subMenuItems.length) {
  32094. idx = 0;
  32095. } else if (idx < 0) {
  32096. idx = this.subMenuItems.length - 1;
  32097. }
  32098. this.subMenuItems[idx].focus();
  32099. this.subIndex = idx;
  32100. }
  32101. addListeners() {
  32102. const parentNode = this.parent.domNode;
  32103. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  32104. el.addEventListener("keydown", (event) => {
  32105. let prevDef = false;
  32106. switch (event.code) {
  32107. case EVENT_CODE.down: {
  32108. this.gotoSubIndex(this.subIndex + 1);
  32109. prevDef = true;
  32110. break;
  32111. }
  32112. case EVENT_CODE.up: {
  32113. this.gotoSubIndex(this.subIndex - 1);
  32114. prevDef = true;
  32115. break;
  32116. }
  32117. case EVENT_CODE.tab: {
  32118. triggerEvent(parentNode, "mouseleave");
  32119. break;
  32120. }
  32121. case EVENT_CODE.enter:
  32122. case EVENT_CODE.space: {
  32123. prevDef = true;
  32124. event.currentTarget.click();
  32125. break;
  32126. }
  32127. }
  32128. if (prevDef) {
  32129. event.preventDefault();
  32130. event.stopPropagation();
  32131. }
  32132. return false;
  32133. });
  32134. });
  32135. }
  32136. }
  32137. var SubMenu$2 = SubMenu$1;
  32138. class MenuItem$1 {
  32139. constructor(domNode, namespace) {
  32140. this.domNode = domNode;
  32141. this.submenu = null;
  32142. this.submenu = null;
  32143. this.init(namespace);
  32144. }
  32145. init(namespace) {
  32146. this.domNode.setAttribute("tabindex", "0");
  32147. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  32148. if (menuChild) {
  32149. this.submenu = new SubMenu$2(this, menuChild);
  32150. }
  32151. this.addListeners();
  32152. }
  32153. addListeners() {
  32154. this.domNode.addEventListener("keydown", (event) => {
  32155. let prevDef = false;
  32156. switch (event.code) {
  32157. case EVENT_CODE.down: {
  32158. triggerEvent(event.currentTarget, "mouseenter");
  32159. this.submenu && this.submenu.gotoSubIndex(0);
  32160. prevDef = true;
  32161. break;
  32162. }
  32163. case EVENT_CODE.up: {
  32164. triggerEvent(event.currentTarget, "mouseenter");
  32165. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  32166. prevDef = true;
  32167. break;
  32168. }
  32169. case EVENT_CODE.tab: {
  32170. triggerEvent(event.currentTarget, "mouseleave");
  32171. break;
  32172. }
  32173. case EVENT_CODE.enter:
  32174. case EVENT_CODE.space: {
  32175. prevDef = true;
  32176. event.currentTarget.click();
  32177. break;
  32178. }
  32179. }
  32180. if (prevDef) {
  32181. event.preventDefault();
  32182. }
  32183. });
  32184. }
  32185. }
  32186. var MenuItem$2 = MenuItem$1;
  32187. class Menu$1 {
  32188. constructor(domNode, namespace) {
  32189. this.domNode = domNode;
  32190. this.init(namespace);
  32191. }
  32192. init(namespace) {
  32193. const menuChildren = this.domNode.childNodes;
  32194. Array.from(menuChildren).forEach((child) => {
  32195. if (child.nodeType === 1) {
  32196. new MenuItem$2(child, namespace);
  32197. }
  32198. });
  32199. }
  32200. }
  32201. var Menubar = Menu$1;
  32202. const _sfc_main$14 = vue.defineComponent({
  32203. name: "ElMenuCollapseTransition",
  32204. setup() {
  32205. const ns = useNamespace("menu");
  32206. const listeners = {
  32207. onBeforeEnter: (el) => el.style.opacity = "0.2",
  32208. onEnter(el, done) {
  32209. addClass(el, `${ns.namespace.value}-opacity-transition`);
  32210. el.style.opacity = "1";
  32211. done();
  32212. },
  32213. onAfterEnter(el) {
  32214. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  32215. el.style.opacity = "";
  32216. },
  32217. onBeforeLeave(el) {
  32218. if (!el.dataset) {
  32219. el.dataset = {};
  32220. }
  32221. if (hasClass(el, ns.m("collapse"))) {
  32222. removeClass(el, ns.m("collapse"));
  32223. el.dataset.oldOverflow = el.style.overflow;
  32224. el.dataset.scrollWidth = el.clientWidth.toString();
  32225. addClass(el, ns.m("collapse"));
  32226. } else {
  32227. addClass(el, ns.m("collapse"));
  32228. el.dataset.oldOverflow = el.style.overflow;
  32229. el.dataset.scrollWidth = el.clientWidth.toString();
  32230. removeClass(el, ns.m("collapse"));
  32231. }
  32232. el.style.width = `${el.scrollWidth}px`;
  32233. el.style.overflow = "hidden";
  32234. },
  32235. onLeave(el) {
  32236. addClass(el, "horizontal-collapse-transition");
  32237. el.style.width = `${el.dataset.scrollWidth}px`;
  32238. }
  32239. };
  32240. return {
  32241. listeners
  32242. };
  32243. }
  32244. });
  32245. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  32246. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, _ctx.listeners), {
  32247. default: vue.withCtx(() => [
  32248. vue.renderSlot(_ctx.$slots, "default")
  32249. ]),
  32250. _: 3
  32251. }, 16);
  32252. }
  32253. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]);
  32254. function useMenu(instance, currentIndex) {
  32255. const indexPath = vue.computed(() => {
  32256. let parent = instance.parent;
  32257. const path = [currentIndex.value];
  32258. while (parent.type.name !== "ElMenu") {
  32259. if (parent.props.index) {
  32260. path.unshift(parent.props.index);
  32261. }
  32262. parent = parent.parent;
  32263. }
  32264. return path;
  32265. });
  32266. const parentMenu = vue.computed(() => {
  32267. let parent = instance.parent;
  32268. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  32269. parent = parent.parent;
  32270. }
  32271. return parent;
  32272. });
  32273. return {
  32274. parentMenu,
  32275. indexPath
  32276. };
  32277. }
  32278. function useMenuColor(props) {
  32279. const menuBarColor = vue.computed(() => {
  32280. const color = props.backgroundColor;
  32281. if (!color) {
  32282. return "";
  32283. } else {
  32284. return new TinyColor(color).shade(20).toString();
  32285. }
  32286. });
  32287. return menuBarColor;
  32288. }
  32289. const useMenuCssVar = (props, level) => {
  32290. const ns = useNamespace("menu");
  32291. return vue.computed(() => {
  32292. return ns.cssVarBlock({
  32293. "text-color": props.textColor || "",
  32294. "hover-text-color": props.textColor || "",
  32295. "bg-color": props.backgroundColor || "",
  32296. "hover-bg-color": useMenuColor(props).value || "",
  32297. "active-color": props.activeTextColor || "",
  32298. level: `${level}`
  32299. });
  32300. });
  32301. };
  32302. const subMenuProps = buildProps({
  32303. index: {
  32304. type: String,
  32305. required: true
  32306. },
  32307. showTimeout: Number,
  32308. hideTimeout: Number,
  32309. popperClass: String,
  32310. disabled: Boolean,
  32311. teleported: {
  32312. type: Boolean,
  32313. default: void 0
  32314. },
  32315. popperOffset: Number,
  32316. expandCloseIcon: {
  32317. type: iconPropType
  32318. },
  32319. expandOpenIcon: {
  32320. type: iconPropType
  32321. },
  32322. collapseCloseIcon: {
  32323. type: iconPropType
  32324. },
  32325. collapseOpenIcon: {
  32326. type: iconPropType
  32327. }
  32328. });
  32329. const COMPONENT_NAME$c = "ElSubMenu";
  32330. var SubMenu = vue.defineComponent({
  32331. name: COMPONENT_NAME$c,
  32332. props: subMenuProps,
  32333. setup(props, { slots, expose }) {
  32334. const instance = vue.getCurrentInstance();
  32335. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  32336. const nsMenu = useNamespace("menu");
  32337. const nsSubMenu = useNamespace("sub-menu");
  32338. const rootMenu = vue.inject("rootMenu");
  32339. if (!rootMenu)
  32340. throwError(COMPONENT_NAME$c, "can not inject root menu");
  32341. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  32342. if (!subMenu)
  32343. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  32344. const items = vue.ref({});
  32345. const subMenus = vue.ref({});
  32346. let timeout;
  32347. const mouseInChild = vue.ref(false);
  32348. const verticalTitleRef = vue.ref();
  32349. const vPopper = vue.ref(null);
  32350. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  32351. const subMenuTitleIcon = vue.computed(() => {
  32352. 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;
  32353. });
  32354. const isFirstLevel = vue.computed(() => {
  32355. return subMenu.level === 0;
  32356. });
  32357. const appendToBody = vue.computed(() => {
  32358. const value = props.teleported;
  32359. return value === void 0 ? isFirstLevel.value : value;
  32360. });
  32361. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  32362. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  32363. "bottom-start",
  32364. "bottom-end",
  32365. "top-start",
  32366. "top-end",
  32367. "right-start",
  32368. "left-start"
  32369. ] : [
  32370. "right-start",
  32371. "right",
  32372. "right-end",
  32373. "left-start",
  32374. "bottom-start",
  32375. "bottom-end",
  32376. "top-start",
  32377. "top-end"
  32378. ]);
  32379. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  32380. const active = vue.computed(() => {
  32381. let isActive = false;
  32382. Object.values(items.value).forEach((item2) => {
  32383. if (item2.active) {
  32384. isActive = true;
  32385. }
  32386. });
  32387. Object.values(subMenus.value).forEach((subItem) => {
  32388. if (subItem.active) {
  32389. isActive = true;
  32390. }
  32391. });
  32392. return isActive;
  32393. });
  32394. const mode = vue.computed(() => rootMenu.props.mode);
  32395. const item = vue.reactive({
  32396. index: props.index,
  32397. indexPath,
  32398. active
  32399. });
  32400. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  32401. const subMenuPopperOffset = vue.computed(() => {
  32402. var _a;
  32403. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  32404. });
  32405. const subMenuPopperClass = vue.computed(() => {
  32406. var _a;
  32407. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  32408. });
  32409. const subMenuShowTimeout = vue.computed(() => {
  32410. var _a;
  32411. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  32412. });
  32413. const subMenuHideTimeout = vue.computed(() => {
  32414. var _a;
  32415. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  32416. });
  32417. const doDestroy = () => {
  32418. var _a, _b, _c;
  32419. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  32420. };
  32421. const handleCollapseToggle = (value) => {
  32422. if (!value) {
  32423. doDestroy();
  32424. }
  32425. };
  32426. const handleClick = () => {
  32427. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  32428. return;
  32429. rootMenu.handleSubMenuClick({
  32430. index: props.index,
  32431. indexPath: indexPath.value,
  32432. active: active.value
  32433. });
  32434. };
  32435. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  32436. var _a;
  32437. if (event.type === "focus") {
  32438. return;
  32439. }
  32440. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  32441. subMenu.mouseInChild.value = true;
  32442. return;
  32443. }
  32444. subMenu.mouseInChild.value = true;
  32445. timeout == null ? void 0 : timeout();
  32446. ({ stop: timeout } = useTimeoutFn(() => {
  32447. rootMenu.openMenu(props.index, indexPath.value);
  32448. }, showTimeout));
  32449. if (appendToBody.value) {
  32450. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  32451. }
  32452. };
  32453. const handleMouseleave = (deepDispatch = false) => {
  32454. var _a;
  32455. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  32456. subMenu.mouseInChild.value = false;
  32457. return;
  32458. }
  32459. timeout == null ? void 0 : timeout();
  32460. subMenu.mouseInChild.value = false;
  32461. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  32462. if (appendToBody.value && deepDispatch) {
  32463. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  32464. }
  32465. };
  32466. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  32467. {
  32468. const addSubMenu = (item2) => {
  32469. subMenus.value[item2.index] = item2;
  32470. };
  32471. const removeSubMenu = (item2) => {
  32472. delete subMenus.value[item2.index];
  32473. };
  32474. vue.provide(`subMenu:${instance.uid}`, {
  32475. addSubMenu,
  32476. removeSubMenu,
  32477. handleMouseleave,
  32478. mouseInChild,
  32479. level: subMenu.level + 1
  32480. });
  32481. }
  32482. expose({
  32483. opened
  32484. });
  32485. vue.onMounted(() => {
  32486. rootMenu.addSubMenu(item);
  32487. subMenu.addSubMenu(item);
  32488. });
  32489. vue.onBeforeUnmount(() => {
  32490. subMenu.removeSubMenu(item);
  32491. rootMenu.removeSubMenu(item);
  32492. });
  32493. return () => {
  32494. var _a;
  32495. const titleTag = [
  32496. (_a = slots.title) == null ? void 0 : _a.call(slots),
  32497. vue.h(ElIcon, {
  32498. class: nsSubMenu.e("icon-arrow"),
  32499. style: {
  32500. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  32501. }
  32502. }, {
  32503. default: () => isString$1(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  32504. })
  32505. ];
  32506. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  32507. ref: vPopper,
  32508. visible: opened.value,
  32509. effect: "light",
  32510. pure: true,
  32511. offset: subMenuPopperOffset.value,
  32512. showArrow: false,
  32513. persistent: true,
  32514. popperClass: subMenuPopperClass.value,
  32515. placement: currentPlacement.value,
  32516. teleported: appendToBody.value,
  32517. fallbackPlacements: fallbackPlacements.value,
  32518. transition: menuTransitionName.value,
  32519. gpuAcceleration: false
  32520. }, {
  32521. content: () => {
  32522. var _a2;
  32523. return vue.h("div", {
  32524. class: [
  32525. nsMenu.m(mode.value),
  32526. nsMenu.m("popup-container"),
  32527. subMenuPopperClass.value
  32528. ],
  32529. onMouseenter: (evt) => handleMouseenter(evt, 100),
  32530. onMouseleave: () => handleMouseleave(true),
  32531. onFocus: (evt) => handleMouseenter(evt, 100)
  32532. }, [
  32533. vue.h("ul", {
  32534. class: [
  32535. nsMenu.b(),
  32536. nsMenu.m("popup"),
  32537. nsMenu.m(`popup-${currentPlacement.value}`)
  32538. ],
  32539. style: ulStyle.value
  32540. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  32541. ]);
  32542. },
  32543. default: () => vue.h("div", {
  32544. class: nsSubMenu.e("title"),
  32545. onClick: handleClick
  32546. }, titleTag)
  32547. }) : vue.h(vue.Fragment, {}, [
  32548. vue.h("div", {
  32549. class: nsSubMenu.e("title"),
  32550. ref: verticalTitleRef,
  32551. onClick: handleClick
  32552. }, titleTag),
  32553. vue.h(ElCollapseTransition, {}, {
  32554. default: () => {
  32555. var _a2;
  32556. return vue.withDirectives(vue.h("ul", {
  32557. role: "menu",
  32558. class: [nsMenu.b(), nsMenu.m("inline")],
  32559. style: ulStyle.value
  32560. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  32561. }
  32562. })
  32563. ]);
  32564. return vue.h("li", {
  32565. class: [
  32566. nsSubMenu.b(),
  32567. nsSubMenu.is("active", active.value),
  32568. nsSubMenu.is("opened", opened.value),
  32569. nsSubMenu.is("disabled", props.disabled)
  32570. ],
  32571. role: "menuitem",
  32572. ariaHaspopup: true,
  32573. ariaExpanded: opened.value,
  32574. onMouseenter: handleMouseenter,
  32575. onMouseleave: () => handleMouseleave(),
  32576. onFocus: handleMouseenter
  32577. }, [child]);
  32578. };
  32579. }
  32580. });
  32581. const menuProps = buildProps({
  32582. mode: {
  32583. type: String,
  32584. values: ["horizontal", "vertical"],
  32585. default: "vertical"
  32586. },
  32587. defaultActive: {
  32588. type: String,
  32589. default: ""
  32590. },
  32591. defaultOpeneds: {
  32592. type: definePropType(Array),
  32593. default: () => mutable([])
  32594. },
  32595. uniqueOpened: Boolean,
  32596. router: Boolean,
  32597. menuTrigger: {
  32598. type: String,
  32599. values: ["hover", "click"],
  32600. default: "hover"
  32601. },
  32602. collapse: Boolean,
  32603. backgroundColor: String,
  32604. textColor: String,
  32605. activeTextColor: String,
  32606. closeOnClickOutside: Boolean,
  32607. collapseTransition: {
  32608. type: Boolean,
  32609. default: true
  32610. },
  32611. ellipsis: {
  32612. type: Boolean,
  32613. default: true
  32614. },
  32615. popperOffset: {
  32616. type: Number,
  32617. default: 6
  32618. },
  32619. ellipsisIcon: {
  32620. type: iconPropType,
  32621. default: () => more_default
  32622. },
  32623. popperEffect: {
  32624. type: definePropType(String),
  32625. default: "dark"
  32626. },
  32627. popperClass: String,
  32628. showTimeout: {
  32629. type: Number,
  32630. default: 300
  32631. },
  32632. hideTimeout: {
  32633. type: Number,
  32634. default: 300
  32635. }
  32636. });
  32637. const checkIndexPath = (indexPath) => Array.isArray(indexPath) && indexPath.every((path) => isString$1(path));
  32638. const menuEmits = {
  32639. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  32640. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  32641. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  32642. };
  32643. var Menu = vue.defineComponent({
  32644. name: "ElMenu",
  32645. props: menuProps,
  32646. emits: menuEmits,
  32647. setup(props, { emit, slots, expose }) {
  32648. const instance = vue.getCurrentInstance();
  32649. const router = instance.appContext.config.globalProperties.$router;
  32650. const menu = vue.ref();
  32651. const nsMenu = useNamespace("menu");
  32652. const nsSubMenu = useNamespace("sub-menu");
  32653. const sliceIndex = vue.ref(-1);
  32654. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  32655. const activeIndex = vue.ref(props.defaultActive);
  32656. const items = vue.ref({});
  32657. const subMenus = vue.ref({});
  32658. const isMenuPopup = vue.computed(() => {
  32659. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  32660. });
  32661. const initMenu = () => {
  32662. const activeItem = activeIndex.value && items.value[activeIndex.value];
  32663. if (!activeItem || props.mode === "horizontal" || props.collapse)
  32664. return;
  32665. const indexPath = activeItem.indexPath;
  32666. indexPath.forEach((index) => {
  32667. const subMenu = subMenus.value[index];
  32668. subMenu && openMenu(index, subMenu.indexPath);
  32669. });
  32670. };
  32671. const openMenu = (index, indexPath) => {
  32672. if (openedMenus.value.includes(index))
  32673. return;
  32674. if (props.uniqueOpened) {
  32675. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  32676. }
  32677. openedMenus.value.push(index);
  32678. emit("open", index, indexPath);
  32679. };
  32680. const close = (index) => {
  32681. const i = openedMenus.value.indexOf(index);
  32682. if (i !== -1) {
  32683. openedMenus.value.splice(i, 1);
  32684. }
  32685. };
  32686. const closeMenu = (index, indexPath) => {
  32687. close(index);
  32688. emit("close", index, indexPath);
  32689. };
  32690. const handleSubMenuClick = ({
  32691. index,
  32692. indexPath
  32693. }) => {
  32694. const isOpened = openedMenus.value.includes(index);
  32695. if (isOpened) {
  32696. closeMenu(index, indexPath);
  32697. } else {
  32698. openMenu(index, indexPath);
  32699. }
  32700. };
  32701. const handleMenuItemClick = (menuItem) => {
  32702. if (props.mode === "horizontal" || props.collapse) {
  32703. openedMenus.value = [];
  32704. }
  32705. const { index, indexPath } = menuItem;
  32706. if (isNil(index) || isNil(indexPath))
  32707. return;
  32708. if (props.router && router) {
  32709. const route = menuItem.route || index;
  32710. const routerResult = router.push(route).then((res) => {
  32711. if (!res)
  32712. activeIndex.value = index;
  32713. return res;
  32714. });
  32715. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  32716. } else {
  32717. activeIndex.value = index;
  32718. emit("select", index, indexPath, { index, indexPath });
  32719. }
  32720. };
  32721. const updateActiveIndex = (val) => {
  32722. const itemsInData = items.value;
  32723. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  32724. if (item) {
  32725. activeIndex.value = item.index;
  32726. } else {
  32727. activeIndex.value = val;
  32728. }
  32729. };
  32730. const calcMenuItemWidth = (menuItem) => {
  32731. const computedStyle = getComputedStyle(menuItem);
  32732. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  32733. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  32734. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  32735. };
  32736. const calcSliceIndex = () => {
  32737. var _a, _b;
  32738. if (!menu.value)
  32739. return -1;
  32740. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue));
  32741. const moreItemWidth = 64;
  32742. const computedMenuStyle = getComputedStyle(menu.value);
  32743. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  32744. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  32745. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  32746. let calcWidth = 0;
  32747. let sliceIndex2 = 0;
  32748. items2.forEach((item, index) => {
  32749. calcWidth += calcMenuItemWidth(item);
  32750. if (calcWidth <= menuWidth - moreItemWidth) {
  32751. sliceIndex2 = index + 1;
  32752. }
  32753. });
  32754. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  32755. };
  32756. const getIndexPath = (index) => subMenus.value[index].indexPath;
  32757. const debounce = (fn, wait = 33.34) => {
  32758. let timmer;
  32759. return () => {
  32760. timmer && clearTimeout(timmer);
  32761. timmer = setTimeout(() => {
  32762. fn();
  32763. }, wait);
  32764. };
  32765. };
  32766. let isFirstTimeRender = true;
  32767. const handleResize = () => {
  32768. if (sliceIndex.value === calcSliceIndex())
  32769. return;
  32770. const callback = () => {
  32771. sliceIndex.value = -1;
  32772. vue.nextTick(() => {
  32773. sliceIndex.value = calcSliceIndex();
  32774. });
  32775. };
  32776. isFirstTimeRender ? callback() : debounce(callback)();
  32777. isFirstTimeRender = false;
  32778. };
  32779. vue.watch(() => props.defaultActive, (currentActive) => {
  32780. if (!items.value[currentActive]) {
  32781. activeIndex.value = "";
  32782. }
  32783. updateActiveIndex(currentActive);
  32784. });
  32785. vue.watch(() => props.collapse, (value) => {
  32786. if (value)
  32787. openedMenus.value = [];
  32788. });
  32789. vue.watch(items.value, initMenu);
  32790. let resizeStopper;
  32791. vue.watchEffect(() => {
  32792. if (props.mode === "horizontal" && props.ellipsis)
  32793. resizeStopper = useResizeObserver(menu, handleResize).stop;
  32794. else
  32795. resizeStopper == null ? void 0 : resizeStopper();
  32796. });
  32797. const mouseInChild = vue.ref(false);
  32798. {
  32799. const addSubMenu = (item) => {
  32800. subMenus.value[item.index] = item;
  32801. };
  32802. const removeSubMenu = (item) => {
  32803. delete subMenus.value[item.index];
  32804. };
  32805. const addMenuItem = (item) => {
  32806. items.value[item.index] = item;
  32807. };
  32808. const removeMenuItem = (item) => {
  32809. delete items.value[item.index];
  32810. };
  32811. vue.provide("rootMenu", vue.reactive({
  32812. props,
  32813. openedMenus,
  32814. items,
  32815. subMenus,
  32816. activeIndex,
  32817. isMenuPopup,
  32818. addMenuItem,
  32819. removeMenuItem,
  32820. addSubMenu,
  32821. removeSubMenu,
  32822. openMenu,
  32823. closeMenu,
  32824. handleMenuItemClick,
  32825. handleSubMenuClick
  32826. }));
  32827. vue.provide(`subMenu:${instance.uid}`, {
  32828. addSubMenu,
  32829. removeSubMenu,
  32830. mouseInChild,
  32831. level: 0
  32832. });
  32833. }
  32834. vue.onMounted(() => {
  32835. if (props.mode === "horizontal") {
  32836. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  32837. }
  32838. });
  32839. {
  32840. const open = (index) => {
  32841. const { indexPath } = subMenus.value[index];
  32842. indexPath.forEach((i) => openMenu(i, indexPath));
  32843. };
  32844. expose({
  32845. open,
  32846. close,
  32847. handleResize
  32848. });
  32849. }
  32850. return () => {
  32851. var _a, _b;
  32852. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  32853. const vShowMore = [];
  32854. if (props.mode === "horizontal" && menu.value) {
  32855. const originalSlot = flattedChildren(slot);
  32856. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  32857. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  32858. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  32859. slot = slotDefault;
  32860. vShowMore.push(vue.h(SubMenu, {
  32861. index: "sub-menu-more",
  32862. class: nsSubMenu.e("hide-arrow"),
  32863. popperOffset: props.popperOffset
  32864. }, {
  32865. title: () => vue.h(ElIcon, {
  32866. class: nsSubMenu.e("icon-more")
  32867. }, {
  32868. default: () => vue.h(props.ellipsisIcon)
  32869. }),
  32870. default: () => slotMore
  32871. }));
  32872. }
  32873. }
  32874. const ulStyle = useMenuCssVar(props, 0);
  32875. const directives = props.closeOnClickOutside ? [
  32876. [
  32877. ClickOutside,
  32878. () => {
  32879. if (!openedMenus.value.length)
  32880. return;
  32881. if (!mouseInChild.value) {
  32882. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  32883. openedMenus.value = [];
  32884. }
  32885. }
  32886. ]
  32887. ] : [];
  32888. const vMenu = vue.withDirectives(vue.h("ul", {
  32889. key: String(props.collapse),
  32890. role: "menubar",
  32891. ref: menu,
  32892. style: ulStyle.value,
  32893. class: {
  32894. [nsMenu.b()]: true,
  32895. [nsMenu.m(props.mode)]: true,
  32896. [nsMenu.m("collapse")]: props.collapse
  32897. }
  32898. }, [...slot, ...vShowMore]), directives);
  32899. if (props.collapseTransition && props.mode === "vertical") {
  32900. return vue.h(ElMenuCollapseTransition, () => vMenu);
  32901. }
  32902. return vMenu;
  32903. };
  32904. }
  32905. });
  32906. const menuItemProps = buildProps({
  32907. index: {
  32908. type: definePropType([String, null]),
  32909. default: null
  32910. },
  32911. route: {
  32912. type: definePropType([String, Object])
  32913. },
  32914. disabled: Boolean
  32915. });
  32916. const menuItemEmits = {
  32917. click: (item) => isString$1(item.index) && Array.isArray(item.indexPath)
  32918. };
  32919. const COMPONENT_NAME$b = "ElMenuItem";
  32920. const _sfc_main$13 = vue.defineComponent({
  32921. name: COMPONENT_NAME$b,
  32922. components: {
  32923. ElTooltip
  32924. },
  32925. props: menuItemProps,
  32926. emits: menuItemEmits,
  32927. setup(props, { emit }) {
  32928. const instance = vue.getCurrentInstance();
  32929. const rootMenu = vue.inject("rootMenu");
  32930. const nsMenu = useNamespace("menu");
  32931. const nsMenuItem = useNamespace("menu-item");
  32932. if (!rootMenu)
  32933. throwError(COMPONENT_NAME$b, "can not inject root menu");
  32934. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  32935. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  32936. if (!subMenu)
  32937. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  32938. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  32939. const item = vue.reactive({
  32940. index: props.index,
  32941. indexPath,
  32942. active
  32943. });
  32944. const handleClick = () => {
  32945. if (!props.disabled) {
  32946. rootMenu.handleMenuItemClick({
  32947. index: props.index,
  32948. indexPath: indexPath.value,
  32949. route: props.route
  32950. });
  32951. emit("click", item);
  32952. }
  32953. };
  32954. vue.onMounted(() => {
  32955. subMenu.addSubMenu(item);
  32956. rootMenu.addMenuItem(item);
  32957. });
  32958. vue.onBeforeUnmount(() => {
  32959. subMenu.removeSubMenu(item);
  32960. rootMenu.removeMenuItem(item);
  32961. });
  32962. return {
  32963. parentMenu,
  32964. rootMenu,
  32965. active,
  32966. nsMenu,
  32967. nsMenuItem,
  32968. handleClick
  32969. };
  32970. }
  32971. });
  32972. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  32973. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  32974. return vue.openBlock(), vue.createElementBlock("li", {
  32975. class: vue.normalizeClass([
  32976. _ctx.nsMenuItem.b(),
  32977. _ctx.nsMenuItem.is("active", _ctx.active),
  32978. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  32979. ]),
  32980. role: "menuitem",
  32981. tabindex: "-1",
  32982. onClick: _ctx.handleClick
  32983. }, [
  32984. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  32985. key: 0,
  32986. effect: _ctx.rootMenu.props.popperEffect,
  32987. placement: "right",
  32988. "fallback-placements": ["left"],
  32989. persistent: ""
  32990. }, {
  32991. content: vue.withCtx(() => [
  32992. vue.renderSlot(_ctx.$slots, "title")
  32993. ]),
  32994. default: vue.withCtx(() => [
  32995. vue.createElementVNode("div", {
  32996. class: vue.normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  32997. }, [
  32998. vue.renderSlot(_ctx.$slots, "default")
  32999. ], 2)
  33000. ]),
  33001. _: 3
  33002. }, 8, ["effect"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  33003. vue.renderSlot(_ctx.$slots, "default"),
  33004. vue.renderSlot(_ctx.$slots, "title")
  33005. ], 64))
  33006. ], 10, ["onClick"]);
  33007. }
  33008. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]);
  33009. const menuItemGroupProps = {
  33010. title: String
  33011. };
  33012. const COMPONENT_NAME$a = "ElMenuItemGroup";
  33013. const _sfc_main$12 = vue.defineComponent({
  33014. name: COMPONENT_NAME$a,
  33015. props: menuItemGroupProps,
  33016. setup() {
  33017. const ns = useNamespace("menu-item-group");
  33018. return {
  33019. ns
  33020. };
  33021. }
  33022. });
  33023. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  33024. return vue.openBlock(), vue.createElementBlock("li", {
  33025. class: vue.normalizeClass(_ctx.ns.b())
  33026. }, [
  33027. vue.createElementVNode("div", {
  33028. class: vue.normalizeClass(_ctx.ns.e("title"))
  33029. }, [
  33030. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  33031. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  33032. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  33033. ], 2),
  33034. vue.createElementVNode("ul", null, [
  33035. vue.renderSlot(_ctx.$slots, "default")
  33036. ])
  33037. ], 2);
  33038. }
  33039. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]);
  33040. const ElMenu = withInstall(Menu, {
  33041. MenuItem,
  33042. MenuItemGroup,
  33043. SubMenu
  33044. });
  33045. const ElMenuItem = withNoopInstall(MenuItem);
  33046. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  33047. const ElSubMenu = withNoopInstall(SubMenu);
  33048. const pageHeaderProps = buildProps({
  33049. icon: {
  33050. type: iconPropType,
  33051. default: () => back_default
  33052. },
  33053. title: String,
  33054. content: {
  33055. type: String,
  33056. default: ""
  33057. }
  33058. });
  33059. const pageHeaderEmits = {
  33060. back: () => true
  33061. };
  33062. const __default__$P = vue.defineComponent({
  33063. name: "ElPageHeader"
  33064. });
  33065. const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
  33066. ...__default__$P,
  33067. props: pageHeaderProps,
  33068. emits: pageHeaderEmits,
  33069. setup(__props, { emit }) {
  33070. const slots = vue.useSlots();
  33071. const { t } = useLocale();
  33072. const ns = useNamespace("page-header");
  33073. const kls = vue.computed(() => {
  33074. return [
  33075. ns.b(),
  33076. {
  33077. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  33078. [ns.m("has-extra")]: !!slots.extra,
  33079. [ns.is("contentful")]: !!slots.default
  33080. }
  33081. ];
  33082. });
  33083. function handleClick() {
  33084. emit("back");
  33085. }
  33086. return (_ctx, _cache) => {
  33087. return vue.openBlock(), vue.createElementBlock("div", {
  33088. class: vue.normalizeClass(vue.unref(kls))
  33089. }, [
  33090. _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", {
  33091. key: 0,
  33092. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  33093. }, [
  33094. vue.renderSlot(_ctx.$slots, "breadcrumb")
  33095. ], 2)) : vue.createCommentVNode("v-if", true),
  33096. vue.createElementVNode("div", {
  33097. class: vue.normalizeClass(vue.unref(ns).e("header"))
  33098. }, [
  33099. vue.createElementVNode("div", {
  33100. class: vue.normalizeClass(vue.unref(ns).e("left"))
  33101. }, [
  33102. vue.createElementVNode("div", {
  33103. class: vue.normalizeClass(vue.unref(ns).e("back")),
  33104. role: "button",
  33105. tabindex: "0",
  33106. onClick: handleClick
  33107. }, [
  33108. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  33109. key: 0,
  33110. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  33111. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  33112. }, [
  33113. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  33114. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  33115. default: vue.withCtx(() => [
  33116. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  33117. ]),
  33118. _: 1
  33119. })) : vue.createCommentVNode("v-if", true)
  33120. ])
  33121. ], 10, ["aria-label"])) : vue.createCommentVNode("v-if", true),
  33122. vue.createElementVNode("div", {
  33123. class: vue.normalizeClass(vue.unref(ns).e("title"))
  33124. }, [
  33125. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  33126. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  33127. ])
  33128. ], 2)
  33129. ], 2),
  33130. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  33131. vue.createElementVNode("div", {
  33132. class: vue.normalizeClass(vue.unref(ns).e("content"))
  33133. }, [
  33134. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  33135. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  33136. ])
  33137. ], 2)
  33138. ], 2),
  33139. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  33140. key: 0,
  33141. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  33142. }, [
  33143. vue.renderSlot(_ctx.$slots, "extra")
  33144. ], 2)) : vue.createCommentVNode("v-if", true)
  33145. ], 2),
  33146. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  33147. key: 1,
  33148. class: vue.normalizeClass(vue.unref(ns).e("main"))
  33149. }, [
  33150. vue.renderSlot(_ctx.$slots, "default")
  33151. ], 2)) : vue.createCommentVNode("v-if", true)
  33152. ], 2);
  33153. };
  33154. }
  33155. });
  33156. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__file", "page-header.vue"]]);
  33157. const ElPageHeader = withInstall(PageHeader);
  33158. const elPaginationKey = Symbol("elPaginationKey");
  33159. const paginationPrevProps = buildProps({
  33160. disabled: Boolean,
  33161. currentPage: {
  33162. type: Number,
  33163. default: 1
  33164. },
  33165. prevText: {
  33166. type: String
  33167. },
  33168. prevIcon: {
  33169. type: iconPropType
  33170. }
  33171. });
  33172. const paginationPrevEmits = {
  33173. click: (evt) => evt instanceof MouseEvent
  33174. };
  33175. const __default__$O = vue.defineComponent({
  33176. name: "ElPaginationPrev"
  33177. });
  33178. const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
  33179. ...__default__$O,
  33180. props: paginationPrevProps,
  33181. emits: paginationPrevEmits,
  33182. setup(__props) {
  33183. const props = __props;
  33184. const { t } = useLocale();
  33185. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  33186. return (_ctx, _cache) => {
  33187. return vue.openBlock(), vue.createElementBlock("button", {
  33188. type: "button",
  33189. class: "btn-prev",
  33190. disabled: vue.unref(internalDisabled),
  33191. "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
  33192. "aria-disabled": vue.unref(internalDisabled),
  33193. onClick: ($event) => _ctx.$emit("click", $event)
  33194. }, [
  33195. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  33196. default: vue.withCtx(() => [
  33197. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  33198. ]),
  33199. _: 1
  33200. }))
  33201. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  33202. };
  33203. }
  33204. });
  33205. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "prev.vue"]]);
  33206. const paginationNextProps = buildProps({
  33207. disabled: Boolean,
  33208. currentPage: {
  33209. type: Number,
  33210. default: 1
  33211. },
  33212. pageCount: {
  33213. type: Number,
  33214. default: 50
  33215. },
  33216. nextText: {
  33217. type: String
  33218. },
  33219. nextIcon: {
  33220. type: iconPropType
  33221. }
  33222. });
  33223. const __default__$N = vue.defineComponent({
  33224. name: "ElPaginationNext"
  33225. });
  33226. const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
  33227. ...__default__$N,
  33228. props: paginationNextProps,
  33229. emits: ["click"],
  33230. setup(__props) {
  33231. const props = __props;
  33232. const { t } = useLocale();
  33233. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  33234. return (_ctx, _cache) => {
  33235. return vue.openBlock(), vue.createElementBlock("button", {
  33236. type: "button",
  33237. class: "btn-next",
  33238. disabled: vue.unref(internalDisabled),
  33239. "aria-label": _ctx.nextText || vue.unref(t)("el.pagination.next"),
  33240. "aria-disabled": vue.unref(internalDisabled),
  33241. onClick: ($event) => _ctx.$emit("click", $event)
  33242. }, [
  33243. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  33244. default: vue.withCtx(() => [
  33245. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  33246. ]),
  33247. _: 1
  33248. }))
  33249. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  33250. };
  33251. }
  33252. });
  33253. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "next.vue"]]);
  33254. const selectGroupKey = Symbol("ElSelectGroup");
  33255. const selectKey = Symbol("ElSelect");
  33256. function useOption$1(props, states) {
  33257. const select = vue.inject(selectKey);
  33258. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  33259. const itemSelected = vue.computed(() => {
  33260. return contains(castArray$1(select.props.modelValue), props.value);
  33261. });
  33262. const limitReached = vue.computed(() => {
  33263. var _a;
  33264. if (select.props.multiple) {
  33265. const modelValue = castArray$1((_a = select.props.modelValue) != null ? _a : []);
  33266. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  33267. } else {
  33268. return false;
  33269. }
  33270. });
  33271. const currentLabel = vue.computed(() => {
  33272. return props.label || (isObject$1(props.value) ? "" : props.value);
  33273. });
  33274. const currentValue = vue.computed(() => {
  33275. return props.value || props.label || "";
  33276. });
  33277. const isDisabled = vue.computed(() => {
  33278. return props.disabled || states.groupDisabled || limitReached.value;
  33279. });
  33280. const instance = vue.getCurrentInstance();
  33281. const contains = (arr = [], target) => {
  33282. if (!isObject$1(props.value)) {
  33283. return arr && arr.includes(target);
  33284. } else {
  33285. const valueKey = select.props.valueKey;
  33286. return arr && arr.some((item) => {
  33287. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  33288. });
  33289. }
  33290. };
  33291. const hoverItem = () => {
  33292. if (!props.disabled && !selectGroup.disabled) {
  33293. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  33294. }
  33295. };
  33296. const updateOption = (query) => {
  33297. const regexp = new RegExp(escapeStringRegexp(query), "i");
  33298. states.visible = regexp.test(currentLabel.value) || props.created;
  33299. };
  33300. vue.watch(() => currentLabel.value, () => {
  33301. if (!props.created && !select.props.remote)
  33302. select.setSelected();
  33303. });
  33304. vue.watch(() => props.value, (val, oldVal) => {
  33305. const { remote, valueKey } = select.props;
  33306. if (val !== oldVal) {
  33307. select.onOptionDestroy(oldVal, instance.proxy);
  33308. select.onOptionCreate(instance.proxy);
  33309. }
  33310. if (!props.created && !remote) {
  33311. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  33312. return;
  33313. }
  33314. select.setSelected();
  33315. }
  33316. });
  33317. vue.watch(() => selectGroup.disabled, () => {
  33318. states.groupDisabled = selectGroup.disabled;
  33319. }, { immediate: true });
  33320. return {
  33321. select,
  33322. currentLabel,
  33323. currentValue,
  33324. itemSelected,
  33325. isDisabled,
  33326. hoverItem,
  33327. updateOption
  33328. };
  33329. }
  33330. const _sfc_main$_ = vue.defineComponent({
  33331. name: "ElOption",
  33332. componentName: "ElOption",
  33333. props: {
  33334. value: {
  33335. required: true,
  33336. type: [String, Number, Boolean, Object]
  33337. },
  33338. label: [String, Number],
  33339. created: Boolean,
  33340. disabled: Boolean
  33341. },
  33342. setup(props) {
  33343. const ns = useNamespace("select");
  33344. const id = useId();
  33345. const containerKls = vue.computed(() => [
  33346. ns.be("dropdown", "item"),
  33347. ns.is("disabled", vue.unref(isDisabled)),
  33348. ns.is("selected", vue.unref(itemSelected)),
  33349. ns.is("hovering", vue.unref(hover))
  33350. ]);
  33351. const states = vue.reactive({
  33352. index: -1,
  33353. groupDisabled: false,
  33354. visible: true,
  33355. hover: false
  33356. });
  33357. const {
  33358. currentLabel,
  33359. itemSelected,
  33360. isDisabled,
  33361. select,
  33362. hoverItem,
  33363. updateOption
  33364. } = useOption$1(props, states);
  33365. const { visible, hover } = vue.toRefs(states);
  33366. const vm = vue.getCurrentInstance().proxy;
  33367. select.onOptionCreate(vm);
  33368. vue.onBeforeUnmount(() => {
  33369. const key = vm.value;
  33370. const { selected } = select.states;
  33371. const selectedOptions = select.props.multiple ? selected : [selected];
  33372. const doesSelected = selectedOptions.some((item) => {
  33373. return item.value === vm.value;
  33374. });
  33375. vue.nextTick(() => {
  33376. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  33377. select.states.cachedOptions.delete(key);
  33378. }
  33379. });
  33380. select.onOptionDestroy(key, vm);
  33381. });
  33382. function selectOptionClick() {
  33383. if (!isDisabled.value) {
  33384. select.handleOptionSelect(vm);
  33385. }
  33386. }
  33387. return {
  33388. ns,
  33389. id,
  33390. containerKls,
  33391. currentLabel,
  33392. itemSelected,
  33393. isDisabled,
  33394. select,
  33395. hoverItem,
  33396. updateOption,
  33397. visible,
  33398. hover,
  33399. selectOptionClick,
  33400. states
  33401. };
  33402. }
  33403. });
  33404. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  33405. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  33406. id: _ctx.id,
  33407. class: vue.normalizeClass(_ctx.containerKls),
  33408. role: "option",
  33409. "aria-disabled": _ctx.isDisabled || void 0,
  33410. "aria-selected": _ctx.itemSelected,
  33411. onMouseenter: _ctx.hoverItem,
  33412. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  33413. }, [
  33414. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  33415. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  33416. ])
  33417. ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [
  33418. [vue.vShow, _ctx.visible]
  33419. ]);
  33420. }
  33421. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  33422. const _sfc_main$Z = vue.defineComponent({
  33423. name: "ElSelectDropdown",
  33424. componentName: "ElSelectDropdown",
  33425. setup() {
  33426. const select = vue.inject(selectKey);
  33427. const ns = useNamespace("select");
  33428. const popperClass = vue.computed(() => select.props.popperClass);
  33429. const isMultiple = vue.computed(() => select.props.multiple);
  33430. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  33431. const minWidth = vue.ref("");
  33432. function updateMinWidth() {
  33433. var _a;
  33434. minWidth.value = `${(_a = select.selectRef) == null ? void 0 : _a.offsetWidth}px`;
  33435. }
  33436. vue.onMounted(() => {
  33437. updateMinWidth();
  33438. useResizeObserver(select.selectRef, updateMinWidth);
  33439. });
  33440. return {
  33441. ns,
  33442. minWidth,
  33443. popperClass,
  33444. isMultiple,
  33445. isFitInputWidth
  33446. };
  33447. }
  33448. });
  33449. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  33450. return vue.openBlock(), vue.createElementBlock("div", {
  33451. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  33452. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  33453. }, [
  33454. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  33455. key: 0,
  33456. class: vue.normalizeClass(_ctx.ns.be("dropdown", "header"))
  33457. }, [
  33458. vue.renderSlot(_ctx.$slots, "header")
  33459. ], 2)) : vue.createCommentVNode("v-if", true),
  33460. vue.renderSlot(_ctx.$slots, "default"),
  33461. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  33462. key: 1,
  33463. class: vue.normalizeClass(_ctx.ns.be("dropdown", "footer"))
  33464. }, [
  33465. vue.renderSlot(_ctx.$slots, "footer")
  33466. ], 2)) : vue.createCommentVNode("v-if", true)
  33467. ], 6);
  33468. }
  33469. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  33470. const MINIMUM_INPUT_WIDTH$1 = 11;
  33471. const useSelect$3 = (props, emit) => {
  33472. const { t } = useLocale();
  33473. const contentId = useId();
  33474. const nsSelect = useNamespace("select");
  33475. const nsInput = useNamespace("input");
  33476. const states = vue.reactive({
  33477. inputValue: "",
  33478. options: /* @__PURE__ */ new Map(),
  33479. cachedOptions: /* @__PURE__ */ new Map(),
  33480. disabledOptions: /* @__PURE__ */ new Map(),
  33481. optionValues: [],
  33482. selected: [],
  33483. selectionWidth: 0,
  33484. calculatorWidth: 0,
  33485. collapseItemWidth: 0,
  33486. selectedLabel: "",
  33487. hoveringIndex: -1,
  33488. previousQuery: null,
  33489. inputHovering: false,
  33490. menuVisibleOnFocus: false,
  33491. isBeforeHide: false
  33492. });
  33493. const selectRef = vue.ref(null);
  33494. const selectionRef = vue.ref(null);
  33495. const tooltipRef = vue.ref(null);
  33496. const tagTooltipRef = vue.ref(null);
  33497. const inputRef = vue.ref(null);
  33498. const calculatorRef = vue.ref(null);
  33499. const prefixRef = vue.ref(null);
  33500. const suffixRef = vue.ref(null);
  33501. const menuRef = vue.ref(null);
  33502. const tagMenuRef = vue.ref(null);
  33503. const collapseItemRef = vue.ref(null);
  33504. const scrollbarRef = vue.ref(null);
  33505. const {
  33506. isComposing,
  33507. handleCompositionStart,
  33508. handleCompositionUpdate,
  33509. handleCompositionEnd
  33510. } = useComposition({
  33511. afterComposition: (e) => onInput(e)
  33512. });
  33513. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  33514. beforeFocus() {
  33515. return selectDisabled.value;
  33516. },
  33517. afterFocus() {
  33518. if (props.automaticDropdown && !expanded.value) {
  33519. expanded.value = true;
  33520. states.menuVisibleOnFocus = true;
  33521. }
  33522. },
  33523. beforeBlur(event) {
  33524. var _a, _b;
  33525. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  33526. },
  33527. afterBlur() {
  33528. expanded.value = false;
  33529. states.menuVisibleOnFocus = false;
  33530. }
  33531. });
  33532. const expanded = vue.ref(false);
  33533. const hoverOption = vue.ref();
  33534. const { form, formItem } = useFormItem();
  33535. const { inputId } = useFormItemInputId(props, {
  33536. formItemContext: formItem
  33537. });
  33538. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  33539. const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  33540. const hasModelValue = vue.computed(() => {
  33541. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  33542. });
  33543. const showClose = vue.computed(() => {
  33544. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  33545. });
  33546. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  33547. const iconReverse = vue.computed(() => nsSelect.is("reverse", iconComponent.value && expanded.value));
  33548. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  33549. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  33550. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  33551. const emptyText = vue.computed(() => {
  33552. if (props.loading) {
  33553. return props.loadingText || t("el.select.loading");
  33554. } else {
  33555. if (props.remote && !states.inputValue && states.options.size === 0)
  33556. return false;
  33557. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  33558. return props.noMatchText || t("el.select.noMatch");
  33559. }
  33560. if (states.options.size === 0) {
  33561. return props.noDataText || t("el.select.noData");
  33562. }
  33563. }
  33564. return null;
  33565. });
  33566. const filteredOptionsCount = vue.computed(() => optionsArray.value.filter((option) => option.visible).length);
  33567. const optionsArray = vue.computed(() => {
  33568. const list = Array.from(states.options.values());
  33569. const newList = [];
  33570. states.optionValues.forEach((item) => {
  33571. const index = list.findIndex((i) => i.value === item);
  33572. if (index > -1) {
  33573. newList.push(list[index]);
  33574. }
  33575. });
  33576. return newList.length >= list.length ? newList : list;
  33577. });
  33578. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  33579. const showNewOption = vue.computed(() => {
  33580. const hasExistingOption = optionsArray.value.filter((option) => {
  33581. return !option.created;
  33582. }).some((option) => {
  33583. return option.currentLabel === states.inputValue;
  33584. });
  33585. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  33586. });
  33587. const updateOptions = () => {
  33588. if (props.filterable && isFunction$1(props.filterMethod))
  33589. return;
  33590. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  33591. return;
  33592. optionsArray.value.forEach((option) => {
  33593. var _a;
  33594. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  33595. });
  33596. };
  33597. const selectSize = useFormSize();
  33598. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  33599. const dropdownMenuVisible = vue.computed({
  33600. get() {
  33601. return expanded.value && emptyText.value !== false;
  33602. },
  33603. set(val) {
  33604. expanded.value = val;
  33605. }
  33606. });
  33607. const shouldShowPlaceholder = vue.computed(() => {
  33608. if (props.multiple && !isUndefined(props.modelValue)) {
  33609. return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  33610. }
  33611. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  33612. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  33613. });
  33614. const currentPlaceholder = vue.computed(() => {
  33615. var _a;
  33616. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  33617. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  33618. });
  33619. const mouseEnterEventName = vue.computed(() => isIOS ? null : "mouseenter");
  33620. vue.watch(() => props.modelValue, (val, oldVal) => {
  33621. if (props.multiple) {
  33622. if (props.filterable && !props.reserveKeyword) {
  33623. states.inputValue = "";
  33624. handleQueryChange("");
  33625. }
  33626. }
  33627. setSelected();
  33628. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  33629. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  33630. }
  33631. }, {
  33632. flush: "post",
  33633. deep: true
  33634. });
  33635. vue.watch(() => expanded.value, (val) => {
  33636. if (val) {
  33637. handleQueryChange(states.inputValue);
  33638. } else {
  33639. states.inputValue = "";
  33640. states.previousQuery = null;
  33641. states.isBeforeHide = true;
  33642. }
  33643. emit("visible-change", val);
  33644. });
  33645. vue.watch(() => states.options.entries(), () => {
  33646. var _a;
  33647. if (!isClient)
  33648. return;
  33649. const inputs = ((_a = selectRef.value) == null ? void 0 : _a.querySelectorAll("input")) || [];
  33650. if (!props.filterable && !props.defaultFirstOption && !isUndefined(props.modelValue) || !Array.from(inputs).includes(document.activeElement)) {
  33651. setSelected();
  33652. }
  33653. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  33654. checkDefaultFirstOption();
  33655. }
  33656. }, {
  33657. flush: "post"
  33658. });
  33659. vue.watch(() => states.hoveringIndex, (val) => {
  33660. if (isNumber(val) && val > -1) {
  33661. hoverOption.value = optionsArray.value[val] || {};
  33662. } else {
  33663. hoverOption.value = {};
  33664. }
  33665. optionsArray.value.forEach((option) => {
  33666. option.hover = hoverOption.value === option;
  33667. });
  33668. });
  33669. vue.watchEffect(() => {
  33670. if (states.isBeforeHide)
  33671. return;
  33672. updateOptions();
  33673. });
  33674. const handleQueryChange = (val) => {
  33675. if (states.previousQuery === val || isComposing.value) {
  33676. return;
  33677. }
  33678. states.previousQuery = val;
  33679. if (props.filterable && isFunction$1(props.filterMethod)) {
  33680. props.filterMethod(val);
  33681. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  33682. props.remoteMethod(val);
  33683. }
  33684. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  33685. vue.nextTick(checkDefaultFirstOption);
  33686. } else {
  33687. vue.nextTick(updateHoveringIndex);
  33688. }
  33689. };
  33690. const checkDefaultFirstOption = () => {
  33691. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  33692. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  33693. const firstOriginOption = optionsInDropdown[0];
  33694. states.hoveringIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  33695. };
  33696. const setSelected = () => {
  33697. if (!props.multiple) {
  33698. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  33699. const option = getOption(value);
  33700. states.selectedLabel = option.currentLabel;
  33701. states.selected = [option];
  33702. return;
  33703. } else {
  33704. states.selectedLabel = "";
  33705. }
  33706. const result = [];
  33707. if (!isUndefined(props.modelValue)) {
  33708. castArray$1(props.modelValue).forEach((value) => {
  33709. result.push(getOption(value));
  33710. });
  33711. }
  33712. states.selected = result;
  33713. };
  33714. const getOption = (value) => {
  33715. let option;
  33716. const isObjectValue = toRawType(value).toLowerCase() === "object";
  33717. const isNull = toRawType(value).toLowerCase() === "null";
  33718. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  33719. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  33720. const cachedOption = cachedOptionsArray.value[i];
  33721. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  33722. if (isEqualValue) {
  33723. option = {
  33724. value,
  33725. currentLabel: cachedOption.currentLabel,
  33726. get isDisabled() {
  33727. return cachedOption.isDisabled;
  33728. }
  33729. };
  33730. break;
  33731. }
  33732. }
  33733. if (option)
  33734. return option;
  33735. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  33736. const newOption = {
  33737. value,
  33738. currentLabel: label
  33739. };
  33740. return newOption;
  33741. };
  33742. const updateHoveringIndex = () => {
  33743. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  33744. };
  33745. const resetSelectionWidth = () => {
  33746. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  33747. };
  33748. const resetCalculatorWidth = () => {
  33749. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  33750. };
  33751. const resetCollapseItemWidth = () => {
  33752. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  33753. };
  33754. const updateTooltip = () => {
  33755. var _a, _b;
  33756. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  33757. };
  33758. const updateTagTooltip = () => {
  33759. var _a, _b;
  33760. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  33761. };
  33762. const onInputChange = () => {
  33763. if (states.inputValue.length > 0 && !expanded.value) {
  33764. expanded.value = true;
  33765. }
  33766. handleQueryChange(states.inputValue);
  33767. };
  33768. const onInput = (event) => {
  33769. states.inputValue = event.target.value;
  33770. if (props.remote) {
  33771. debouncedOnInputChange();
  33772. } else {
  33773. return onInputChange();
  33774. }
  33775. };
  33776. const debouncedOnInputChange = debounce(() => {
  33777. onInputChange();
  33778. }, debounce$1.value);
  33779. const emitChange = (val) => {
  33780. if (!isEqual$1(props.modelValue, val)) {
  33781. emit(CHANGE_EVENT, val);
  33782. }
  33783. };
  33784. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.disabledOptions.has(it));
  33785. const deletePrevTag = (e) => {
  33786. if (!props.multiple)
  33787. return;
  33788. if (e.code === EVENT_CODE.delete)
  33789. return;
  33790. if (e.target.value.length <= 0) {
  33791. const value = castArray$1(props.modelValue).slice();
  33792. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  33793. if (lastNotDisabledIndex < 0)
  33794. return;
  33795. const removeTagValue = value[lastNotDisabledIndex];
  33796. value.splice(lastNotDisabledIndex, 1);
  33797. emit(UPDATE_MODEL_EVENT, value);
  33798. emitChange(value);
  33799. emit("remove-tag", removeTagValue);
  33800. }
  33801. };
  33802. const deleteTag = (event, tag) => {
  33803. const index = states.selected.indexOf(tag);
  33804. if (index > -1 && !selectDisabled.value) {
  33805. const value = castArray$1(props.modelValue).slice();
  33806. value.splice(index, 1);
  33807. emit(UPDATE_MODEL_EVENT, value);
  33808. emitChange(value);
  33809. emit("remove-tag", tag.value);
  33810. }
  33811. event.stopPropagation();
  33812. focus();
  33813. };
  33814. const deleteSelected = (event) => {
  33815. event.stopPropagation();
  33816. const value = props.multiple ? [] : valueOnClear.value;
  33817. if (props.multiple) {
  33818. for (const item of states.selected) {
  33819. if (item.isDisabled)
  33820. value.push(item.value);
  33821. }
  33822. }
  33823. emit(UPDATE_MODEL_EVENT, value);
  33824. emitChange(value);
  33825. states.hoveringIndex = -1;
  33826. expanded.value = false;
  33827. emit("clear");
  33828. focus();
  33829. };
  33830. const handleOptionSelect = (option) => {
  33831. var _a;
  33832. if (props.multiple) {
  33833. const value = castArray$1((_a = props.modelValue) != null ? _a : []).slice();
  33834. const optionIndex = getValueIndex(value, option.value);
  33835. if (optionIndex > -1) {
  33836. value.splice(optionIndex, 1);
  33837. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  33838. value.push(option.value);
  33839. }
  33840. emit(UPDATE_MODEL_EVENT, value);
  33841. emitChange(value);
  33842. if (option.created) {
  33843. handleQueryChange("");
  33844. }
  33845. if (props.filterable && !props.reserveKeyword) {
  33846. states.inputValue = "";
  33847. }
  33848. } else {
  33849. emit(UPDATE_MODEL_EVENT, option.value);
  33850. emitChange(option.value);
  33851. expanded.value = false;
  33852. }
  33853. focus();
  33854. if (expanded.value)
  33855. return;
  33856. vue.nextTick(() => {
  33857. scrollToOption(option);
  33858. });
  33859. };
  33860. const getValueIndex = (arr = [], value) => {
  33861. if (!isObject$1(value))
  33862. return arr.indexOf(value);
  33863. const valueKey = props.valueKey;
  33864. let index = -1;
  33865. arr.some((item, i) => {
  33866. if (vue.toRaw(get(item, valueKey)) === get(value, valueKey)) {
  33867. index = i;
  33868. return true;
  33869. }
  33870. return false;
  33871. });
  33872. return index;
  33873. };
  33874. const scrollToOption = (option) => {
  33875. var _a, _b, _c, _d, _e;
  33876. const targetOption = isArray$1(option) ? option[0] : option;
  33877. let target = null;
  33878. if (targetOption == null ? void 0 : targetOption.value) {
  33879. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  33880. if (options.length > 0) {
  33881. target = options[0].$el;
  33882. }
  33883. }
  33884. if (tooltipRef.value && target) {
  33885. const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${nsSelect.be("dropdown", "wrap")}`);
  33886. if (menu) {
  33887. scrollIntoView(menu, target);
  33888. }
  33889. }
  33890. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  33891. };
  33892. const onOptionCreate = (vm) => {
  33893. states.options.set(vm.value, vm);
  33894. states.cachedOptions.set(vm.value, vm);
  33895. vm.disabled && states.disabledOptions.set(vm.value, vm);
  33896. };
  33897. const onOptionDestroy = (key, vm) => {
  33898. if (states.options.get(key) === vm) {
  33899. states.options.delete(key);
  33900. }
  33901. };
  33902. const popperRef = vue.computed(() => {
  33903. var _a, _b;
  33904. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  33905. });
  33906. const handleMenuEnter = () => {
  33907. states.isBeforeHide = false;
  33908. vue.nextTick(() => scrollToOption(states.selected));
  33909. };
  33910. const focus = () => {
  33911. var _a;
  33912. (_a = inputRef.value) == null ? void 0 : _a.focus();
  33913. };
  33914. const blur = () => {
  33915. var _a;
  33916. (_a = inputRef.value) == null ? void 0 : _a.blur();
  33917. };
  33918. const handleClearClick = (event) => {
  33919. deleteSelected(event);
  33920. };
  33921. const handleClickOutside = () => {
  33922. expanded.value = false;
  33923. isFocused.value && blur();
  33924. };
  33925. const handleEsc = () => {
  33926. if (states.inputValue.length > 0) {
  33927. states.inputValue = "";
  33928. } else {
  33929. expanded.value = false;
  33930. }
  33931. };
  33932. const toggleMenu = () => {
  33933. if (selectDisabled.value)
  33934. return;
  33935. if (isIOS)
  33936. states.inputHovering = true;
  33937. if (states.menuVisibleOnFocus) {
  33938. states.menuVisibleOnFocus = false;
  33939. } else {
  33940. expanded.value = !expanded.value;
  33941. }
  33942. };
  33943. const selectOption = () => {
  33944. if (!expanded.value) {
  33945. toggleMenu();
  33946. } else {
  33947. if (optionsArray.value[states.hoveringIndex]) {
  33948. handleOptionSelect(optionsArray.value[states.hoveringIndex]);
  33949. }
  33950. }
  33951. };
  33952. const getValueKey = (item) => {
  33953. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  33954. };
  33955. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  33956. const showTagList = vue.computed(() => {
  33957. if (!props.multiple) {
  33958. return [];
  33959. }
  33960. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  33961. });
  33962. const collapseTagList = vue.computed(() => {
  33963. if (!props.multiple) {
  33964. return [];
  33965. }
  33966. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  33967. });
  33968. const navigateOptions = (direction) => {
  33969. if (!expanded.value) {
  33970. expanded.value = true;
  33971. return;
  33972. }
  33973. if (states.options.size === 0 || states.filteredOptionsCount === 0 || isComposing.value)
  33974. return;
  33975. if (!optionsAllDisabled.value) {
  33976. if (direction === "next") {
  33977. states.hoveringIndex++;
  33978. if (states.hoveringIndex === states.options.size) {
  33979. states.hoveringIndex = 0;
  33980. }
  33981. } else if (direction === "prev") {
  33982. states.hoveringIndex--;
  33983. if (states.hoveringIndex < 0) {
  33984. states.hoveringIndex = states.options.size - 1;
  33985. }
  33986. }
  33987. const option = optionsArray.value[states.hoveringIndex];
  33988. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  33989. navigateOptions(direction);
  33990. }
  33991. vue.nextTick(() => scrollToOption(hoverOption.value));
  33992. }
  33993. };
  33994. const getGapWidth = () => {
  33995. if (!selectionRef.value)
  33996. return 0;
  33997. const style = window.getComputedStyle(selectionRef.value);
  33998. return Number.parseFloat(style.gap || "6px");
  33999. };
  34000. const tagStyle = vue.computed(() => {
  34001. const gapWidth = getGapWidth();
  34002. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  34003. return { maxWidth: `${maxWidth}px` };
  34004. });
  34005. const collapseTagStyle = vue.computed(() => {
  34006. return { maxWidth: `${states.selectionWidth}px` };
  34007. });
  34008. const inputStyle = vue.computed(() => ({
  34009. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH$1)}px`
  34010. }));
  34011. useResizeObserver(selectionRef, resetSelectionWidth);
  34012. useResizeObserver(calculatorRef, resetCalculatorWidth);
  34013. useResizeObserver(menuRef, updateTooltip);
  34014. useResizeObserver(wrapperRef, updateTooltip);
  34015. useResizeObserver(tagMenuRef, updateTagTooltip);
  34016. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  34017. vue.onMounted(() => {
  34018. setSelected();
  34019. });
  34020. return {
  34021. inputId,
  34022. contentId,
  34023. nsSelect,
  34024. nsInput,
  34025. states,
  34026. isFocused,
  34027. expanded,
  34028. optionsArray,
  34029. hoverOption,
  34030. selectSize,
  34031. filteredOptionsCount,
  34032. resetCalculatorWidth,
  34033. updateTooltip,
  34034. updateTagTooltip,
  34035. debouncedOnInputChange,
  34036. onInput,
  34037. deletePrevTag,
  34038. deleteTag,
  34039. deleteSelected,
  34040. handleOptionSelect,
  34041. scrollToOption,
  34042. hasModelValue,
  34043. shouldShowPlaceholder,
  34044. currentPlaceholder,
  34045. mouseEnterEventName,
  34046. showClose,
  34047. iconComponent,
  34048. iconReverse,
  34049. validateState,
  34050. validateIcon,
  34051. showNewOption,
  34052. updateOptions,
  34053. collapseTagSize,
  34054. setSelected,
  34055. selectDisabled,
  34056. emptyText,
  34057. handleCompositionStart,
  34058. handleCompositionUpdate,
  34059. handleCompositionEnd,
  34060. onOptionCreate,
  34061. onOptionDestroy,
  34062. handleMenuEnter,
  34063. focus,
  34064. blur,
  34065. handleClearClick,
  34066. handleClickOutside,
  34067. handleEsc,
  34068. toggleMenu,
  34069. selectOption,
  34070. getValueKey,
  34071. navigateOptions,
  34072. dropdownMenuVisible,
  34073. showTagList,
  34074. collapseTagList,
  34075. tagStyle,
  34076. collapseTagStyle,
  34077. inputStyle,
  34078. popperRef,
  34079. inputRef,
  34080. tooltipRef,
  34081. tagTooltipRef,
  34082. calculatorRef,
  34083. prefixRef,
  34084. suffixRef,
  34085. selectRef,
  34086. wrapperRef,
  34087. selectionRef,
  34088. scrollbarRef,
  34089. menuRef,
  34090. tagMenuRef,
  34091. collapseItemRef
  34092. };
  34093. };
  34094. var ElOptions = vue.defineComponent({
  34095. name: "ElOptions",
  34096. setup(_, { slots }) {
  34097. const select = vue.inject(selectKey);
  34098. let cachedValueList = [];
  34099. return () => {
  34100. var _a, _b;
  34101. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  34102. const valueList = [];
  34103. function filterOptions(children2) {
  34104. if (!isArray$1(children2))
  34105. return;
  34106. children2.forEach((item) => {
  34107. var _a2, _b2, _c, _d;
  34108. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  34109. if (name === "ElOptionGroup") {
  34110. filterOptions(!isString$1(item.children) && !isArray$1(item.children) && isFunction$1((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  34111. } else if (name === "ElOption") {
  34112. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  34113. } else if (isArray$1(item.children)) {
  34114. filterOptions(item.children);
  34115. }
  34116. });
  34117. }
  34118. if (children.length) {
  34119. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  34120. }
  34121. if (!isEqual$1(valueList, cachedValueList)) {
  34122. cachedValueList = valueList;
  34123. if (select) {
  34124. select.states.optionValues = valueList;
  34125. }
  34126. }
  34127. return children;
  34128. };
  34129. }
  34130. });
  34131. const SelectProps$1 = buildProps({
  34132. name: String,
  34133. id: String,
  34134. modelValue: {
  34135. type: [Array, String, Number, Boolean, Object],
  34136. default: void 0
  34137. },
  34138. autocomplete: {
  34139. type: String,
  34140. default: "off"
  34141. },
  34142. automaticDropdown: Boolean,
  34143. size: useSizeProp,
  34144. effect: {
  34145. type: definePropType(String),
  34146. default: "light"
  34147. },
  34148. disabled: Boolean,
  34149. clearable: Boolean,
  34150. filterable: Boolean,
  34151. allowCreate: Boolean,
  34152. loading: Boolean,
  34153. popperClass: {
  34154. type: String,
  34155. default: ""
  34156. },
  34157. popperOptions: {
  34158. type: definePropType(Object),
  34159. default: () => ({})
  34160. },
  34161. remote: Boolean,
  34162. loadingText: String,
  34163. noMatchText: String,
  34164. noDataText: String,
  34165. remoteMethod: Function,
  34166. filterMethod: Function,
  34167. multiple: Boolean,
  34168. multipleLimit: {
  34169. type: Number,
  34170. default: 0
  34171. },
  34172. placeholder: {
  34173. type: String
  34174. },
  34175. defaultFirstOption: Boolean,
  34176. reserveKeyword: {
  34177. type: Boolean,
  34178. default: true
  34179. },
  34180. valueKey: {
  34181. type: String,
  34182. default: "value"
  34183. },
  34184. collapseTags: Boolean,
  34185. collapseTagsTooltip: Boolean,
  34186. maxCollapseTags: {
  34187. type: Number,
  34188. default: 1
  34189. },
  34190. teleported: useTooltipContentProps.teleported,
  34191. persistent: {
  34192. type: Boolean,
  34193. default: true
  34194. },
  34195. clearIcon: {
  34196. type: iconPropType,
  34197. default: circle_close_default
  34198. },
  34199. fitInputWidth: Boolean,
  34200. suffixIcon: {
  34201. type: iconPropType,
  34202. default: arrow_down_default
  34203. },
  34204. tagType: { ...tagProps.type, default: "info" },
  34205. tagEffect: { ...tagProps.effect, default: "light" },
  34206. validateEvent: {
  34207. type: Boolean,
  34208. default: true
  34209. },
  34210. remoteShowSuffix: Boolean,
  34211. placement: {
  34212. type: definePropType(String),
  34213. values: Ee,
  34214. default: "bottom-start"
  34215. },
  34216. fallbackPlacements: {
  34217. type: definePropType(Array),
  34218. default: ["bottom-start", "top-start", "right", "left"]
  34219. },
  34220. ...useEmptyValuesProps,
  34221. ...useAriaProps(["ariaLabel"])
  34222. });
  34223. const COMPONENT_NAME$9 = "ElSelect";
  34224. const _sfc_main$Y = vue.defineComponent({
  34225. name: COMPONENT_NAME$9,
  34226. componentName: COMPONENT_NAME$9,
  34227. components: {
  34228. ElSelectMenu: ElSelectMenu$1,
  34229. ElOption: Option,
  34230. ElOptions,
  34231. ElTag,
  34232. ElScrollbar,
  34233. ElTooltip,
  34234. ElIcon
  34235. },
  34236. directives: { ClickOutside },
  34237. props: SelectProps$1,
  34238. emits: [
  34239. UPDATE_MODEL_EVENT,
  34240. CHANGE_EVENT,
  34241. "remove-tag",
  34242. "clear",
  34243. "visible-change",
  34244. "focus",
  34245. "blur"
  34246. ],
  34247. setup(props, { emit }) {
  34248. const modelValue = vue.computed(() => {
  34249. const { modelValue: rawModelValue, multiple } = props;
  34250. const fallback = multiple ? [] : void 0;
  34251. if (isArray$1(rawModelValue)) {
  34252. return multiple ? rawModelValue : fallback;
  34253. }
  34254. return multiple ? fallback : rawModelValue;
  34255. });
  34256. const _props = vue.reactive({
  34257. ...vue.toRefs(props),
  34258. modelValue
  34259. });
  34260. const API = useSelect$3(_props, emit);
  34261. vue.provide(selectKey, vue.reactive({
  34262. props: _props,
  34263. states: API.states,
  34264. optionsArray: API.optionsArray,
  34265. handleOptionSelect: API.handleOptionSelect,
  34266. onOptionCreate: API.onOptionCreate,
  34267. onOptionDestroy: API.onOptionDestroy,
  34268. selectRef: API.selectRef,
  34269. setSelected: API.setSelected
  34270. }));
  34271. return {
  34272. ...API,
  34273. modelValue
  34274. };
  34275. }
  34276. });
  34277. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  34278. const _component_el_tag = vue.resolveComponent("el-tag");
  34279. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  34280. const _component_el_icon = vue.resolveComponent("el-icon");
  34281. const _component_el_option = vue.resolveComponent("el-option");
  34282. const _component_el_options = vue.resolveComponent("el-options");
  34283. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  34284. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  34285. const _directive_click_outside = vue.resolveDirective("click-outside");
  34286. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  34287. ref: "selectRef",
  34288. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  34289. [vue.toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
  34290. onMouseleave: ($event) => _ctx.states.inputHovering = false
  34291. }, [
  34292. vue.createVNode(_component_el_tooltip, {
  34293. ref: "tooltipRef",
  34294. visible: _ctx.dropdownMenuVisible,
  34295. placement: _ctx.placement,
  34296. teleported: _ctx.teleported,
  34297. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  34298. "popper-options": _ctx.popperOptions,
  34299. "fallback-placements": _ctx.fallbackPlacements,
  34300. effect: _ctx.effect,
  34301. pure: "",
  34302. trigger: "click",
  34303. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  34304. "stop-popper-mouse-event": false,
  34305. "gpu-acceleration": false,
  34306. persistent: _ctx.persistent,
  34307. onBeforeShow: _ctx.handleMenuEnter,
  34308. onHide: ($event) => _ctx.states.isBeforeHide = false
  34309. }, {
  34310. default: vue.withCtx(() => {
  34311. var _a;
  34312. return [
  34313. vue.createElementVNode("div", {
  34314. ref: "wrapperRef",
  34315. class: vue.normalizeClass([
  34316. _ctx.nsSelect.e("wrapper"),
  34317. _ctx.nsSelect.is("focused", _ctx.isFocused),
  34318. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  34319. _ctx.nsSelect.is("filterable", _ctx.filterable),
  34320. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  34321. ]),
  34322. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  34323. }, [
  34324. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  34325. key: 0,
  34326. ref: "prefixRef",
  34327. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  34328. }, [
  34329. vue.renderSlot(_ctx.$slots, "prefix")
  34330. ], 2)) : vue.createCommentVNode("v-if", true),
  34331. vue.createElementVNode("div", {
  34332. ref: "selectionRef",
  34333. class: vue.normalizeClass([
  34334. _ctx.nsSelect.e("selection"),
  34335. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  34336. ])
  34337. }, [
  34338. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  34339. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  34340. return vue.openBlock(), vue.createElementBlock("div", {
  34341. key: _ctx.getValueKey(item),
  34342. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  34343. }, [
  34344. vue.createVNode(_component_el_tag, {
  34345. closable: !_ctx.selectDisabled && !item.isDisabled,
  34346. size: _ctx.collapseTagSize,
  34347. type: _ctx.tagType,
  34348. effect: _ctx.tagEffect,
  34349. "disable-transitions": "",
  34350. style: vue.normalizeStyle(_ctx.tagStyle),
  34351. onClose: ($event) => _ctx.deleteTag($event, item)
  34352. }, {
  34353. default: vue.withCtx(() => [
  34354. vue.createElementVNode("span", {
  34355. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  34356. }, [
  34357. vue.renderSlot(_ctx.$slots, "label", {
  34358. label: item.currentLabel,
  34359. value: item.value
  34360. }, () => [
  34361. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  34362. ])
  34363. ], 2)
  34364. ]),
  34365. _: 2
  34366. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  34367. ], 2);
  34368. }), 128)),
  34369. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  34370. key: 0,
  34371. ref: "tagTooltipRef",
  34372. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  34373. "fallback-placements": ["bottom", "top", "right", "left"],
  34374. effect: _ctx.effect,
  34375. placement: "bottom",
  34376. teleported: _ctx.teleported
  34377. }, {
  34378. default: vue.withCtx(() => [
  34379. vue.createElementVNode("div", {
  34380. ref: "collapseItemRef",
  34381. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  34382. }, [
  34383. vue.createVNode(_component_el_tag, {
  34384. closable: false,
  34385. size: _ctx.collapseTagSize,
  34386. type: _ctx.tagType,
  34387. effect: _ctx.tagEffect,
  34388. "disable-transitions": "",
  34389. style: vue.normalizeStyle(_ctx.collapseTagStyle)
  34390. }, {
  34391. default: vue.withCtx(() => [
  34392. vue.createElementVNode("span", {
  34393. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  34394. }, " + " + vue.toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  34395. ]),
  34396. _: 1
  34397. }, 8, ["size", "type", "effect", "style"])
  34398. ], 2)
  34399. ]),
  34400. content: vue.withCtx(() => [
  34401. vue.createElementVNode("div", {
  34402. ref: "tagMenuRef",
  34403. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  34404. }, [
  34405. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (item) => {
  34406. return vue.openBlock(), vue.createElementBlock("div", {
  34407. key: _ctx.getValueKey(item),
  34408. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  34409. }, [
  34410. vue.createVNode(_component_el_tag, {
  34411. class: "in-tooltip",
  34412. closable: !_ctx.selectDisabled && !item.isDisabled,
  34413. size: _ctx.collapseTagSize,
  34414. type: _ctx.tagType,
  34415. effect: _ctx.tagEffect,
  34416. "disable-transitions": "",
  34417. onClose: ($event) => _ctx.deleteTag($event, item)
  34418. }, {
  34419. default: vue.withCtx(() => [
  34420. vue.createElementVNode("span", {
  34421. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  34422. }, [
  34423. vue.renderSlot(_ctx.$slots, "label", {
  34424. label: item.currentLabel,
  34425. value: item.value
  34426. }, () => [
  34427. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  34428. ])
  34429. ], 2)
  34430. ]),
  34431. _: 2
  34432. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  34433. ], 2);
  34434. }), 128))
  34435. ], 2)
  34436. ]),
  34437. _: 3
  34438. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  34439. ]) : vue.createCommentVNode("v-if", true),
  34440. !_ctx.selectDisabled ? (vue.openBlock(), vue.createElementBlock("div", {
  34441. key: 1,
  34442. class: vue.normalizeClass([
  34443. _ctx.nsSelect.e("selected-item"),
  34444. _ctx.nsSelect.e("input-wrapper"),
  34445. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  34446. ])
  34447. }, [
  34448. vue.withDirectives(vue.createElementVNode("input", {
  34449. id: _ctx.inputId,
  34450. ref: "inputRef",
  34451. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  34452. type: "text",
  34453. name: _ctx.name,
  34454. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  34455. disabled: _ctx.selectDisabled,
  34456. autocomplete: _ctx.autocomplete,
  34457. style: vue.normalizeStyle(_ctx.inputStyle),
  34458. role: "combobox",
  34459. readonly: !_ctx.filterable,
  34460. spellcheck: "false",
  34461. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  34462. "aria-controls": _ctx.contentId,
  34463. "aria-expanded": _ctx.dropdownMenuVisible,
  34464. "aria-label": _ctx.ariaLabel,
  34465. "aria-autocomplete": "none",
  34466. "aria-haspopup": "listbox",
  34467. onKeydown: [
  34468. vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
  34469. vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
  34470. vue.withKeys(vue.withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  34471. vue.withKeys(vue.withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  34472. vue.withKeys(vue.withModifiers(_ctx.deletePrevTag, ["stop"]), ["delete"])
  34473. ],
  34474. onCompositionstart: _ctx.handleCompositionStart,
  34475. onCompositionupdate: _ctx.handleCompositionUpdate,
  34476. onCompositionend: _ctx.handleCompositionEnd,
  34477. onInput: _ctx.onInput,
  34478. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  34479. }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
  34480. [vue.vModelText, _ctx.states.inputValue]
  34481. ]),
  34482. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  34483. key: 0,
  34484. ref: "calculatorRef",
  34485. "aria-hidden": "true",
  34486. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  34487. textContent: vue.toDisplayString(_ctx.states.inputValue)
  34488. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  34489. ], 2)) : vue.createCommentVNode("v-if", true),
  34490. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  34491. key: 2,
  34492. class: vue.normalizeClass([
  34493. _ctx.nsSelect.e("selected-item"),
  34494. _ctx.nsSelect.e("placeholder"),
  34495. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  34496. ])
  34497. }, [
  34498. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  34499. key: 0,
  34500. label: _ctx.currentPlaceholder,
  34501. value: _ctx.modelValue
  34502. }, () => [
  34503. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  34504. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  34505. ], 2)) : vue.createCommentVNode("v-if", true)
  34506. ], 2),
  34507. vue.createElementVNode("div", {
  34508. ref: "suffixRef",
  34509. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  34510. }, [
  34511. _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  34512. key: 0,
  34513. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  34514. }, {
  34515. default: vue.withCtx(() => [
  34516. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  34517. ]),
  34518. _: 1
  34519. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  34520. _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  34521. key: 1,
  34522. class: vue.normalizeClass([
  34523. _ctx.nsSelect.e("caret"),
  34524. _ctx.nsSelect.e("icon"),
  34525. _ctx.nsSelect.e("clear")
  34526. ]),
  34527. onClick: _ctx.handleClearClick
  34528. }, {
  34529. default: vue.withCtx(() => [
  34530. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  34531. ]),
  34532. _: 1
  34533. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  34534. _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  34535. key: 2,
  34536. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  34537. }, {
  34538. default: vue.withCtx(() => [
  34539. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  34540. ]),
  34541. _: 1
  34542. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  34543. ], 2)
  34544. ], 10, ["onClick"])
  34545. ];
  34546. }),
  34547. content: vue.withCtx(() => [
  34548. vue.createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  34549. default: vue.withCtx(() => [
  34550. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  34551. key: 0,
  34552. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  34553. onClick: vue.withModifiers(() => {
  34554. }, ["stop"])
  34555. }, [
  34556. vue.renderSlot(_ctx.$slots, "header")
  34557. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true),
  34558. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  34559. id: _ctx.contentId,
  34560. ref: "scrollbarRef",
  34561. tag: "ul",
  34562. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  34563. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  34564. class: vue.normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  34565. role: "listbox",
  34566. "aria-label": _ctx.ariaLabel,
  34567. "aria-orientation": "vertical"
  34568. }, {
  34569. default: vue.withCtx(() => [
  34570. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  34571. key: 0,
  34572. value: _ctx.states.inputValue,
  34573. created: true
  34574. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  34575. vue.createVNode(_component_el_options, null, {
  34576. default: vue.withCtx(() => [
  34577. vue.renderSlot(_ctx.$slots, "default")
  34578. ]),
  34579. _: 3
  34580. })
  34581. ]),
  34582. _: 3
  34583. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
  34584. [vue.vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  34585. ]),
  34586. _ctx.$slots.loading && _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  34587. key: 1,
  34588. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  34589. }, [
  34590. vue.renderSlot(_ctx.$slots, "loading")
  34591. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  34592. key: 2,
  34593. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  34594. }, [
  34595. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  34596. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  34597. ])
  34598. ], 2)) : vue.createCommentVNode("v-if", true),
  34599. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  34600. key: 3,
  34601. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  34602. onClick: vue.withModifiers(() => {
  34603. }, ["stop"])
  34604. }, [
  34605. vue.renderSlot(_ctx.$slots, "footer")
  34606. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  34607. ]),
  34608. _: 3
  34609. }, 512)
  34610. ]),
  34611. _: 3
  34612. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "onBeforeShow", "onHide"])
  34613. ], 16, ["onMouseleave"])), [
  34614. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  34615. ]);
  34616. }
  34617. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  34618. const _sfc_main$X = vue.defineComponent({
  34619. name: "ElOptionGroup",
  34620. componentName: "ElOptionGroup",
  34621. props: {
  34622. label: String,
  34623. disabled: Boolean
  34624. },
  34625. setup(props) {
  34626. const ns = useNamespace("select");
  34627. const groupRef = vue.ref(null);
  34628. const instance = vue.getCurrentInstance();
  34629. const children = vue.ref([]);
  34630. vue.provide(selectGroupKey, vue.reactive({
  34631. ...vue.toRefs(props)
  34632. }));
  34633. const visible = vue.computed(() => children.value.some((option) => option.visible === true));
  34634. const isOption = (node) => {
  34635. var _a, _b;
  34636. return ((_a = node.type) == null ? void 0 : _a.name) === "ElOption" && !!((_b = node.component) == null ? void 0 : _b.proxy);
  34637. };
  34638. const flattedChildren = (node) => {
  34639. const Nodes = castArray$1(node);
  34640. const children2 = [];
  34641. Nodes.forEach((child) => {
  34642. var _a, _b;
  34643. if (isOption(child)) {
  34644. children2.push(child.component.proxy);
  34645. } else if ((_a = child.children) == null ? void 0 : _a.length) {
  34646. children2.push(...flattedChildren(child.children));
  34647. } else if ((_b = child.component) == null ? void 0 : _b.subTree) {
  34648. children2.push(...flattedChildren(child.component.subTree));
  34649. }
  34650. });
  34651. return children2;
  34652. };
  34653. const updateChildren = () => {
  34654. children.value = flattedChildren(instance.subTree);
  34655. };
  34656. vue.onMounted(() => {
  34657. updateChildren();
  34658. });
  34659. useMutationObserver(groupRef, updateChildren, {
  34660. attributes: true,
  34661. subtree: true,
  34662. childList: true
  34663. });
  34664. return {
  34665. groupRef,
  34666. visible,
  34667. ns
  34668. };
  34669. }
  34670. });
  34671. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  34672. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  34673. ref: "groupRef",
  34674. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  34675. }, [
  34676. vue.createElementVNode("li", {
  34677. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  34678. }, vue.toDisplayString(_ctx.label), 3),
  34679. vue.createElementVNode("li", null, [
  34680. vue.createElementVNode("ul", {
  34681. class: vue.normalizeClass(_ctx.ns.b("group"))
  34682. }, [
  34683. vue.renderSlot(_ctx.$slots, "default")
  34684. ], 2)
  34685. ])
  34686. ], 2)), [
  34687. [vue.vShow, _ctx.visible]
  34688. ]);
  34689. }
  34690. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  34691. const ElSelect = withInstall(Select$1, {
  34692. Option,
  34693. OptionGroup
  34694. });
  34695. const ElOption = withNoopInstall(Option);
  34696. const ElOptionGroup = withNoopInstall(OptionGroup);
  34697. const usePagination = () => vue.inject(elPaginationKey, {});
  34698. const paginationSizesProps = buildProps({
  34699. pageSize: {
  34700. type: Number,
  34701. required: true
  34702. },
  34703. pageSizes: {
  34704. type: definePropType(Array),
  34705. default: () => mutable([10, 20, 30, 40, 50, 100])
  34706. },
  34707. popperClass: {
  34708. type: String
  34709. },
  34710. disabled: Boolean,
  34711. teleported: Boolean,
  34712. size: {
  34713. type: String,
  34714. values: componentSizes
  34715. }
  34716. });
  34717. const __default__$M = vue.defineComponent({
  34718. name: "ElPaginationSizes"
  34719. });
  34720. const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
  34721. ...__default__$M,
  34722. props: paginationSizesProps,
  34723. emits: ["page-size-change"],
  34724. setup(__props, { emit }) {
  34725. const props = __props;
  34726. const { t } = useLocale();
  34727. const ns = useNamespace("pagination");
  34728. const pagination = usePagination();
  34729. const innerPageSize = vue.ref(props.pageSize);
  34730. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  34731. if (isEqual$1(newVal, oldVal))
  34732. return;
  34733. if (Array.isArray(newVal)) {
  34734. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  34735. emit("page-size-change", pageSize);
  34736. }
  34737. });
  34738. vue.watch(() => props.pageSize, (newVal) => {
  34739. innerPageSize.value = newVal;
  34740. });
  34741. const innerPageSizes = vue.computed(() => props.pageSizes);
  34742. function handleChange(val) {
  34743. var _a;
  34744. if (val !== innerPageSize.value) {
  34745. innerPageSize.value = val;
  34746. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  34747. }
  34748. }
  34749. return (_ctx, _cache) => {
  34750. return vue.openBlock(), vue.createElementBlock("span", {
  34751. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  34752. }, [
  34753. vue.createVNode(vue.unref(ElSelect), {
  34754. "model-value": innerPageSize.value,
  34755. disabled: _ctx.disabled,
  34756. "popper-class": _ctx.popperClass,
  34757. size: _ctx.size,
  34758. teleported: _ctx.teleported,
  34759. "validate-event": false,
  34760. onChange: handleChange
  34761. }, {
  34762. default: vue.withCtx(() => [
  34763. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  34764. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  34765. key: item,
  34766. value: item,
  34767. label: item + vue.unref(t)("el.pagination.pagesize")
  34768. }, null, 8, ["value", "label"]);
  34769. }), 128))
  34770. ]),
  34771. _: 1
  34772. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported"])
  34773. ], 2);
  34774. };
  34775. }
  34776. });
  34777. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__file", "sizes.vue"]]);
  34778. const paginationJumperProps = buildProps({
  34779. size: {
  34780. type: String,
  34781. values: componentSizes
  34782. }
  34783. });
  34784. const __default__$L = vue.defineComponent({
  34785. name: "ElPaginationJumper"
  34786. });
  34787. const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
  34788. ...__default__$L,
  34789. props: paginationJumperProps,
  34790. setup(__props) {
  34791. const { t } = useLocale();
  34792. const ns = useNamespace("pagination");
  34793. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  34794. const userInput = vue.ref();
  34795. const innerValue = vue.computed(() => {
  34796. var _a;
  34797. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  34798. });
  34799. function handleInput(val) {
  34800. userInput.value = val ? +val : "";
  34801. }
  34802. function handleChange(val) {
  34803. val = Math.trunc(+val);
  34804. changeEvent == null ? void 0 : changeEvent(val);
  34805. userInput.value = void 0;
  34806. }
  34807. return (_ctx, _cache) => {
  34808. return vue.openBlock(), vue.createElementBlock("span", {
  34809. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  34810. disabled: vue.unref(disabled)
  34811. }, [
  34812. vue.createElementVNode("span", {
  34813. class: vue.normalizeClass([vue.unref(ns).e("goto")])
  34814. }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3),
  34815. vue.createVNode(vue.unref(ElInput), {
  34816. size: _ctx.size,
  34817. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  34818. min: 1,
  34819. max: vue.unref(pageCount),
  34820. disabled: vue.unref(disabled),
  34821. "model-value": vue.unref(innerValue),
  34822. "validate-event": false,
  34823. "aria-label": vue.unref(t)("el.pagination.page"),
  34824. type: "number",
  34825. "onUpdate:modelValue": handleInput,
  34826. onChange: handleChange
  34827. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  34828. vue.createElementVNode("span", {
  34829. class: vue.normalizeClass([vue.unref(ns).e("classifier")])
  34830. }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3)
  34831. ], 10, ["disabled"]);
  34832. };
  34833. }
  34834. });
  34835. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__file", "jumper.vue"]]);
  34836. const paginationTotalProps = buildProps({
  34837. total: {
  34838. type: Number,
  34839. default: 1e3
  34840. }
  34841. });
  34842. const __default__$K = vue.defineComponent({
  34843. name: "ElPaginationTotal"
  34844. });
  34845. const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
  34846. ...__default__$K,
  34847. props: paginationTotalProps,
  34848. setup(__props) {
  34849. const { t } = useLocale();
  34850. const ns = useNamespace("pagination");
  34851. const { disabled } = usePagination();
  34852. return (_ctx, _cache) => {
  34853. return vue.openBlock(), vue.createElementBlock("span", {
  34854. class: vue.normalizeClass(vue.unref(ns).e("total")),
  34855. disabled: vue.unref(disabled)
  34856. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  34857. total: _ctx.total
  34858. })), 11, ["disabled"]);
  34859. };
  34860. }
  34861. });
  34862. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "total.vue"]]);
  34863. const paginationPagerProps = buildProps({
  34864. currentPage: {
  34865. type: Number,
  34866. default: 1
  34867. },
  34868. pageCount: {
  34869. type: Number,
  34870. required: true
  34871. },
  34872. pagerCount: {
  34873. type: Number,
  34874. default: 7
  34875. },
  34876. disabled: Boolean
  34877. });
  34878. const __default__$J = vue.defineComponent({
  34879. name: "ElPaginationPager"
  34880. });
  34881. const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
  34882. ...__default__$J,
  34883. props: paginationPagerProps,
  34884. emits: ["change"],
  34885. setup(__props, { emit }) {
  34886. const props = __props;
  34887. const nsPager = useNamespace("pager");
  34888. const nsIcon = useNamespace("icon");
  34889. const { t } = useLocale();
  34890. const showPrevMore = vue.ref(false);
  34891. const showNextMore = vue.ref(false);
  34892. const quickPrevHover = vue.ref(false);
  34893. const quickNextHover = vue.ref(false);
  34894. const quickPrevFocus = vue.ref(false);
  34895. const quickNextFocus = vue.ref(false);
  34896. const pagers = vue.computed(() => {
  34897. const pagerCount = props.pagerCount;
  34898. const halfPagerCount = (pagerCount - 1) / 2;
  34899. const currentPage = Number(props.currentPage);
  34900. const pageCount = Number(props.pageCount);
  34901. let showPrevMore2 = false;
  34902. let showNextMore2 = false;
  34903. if (pageCount > pagerCount) {
  34904. if (currentPage > pagerCount - halfPagerCount) {
  34905. showPrevMore2 = true;
  34906. }
  34907. if (currentPage < pageCount - halfPagerCount) {
  34908. showNextMore2 = true;
  34909. }
  34910. }
  34911. const array = [];
  34912. if (showPrevMore2 && !showNextMore2) {
  34913. const startPage = pageCount - (pagerCount - 2);
  34914. for (let i = startPage; i < pageCount; i++) {
  34915. array.push(i);
  34916. }
  34917. } else if (!showPrevMore2 && showNextMore2) {
  34918. for (let i = 2; i < pagerCount; i++) {
  34919. array.push(i);
  34920. }
  34921. } else if (showPrevMore2 && showNextMore2) {
  34922. const offset = Math.floor(pagerCount / 2) - 1;
  34923. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  34924. array.push(i);
  34925. }
  34926. } else {
  34927. for (let i = 2; i < pageCount; i++) {
  34928. array.push(i);
  34929. }
  34930. }
  34931. return array;
  34932. });
  34933. const prevMoreKls = vue.computed(() => [
  34934. "more",
  34935. "btn-quickprev",
  34936. nsIcon.b(),
  34937. nsPager.is("disabled", props.disabled)
  34938. ]);
  34939. const nextMoreKls = vue.computed(() => [
  34940. "more",
  34941. "btn-quicknext",
  34942. nsIcon.b(),
  34943. nsPager.is("disabled", props.disabled)
  34944. ]);
  34945. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  34946. vue.watchEffect(() => {
  34947. const halfPagerCount = (props.pagerCount - 1) / 2;
  34948. showPrevMore.value = false;
  34949. showNextMore.value = false;
  34950. if (props.pageCount > props.pagerCount) {
  34951. if (props.currentPage > props.pagerCount - halfPagerCount) {
  34952. showPrevMore.value = true;
  34953. }
  34954. if (props.currentPage < props.pageCount - halfPagerCount) {
  34955. showNextMore.value = true;
  34956. }
  34957. }
  34958. });
  34959. function onMouseEnter(forward = false) {
  34960. if (props.disabled)
  34961. return;
  34962. if (forward) {
  34963. quickPrevHover.value = true;
  34964. } else {
  34965. quickNextHover.value = true;
  34966. }
  34967. }
  34968. function onFocus(forward = false) {
  34969. if (forward) {
  34970. quickPrevFocus.value = true;
  34971. } else {
  34972. quickNextFocus.value = true;
  34973. }
  34974. }
  34975. function onEnter(e) {
  34976. const target = e.target;
  34977. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  34978. const newPage = Number(target.textContent);
  34979. if (newPage !== props.currentPage) {
  34980. emit("change", newPage);
  34981. }
  34982. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  34983. onPagerClick(e);
  34984. }
  34985. }
  34986. function onPagerClick(event) {
  34987. const target = event.target;
  34988. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  34989. return;
  34990. }
  34991. let newPage = Number(target.textContent);
  34992. const pageCount = props.pageCount;
  34993. const currentPage = props.currentPage;
  34994. const pagerCountOffset = props.pagerCount - 2;
  34995. if (target.className.includes("more")) {
  34996. if (target.className.includes("quickprev")) {
  34997. newPage = currentPage - pagerCountOffset;
  34998. } else if (target.className.includes("quicknext")) {
  34999. newPage = currentPage + pagerCountOffset;
  35000. }
  35001. }
  35002. if (!Number.isNaN(+newPage)) {
  35003. if (newPage < 1) {
  35004. newPage = 1;
  35005. }
  35006. if (newPage > pageCount) {
  35007. newPage = pageCount;
  35008. }
  35009. }
  35010. if (newPage !== currentPage) {
  35011. emit("change", newPage);
  35012. }
  35013. }
  35014. return (_ctx, _cache) => {
  35015. return vue.openBlock(), vue.createElementBlock("ul", {
  35016. class: vue.normalizeClass(vue.unref(nsPager).b()),
  35017. onClick: onPagerClick,
  35018. onKeyup: vue.withKeys(onEnter, ["enter"])
  35019. }, [
  35020. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  35021. key: 0,
  35022. class: vue.normalizeClass([[
  35023. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  35024. vue.unref(nsPager).is("disabled", _ctx.disabled)
  35025. ], "number"]),
  35026. "aria-current": _ctx.currentPage === 1,
  35027. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }),
  35028. tabindex: vue.unref(tabindex)
  35029. }, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true),
  35030. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  35031. key: 1,
  35032. class: vue.normalizeClass(vue.unref(prevMoreKls)),
  35033. tabindex: vue.unref(tabindex),
  35034. "aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  35035. onMouseenter: ($event) => onMouseEnter(true),
  35036. onMouseleave: ($event) => quickPrevHover.value = false,
  35037. onFocus: ($event) => onFocus(true),
  35038. onBlur: ($event) => quickPrevFocus.value = false
  35039. }, [
  35040. (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 }))
  35041. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  35042. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  35043. return vue.openBlock(), vue.createElementBlock("li", {
  35044. key: pager,
  35045. class: vue.normalizeClass([[
  35046. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  35047. vue.unref(nsPager).is("disabled", _ctx.disabled)
  35048. ], "number"]),
  35049. "aria-current": _ctx.currentPage === pager,
  35050. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager }),
  35051. tabindex: vue.unref(tabindex)
  35052. }, vue.toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
  35053. }), 128)),
  35054. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  35055. key: 2,
  35056. class: vue.normalizeClass(vue.unref(nextMoreKls)),
  35057. tabindex: vue.unref(tabindex),
  35058. "aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  35059. onMouseenter: ($event) => onMouseEnter(),
  35060. onMouseleave: ($event) => quickNextHover.value = false,
  35061. onFocus: ($event) => onFocus(),
  35062. onBlur: ($event) => quickNextFocus.value = false
  35063. }, [
  35064. (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 }))
  35065. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  35066. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  35067. key: 3,
  35068. class: vue.normalizeClass([[
  35069. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  35070. vue.unref(nsPager).is("disabled", _ctx.disabled)
  35071. ], "number"]),
  35072. "aria-current": _ctx.currentPage === _ctx.pageCount,
  35073. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  35074. tabindex: vue.unref(tabindex)
  35075. }, vue.toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true)
  35076. ], 42, ["onKeyup"]);
  35077. };
  35078. }
  35079. });
  35080. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "pager.vue"]]);
  35081. const isAbsent = (v) => typeof v !== "number";
  35082. const paginationProps = buildProps({
  35083. pageSize: Number,
  35084. defaultPageSize: Number,
  35085. total: Number,
  35086. pageCount: Number,
  35087. pagerCount: {
  35088. type: Number,
  35089. validator: (value) => {
  35090. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  35091. },
  35092. default: 7
  35093. },
  35094. currentPage: Number,
  35095. defaultCurrentPage: Number,
  35096. layout: {
  35097. type: String,
  35098. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  35099. },
  35100. pageSizes: {
  35101. type: definePropType(Array),
  35102. default: () => mutable([10, 20, 30, 40, 50, 100])
  35103. },
  35104. popperClass: {
  35105. type: String,
  35106. default: ""
  35107. },
  35108. prevText: {
  35109. type: String,
  35110. default: ""
  35111. },
  35112. prevIcon: {
  35113. type: iconPropType,
  35114. default: () => arrow_left_default
  35115. },
  35116. nextText: {
  35117. type: String,
  35118. default: ""
  35119. },
  35120. nextIcon: {
  35121. type: iconPropType,
  35122. default: () => arrow_right_default
  35123. },
  35124. teleported: {
  35125. type: Boolean,
  35126. default: true
  35127. },
  35128. small: Boolean,
  35129. size: useSizeProp,
  35130. background: Boolean,
  35131. disabled: Boolean,
  35132. hideOnSinglePage: Boolean
  35133. });
  35134. const paginationEmits = {
  35135. "update:current-page": (val) => isNumber(val),
  35136. "update:page-size": (val) => isNumber(val),
  35137. "size-change": (val) => isNumber(val),
  35138. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  35139. "current-change": (val) => isNumber(val),
  35140. "prev-click": (val) => isNumber(val),
  35141. "next-click": (val) => isNumber(val)
  35142. };
  35143. const componentName = "ElPagination";
  35144. var Pagination = vue.defineComponent({
  35145. name: componentName,
  35146. props: paginationProps,
  35147. emits: paginationEmits,
  35148. setup(props, { emit, slots }) {
  35149. const { t } = useLocale();
  35150. const ns = useNamespace("pagination");
  35151. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  35152. const _globalSize = useGlobalSize();
  35153. const _size = vue.computed(() => {
  35154. var _a;
  35155. return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
  35156. });
  35157. useDeprecated({
  35158. from: "small",
  35159. replacement: "size",
  35160. version: "3.0.0",
  35161. scope: "el-pagination",
  35162. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  35163. }, vue.computed(() => !!props.small));
  35164. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  35165. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  35166. const assertValidUsage = vue.computed(() => {
  35167. if (isAbsent(props.total) && isAbsent(props.pageCount))
  35168. return false;
  35169. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  35170. return false;
  35171. if (props.layout.includes("sizes")) {
  35172. if (!isAbsent(props.pageCount)) {
  35173. if (!hasPageSizeListener)
  35174. return false;
  35175. } else if (!isAbsent(props.total)) {
  35176. if (!isAbsent(props.pageSize)) {
  35177. if (!hasPageSizeListener) {
  35178. return false;
  35179. }
  35180. }
  35181. }
  35182. }
  35183. return true;
  35184. });
  35185. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  35186. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  35187. const pageSizeBridge = vue.computed({
  35188. get() {
  35189. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  35190. },
  35191. set(v) {
  35192. if (isAbsent(props.pageSize)) {
  35193. innerPageSize.value = v;
  35194. }
  35195. if (hasPageSizeListener) {
  35196. emit("update:page-size", v);
  35197. emit("size-change", v);
  35198. }
  35199. }
  35200. });
  35201. const pageCountBridge = vue.computed(() => {
  35202. let pageCount = 0;
  35203. if (!isAbsent(props.pageCount)) {
  35204. pageCount = props.pageCount;
  35205. } else if (!isAbsent(props.total)) {
  35206. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  35207. }
  35208. return pageCount;
  35209. });
  35210. const currentPageBridge = vue.computed({
  35211. get() {
  35212. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  35213. },
  35214. set(v) {
  35215. let newCurrentPage = v;
  35216. if (v < 1) {
  35217. newCurrentPage = 1;
  35218. } else if (v > pageCountBridge.value) {
  35219. newCurrentPage = pageCountBridge.value;
  35220. }
  35221. if (isAbsent(props.currentPage)) {
  35222. innerCurrentPage.value = newCurrentPage;
  35223. }
  35224. if (hasCurrentPageListener) {
  35225. emit("update:current-page", newCurrentPage);
  35226. emit("current-change", newCurrentPage);
  35227. }
  35228. }
  35229. });
  35230. vue.watch(pageCountBridge, (val) => {
  35231. if (currentPageBridge.value > val)
  35232. currentPageBridge.value = val;
  35233. });
  35234. vue.watch([currentPageBridge, pageSizeBridge], (value) => {
  35235. emit("change", ...value);
  35236. }, { flush: "post" });
  35237. function handleCurrentChange(val) {
  35238. currentPageBridge.value = val;
  35239. }
  35240. function handleSizeChange(val) {
  35241. pageSizeBridge.value = val;
  35242. const newPageCount = pageCountBridge.value;
  35243. if (currentPageBridge.value > newPageCount) {
  35244. currentPageBridge.value = newPageCount;
  35245. }
  35246. }
  35247. function prev() {
  35248. if (props.disabled)
  35249. return;
  35250. currentPageBridge.value -= 1;
  35251. emit("prev-click", currentPageBridge.value);
  35252. }
  35253. function next() {
  35254. if (props.disabled)
  35255. return;
  35256. currentPageBridge.value += 1;
  35257. emit("next-click", currentPageBridge.value);
  35258. }
  35259. function addClass(element, cls) {
  35260. if (element) {
  35261. if (!element.props) {
  35262. element.props = {};
  35263. }
  35264. element.props.class = [element.props.class, cls].join(" ");
  35265. }
  35266. }
  35267. vue.provide(elPaginationKey, {
  35268. pageCount: pageCountBridge,
  35269. disabled: vue.computed(() => props.disabled),
  35270. currentPage: currentPageBridge,
  35271. changeEvent: handleCurrentChange,
  35272. handleSizeChange
  35273. });
  35274. return () => {
  35275. var _a, _b;
  35276. if (!assertValidUsage.value) {
  35277. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  35278. return null;
  35279. }
  35280. if (!props.layout)
  35281. return null;
  35282. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  35283. return null;
  35284. const rootChildren = [];
  35285. const rightWrapperChildren = [];
  35286. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  35287. const TEMPLATE_MAP = {
  35288. prev: vue.h(Prev, {
  35289. disabled: props.disabled,
  35290. currentPage: currentPageBridge.value,
  35291. prevText: props.prevText,
  35292. prevIcon: props.prevIcon,
  35293. onClick: prev
  35294. }),
  35295. jumper: vue.h(Jumper, {
  35296. size: _size.value
  35297. }),
  35298. pager: vue.h(Pager, {
  35299. currentPage: currentPageBridge.value,
  35300. pageCount: pageCountBridge.value,
  35301. pagerCount: props.pagerCount,
  35302. onChange: handleCurrentChange,
  35303. disabled: props.disabled
  35304. }),
  35305. next: vue.h(Next, {
  35306. disabled: props.disabled,
  35307. currentPage: currentPageBridge.value,
  35308. pageCount: pageCountBridge.value,
  35309. nextText: props.nextText,
  35310. nextIcon: props.nextIcon,
  35311. onClick: next
  35312. }),
  35313. sizes: vue.h(Sizes, {
  35314. pageSize: pageSizeBridge.value,
  35315. pageSizes: props.pageSizes,
  35316. popperClass: props.popperClass,
  35317. disabled: props.disabled,
  35318. teleported: props.teleported,
  35319. size: _size.value
  35320. }),
  35321. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  35322. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  35323. };
  35324. const components = props.layout.split(",").map((item) => item.trim());
  35325. let haveRightWrapper = false;
  35326. components.forEach((c) => {
  35327. if (c === "->") {
  35328. haveRightWrapper = true;
  35329. return;
  35330. }
  35331. if (!haveRightWrapper) {
  35332. rootChildren.push(TEMPLATE_MAP[c]);
  35333. } else {
  35334. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  35335. }
  35336. });
  35337. addClass(rootChildren[0], ns.is("first"));
  35338. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  35339. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  35340. addClass(rightWrapperChildren[0], ns.is("first"));
  35341. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  35342. rootChildren.push(rightWrapperRoot);
  35343. }
  35344. return vue.h("div", {
  35345. class: [
  35346. ns.b(),
  35347. ns.is("background", props.background),
  35348. ns.m(_size.value)
  35349. ]
  35350. }, rootChildren);
  35351. };
  35352. }
  35353. });
  35354. const ElPagination = withInstall(Pagination);
  35355. const popconfirmProps = buildProps({
  35356. title: String,
  35357. confirmButtonText: String,
  35358. cancelButtonText: String,
  35359. confirmButtonType: {
  35360. type: String,
  35361. values: buttonTypes,
  35362. default: "primary"
  35363. },
  35364. cancelButtonType: {
  35365. type: String,
  35366. values: buttonTypes,
  35367. default: "text"
  35368. },
  35369. icon: {
  35370. type: iconPropType,
  35371. default: () => question_filled_default
  35372. },
  35373. iconColor: {
  35374. type: String,
  35375. default: "#f90"
  35376. },
  35377. hideIcon: {
  35378. type: Boolean,
  35379. default: false
  35380. },
  35381. hideAfter: {
  35382. type: Number,
  35383. default: 200
  35384. },
  35385. teleported: useTooltipContentProps.teleported,
  35386. persistent: useTooltipContentProps.persistent,
  35387. width: {
  35388. type: [String, Number],
  35389. default: 150
  35390. }
  35391. });
  35392. const popconfirmEmits = {
  35393. confirm: (e) => e instanceof MouseEvent,
  35394. cancel: (e) => e instanceof MouseEvent
  35395. };
  35396. const __default__$I = vue.defineComponent({
  35397. name: "ElPopconfirm"
  35398. });
  35399. const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
  35400. ...__default__$I,
  35401. props: popconfirmProps,
  35402. emits: popconfirmEmits,
  35403. setup(__props, { emit }) {
  35404. const props = __props;
  35405. const { t } = useLocale();
  35406. const ns = useNamespace("popconfirm");
  35407. const tooltipRef = vue.ref();
  35408. const hidePopper = () => {
  35409. var _a, _b;
  35410. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  35411. };
  35412. const style = vue.computed(() => {
  35413. return {
  35414. width: addUnit(props.width)
  35415. };
  35416. });
  35417. const confirm = (e) => {
  35418. emit("confirm", e);
  35419. hidePopper();
  35420. };
  35421. const cancel = (e) => {
  35422. emit("cancel", e);
  35423. hidePopper();
  35424. };
  35425. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  35426. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  35427. return (_ctx, _cache) => {
  35428. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  35429. ref_key: "tooltipRef",
  35430. ref: tooltipRef,
  35431. trigger: "click",
  35432. effect: "light"
  35433. }, _ctx.$attrs, {
  35434. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  35435. "popper-style": vue.unref(style),
  35436. teleported: _ctx.teleported,
  35437. "fallback-placements": ["bottom", "top", "right", "left"],
  35438. "hide-after": _ctx.hideAfter,
  35439. persistent: _ctx.persistent
  35440. }), {
  35441. content: vue.withCtx(() => [
  35442. vue.createElementVNode("div", {
  35443. class: vue.normalizeClass(vue.unref(ns).b())
  35444. }, [
  35445. vue.createElementVNode("div", {
  35446. class: vue.normalizeClass(vue.unref(ns).e("main"))
  35447. }, [
  35448. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  35449. key: 0,
  35450. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  35451. style: vue.normalizeStyle({ color: _ctx.iconColor })
  35452. }, {
  35453. default: vue.withCtx(() => [
  35454. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  35455. ]),
  35456. _: 1
  35457. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  35458. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  35459. ], 2),
  35460. vue.createElementVNode("div", {
  35461. class: vue.normalizeClass(vue.unref(ns).e("action"))
  35462. }, [
  35463. vue.renderSlot(_ctx.$slots, "actions", {
  35464. confirm,
  35465. cancel
  35466. }, () => [
  35467. vue.createVNode(vue.unref(ElButton), {
  35468. size: "small",
  35469. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  35470. text: _ctx.cancelButtonType === "text",
  35471. onClick: cancel
  35472. }, {
  35473. default: vue.withCtx(() => [
  35474. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  35475. ]),
  35476. _: 1
  35477. }, 8, ["type", "text"]),
  35478. vue.createVNode(vue.unref(ElButton), {
  35479. size: "small",
  35480. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  35481. text: _ctx.confirmButtonType === "text",
  35482. onClick: confirm
  35483. }, {
  35484. default: vue.withCtx(() => [
  35485. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  35486. ]),
  35487. _: 1
  35488. }, 8, ["type", "text"])
  35489. ])
  35490. ], 2)
  35491. ], 2)
  35492. ]),
  35493. default: vue.withCtx(() => [
  35494. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  35495. ]),
  35496. _: 3
  35497. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  35498. };
  35499. }
  35500. });
  35501. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "popconfirm.vue"]]);
  35502. const ElPopconfirm = withInstall(Popconfirm);
  35503. const popoverProps = buildProps({
  35504. trigger: useTooltipTriggerProps.trigger,
  35505. placement: dropdownProps.placement,
  35506. disabled: useTooltipTriggerProps.disabled,
  35507. visible: useTooltipContentProps.visible,
  35508. transition: useTooltipContentProps.transition,
  35509. popperOptions: dropdownProps.popperOptions,
  35510. tabindex: dropdownProps.tabindex,
  35511. content: useTooltipContentProps.content,
  35512. popperStyle: useTooltipContentProps.popperStyle,
  35513. popperClass: useTooltipContentProps.popperClass,
  35514. enterable: {
  35515. ...useTooltipContentProps.enterable,
  35516. default: true
  35517. },
  35518. effect: {
  35519. ...useTooltipContentProps.effect,
  35520. default: "light"
  35521. },
  35522. teleported: useTooltipContentProps.teleported,
  35523. title: String,
  35524. width: {
  35525. type: [String, Number],
  35526. default: 150
  35527. },
  35528. offset: {
  35529. type: Number,
  35530. default: void 0
  35531. },
  35532. showAfter: {
  35533. type: Number,
  35534. default: 0
  35535. },
  35536. hideAfter: {
  35537. type: Number,
  35538. default: 200
  35539. },
  35540. autoClose: {
  35541. type: Number,
  35542. default: 0
  35543. },
  35544. showArrow: {
  35545. type: Boolean,
  35546. default: true
  35547. },
  35548. persistent: {
  35549. type: Boolean,
  35550. default: true
  35551. },
  35552. "onUpdate:visible": {
  35553. type: Function
  35554. }
  35555. });
  35556. const popoverEmits = {
  35557. "update:visible": (value) => isBoolean(value),
  35558. "before-enter": () => true,
  35559. "before-leave": () => true,
  35560. "after-enter": () => true,
  35561. "after-leave": () => true
  35562. };
  35563. const updateEventKeyRaw = `onUpdate:visible`;
  35564. const __default__$H = vue.defineComponent({
  35565. name: "ElPopover"
  35566. });
  35567. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  35568. ...__default__$H,
  35569. props: popoverProps,
  35570. emits: popoverEmits,
  35571. setup(__props, { expose, emit }) {
  35572. const props = __props;
  35573. const onUpdateVisible = vue.computed(() => {
  35574. return props[updateEventKeyRaw];
  35575. });
  35576. const ns = useNamespace("popover");
  35577. const tooltipRef = vue.ref();
  35578. const popperRef = vue.computed(() => {
  35579. var _a;
  35580. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  35581. });
  35582. const style = vue.computed(() => {
  35583. return [
  35584. {
  35585. width: addUnit(props.width)
  35586. },
  35587. props.popperStyle
  35588. ];
  35589. });
  35590. const kls = vue.computed(() => {
  35591. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  35592. });
  35593. const gpuAcceleration = vue.computed(() => {
  35594. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  35595. });
  35596. const hide = () => {
  35597. var _a;
  35598. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  35599. };
  35600. const beforeEnter = () => {
  35601. emit("before-enter");
  35602. };
  35603. const beforeLeave = () => {
  35604. emit("before-leave");
  35605. };
  35606. const afterEnter = () => {
  35607. emit("after-enter");
  35608. };
  35609. const afterLeave = () => {
  35610. emit("update:visible", false);
  35611. emit("after-leave");
  35612. };
  35613. expose({
  35614. popperRef,
  35615. hide
  35616. });
  35617. return (_ctx, _cache) => {
  35618. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  35619. ref_key: "tooltipRef",
  35620. ref: tooltipRef
  35621. }, _ctx.$attrs, {
  35622. trigger: _ctx.trigger,
  35623. placement: _ctx.placement,
  35624. disabled: _ctx.disabled,
  35625. visible: _ctx.visible,
  35626. transition: _ctx.transition,
  35627. "popper-options": _ctx.popperOptions,
  35628. tabindex: _ctx.tabindex,
  35629. content: _ctx.content,
  35630. offset: _ctx.offset,
  35631. "show-after": _ctx.showAfter,
  35632. "hide-after": _ctx.hideAfter,
  35633. "auto-close": _ctx.autoClose,
  35634. "show-arrow": _ctx.showArrow,
  35635. "aria-label": _ctx.title,
  35636. effect: _ctx.effect,
  35637. enterable: _ctx.enterable,
  35638. "popper-class": vue.unref(kls),
  35639. "popper-style": vue.unref(style),
  35640. teleported: _ctx.teleported,
  35641. persistent: _ctx.persistent,
  35642. "gpu-acceleration": vue.unref(gpuAcceleration),
  35643. "onUpdate:visible": vue.unref(onUpdateVisible),
  35644. onBeforeShow: beforeEnter,
  35645. onBeforeHide: beforeLeave,
  35646. onShow: afterEnter,
  35647. onHide: afterLeave
  35648. }), {
  35649. content: vue.withCtx(() => [
  35650. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  35651. key: 0,
  35652. class: vue.normalizeClass(vue.unref(ns).e("title")),
  35653. role: "title"
  35654. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  35655. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  35656. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  35657. ])
  35658. ]),
  35659. default: vue.withCtx(() => [
  35660. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  35661. ]),
  35662. _: 3
  35663. }, 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"]);
  35664. };
  35665. }
  35666. });
  35667. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "popover.vue"]]);
  35668. const attachEvents = (el, binding) => {
  35669. const popperComponent = binding.arg || binding.value;
  35670. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  35671. if (popover) {
  35672. popover.triggerRef = el;
  35673. }
  35674. };
  35675. var PopoverDirective = {
  35676. mounted(el, binding) {
  35677. attachEvents(el, binding);
  35678. },
  35679. updated(el, binding) {
  35680. attachEvents(el, binding);
  35681. }
  35682. };
  35683. const VPopover = "popover";
  35684. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  35685. const ElPopover = withInstall(Popover, {
  35686. directive: ElPopoverDirective
  35687. });
  35688. const progressProps = buildProps({
  35689. type: {
  35690. type: String,
  35691. default: "line",
  35692. values: ["line", "circle", "dashboard"]
  35693. },
  35694. percentage: {
  35695. type: Number,
  35696. default: 0,
  35697. validator: (val) => val >= 0 && val <= 100
  35698. },
  35699. status: {
  35700. type: String,
  35701. default: "",
  35702. values: ["", "success", "exception", "warning"]
  35703. },
  35704. indeterminate: Boolean,
  35705. duration: {
  35706. type: Number,
  35707. default: 3
  35708. },
  35709. strokeWidth: {
  35710. type: Number,
  35711. default: 6
  35712. },
  35713. strokeLinecap: {
  35714. type: definePropType(String),
  35715. default: "round"
  35716. },
  35717. textInside: Boolean,
  35718. width: {
  35719. type: Number,
  35720. default: 126
  35721. },
  35722. showText: {
  35723. type: Boolean,
  35724. default: true
  35725. },
  35726. color: {
  35727. type: definePropType([
  35728. String,
  35729. Array,
  35730. Function
  35731. ]),
  35732. default: ""
  35733. },
  35734. striped: Boolean,
  35735. stripedFlow: Boolean,
  35736. format: {
  35737. type: definePropType(Function),
  35738. default: (percentage) => `${percentage}%`
  35739. }
  35740. });
  35741. const __default__$G = vue.defineComponent({
  35742. name: "ElProgress"
  35743. });
  35744. const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
  35745. ...__default__$G,
  35746. props: progressProps,
  35747. setup(__props) {
  35748. const props = __props;
  35749. const STATUS_COLOR_MAP = {
  35750. success: "#13ce66",
  35751. exception: "#ff4949",
  35752. warning: "#e6a23c",
  35753. default: "#20a0ff"
  35754. };
  35755. const ns = useNamespace("progress");
  35756. const barStyle = vue.computed(() => {
  35757. const barStyle2 = {
  35758. width: `${props.percentage}%`,
  35759. animationDuration: `${props.duration}s`
  35760. };
  35761. const color = getCurrentColor(props.percentage);
  35762. if (color.includes("gradient")) {
  35763. barStyle2.background = color;
  35764. } else {
  35765. barStyle2.backgroundColor = color;
  35766. }
  35767. return barStyle2;
  35768. });
  35769. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  35770. const radius = vue.computed(() => {
  35771. if (["circle", "dashboard"].includes(props.type)) {
  35772. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  35773. }
  35774. return 0;
  35775. });
  35776. const trackPath = vue.computed(() => {
  35777. const r = radius.value;
  35778. const isDashboard = props.type === "dashboard";
  35779. return `
  35780. M 50 50
  35781. m 0 ${isDashboard ? "" : "-"}${r}
  35782. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  35783. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  35784. `;
  35785. });
  35786. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  35787. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  35788. const strokeDashoffset = vue.computed(() => {
  35789. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  35790. return `${offset}px`;
  35791. });
  35792. const trailPathStyle = vue.computed(() => ({
  35793. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  35794. strokeDashoffset: strokeDashoffset.value
  35795. }));
  35796. const circlePathStyle = vue.computed(() => ({
  35797. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  35798. strokeDashoffset: strokeDashoffset.value,
  35799. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  35800. }));
  35801. const stroke = vue.computed(() => {
  35802. let ret;
  35803. if (props.color) {
  35804. ret = getCurrentColor(props.percentage);
  35805. } else {
  35806. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  35807. }
  35808. return ret;
  35809. });
  35810. const statusIcon = vue.computed(() => {
  35811. if (props.status === "warning") {
  35812. return warning_filled_default;
  35813. }
  35814. if (props.type === "line") {
  35815. return props.status === "success" ? circle_check_default : circle_close_default;
  35816. } else {
  35817. return props.status === "success" ? check_default : close_default;
  35818. }
  35819. });
  35820. const progressTextSize = vue.computed(() => {
  35821. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  35822. });
  35823. const content = vue.computed(() => props.format(props.percentage));
  35824. function getColors(color) {
  35825. const span = 100 / color.length;
  35826. const seriesColors = color.map((seriesColor, index) => {
  35827. if (isString$1(seriesColor)) {
  35828. return {
  35829. color: seriesColor,
  35830. percentage: (index + 1) * span
  35831. };
  35832. }
  35833. return seriesColor;
  35834. });
  35835. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  35836. }
  35837. const getCurrentColor = (percentage) => {
  35838. var _a;
  35839. const { color } = props;
  35840. if (isFunction$1(color)) {
  35841. return color(percentage);
  35842. } else if (isString$1(color)) {
  35843. return color;
  35844. } else {
  35845. const colors = getColors(color);
  35846. for (const color2 of colors) {
  35847. if (color2.percentage > percentage)
  35848. return color2.color;
  35849. }
  35850. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  35851. }
  35852. };
  35853. return (_ctx, _cache) => {
  35854. return vue.openBlock(), vue.createElementBlock("div", {
  35855. class: vue.normalizeClass([
  35856. vue.unref(ns).b(),
  35857. vue.unref(ns).m(_ctx.type),
  35858. vue.unref(ns).is(_ctx.status),
  35859. {
  35860. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  35861. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  35862. }
  35863. ]),
  35864. role: "progressbar",
  35865. "aria-valuenow": _ctx.percentage,
  35866. "aria-valuemin": "0",
  35867. "aria-valuemax": "100"
  35868. }, [
  35869. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  35870. key: 0,
  35871. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  35872. }, [
  35873. vue.createElementVNode("div", {
  35874. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  35875. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  35876. }, [
  35877. vue.createElementVNode("div", {
  35878. class: vue.normalizeClass([
  35879. vue.unref(ns).be("bar", "inner"),
  35880. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  35881. { [vue.unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  35882. { [vue.unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  35883. ]),
  35884. style: vue.normalizeStyle(vue.unref(barStyle))
  35885. }, [
  35886. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  35887. key: 0,
  35888. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  35889. }, [
  35890. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  35891. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  35892. ])
  35893. ], 2)) : vue.createCommentVNode("v-if", true)
  35894. ], 6)
  35895. ], 6)
  35896. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  35897. key: 1,
  35898. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  35899. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  35900. }, [
  35901. (vue.openBlock(), vue.createElementBlock("svg", { viewBox: "0 0 100 100" }, [
  35902. vue.createElementVNode("path", {
  35903. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  35904. d: vue.unref(trackPath),
  35905. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  35906. "stroke-linecap": _ctx.strokeLinecap,
  35907. "stroke-width": vue.unref(relativeStrokeWidth),
  35908. fill: "none",
  35909. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  35910. }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
  35911. vue.createElementVNode("path", {
  35912. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  35913. d: vue.unref(trackPath),
  35914. stroke: vue.unref(stroke),
  35915. fill: "none",
  35916. opacity: _ctx.percentage ? 1 : 0,
  35917. "stroke-linecap": _ctx.strokeLinecap,
  35918. "stroke-width": vue.unref(relativeStrokeWidth),
  35919. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  35920. }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
  35921. ]))
  35922. ], 6)),
  35923. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  35924. key: 2,
  35925. class: vue.normalizeClass(vue.unref(ns).e("text")),
  35926. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  35927. }, [
  35928. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  35929. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  35930. default: vue.withCtx(() => [
  35931. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  35932. ]),
  35933. _: 1
  35934. }))
  35935. ])
  35936. ], 6)) : vue.createCommentVNode("v-if", true)
  35937. ], 10, ["aria-valuenow"]);
  35938. };
  35939. }
  35940. });
  35941. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "progress.vue"]]);
  35942. const ElProgress = withInstall(Progress);
  35943. const rateProps = buildProps({
  35944. modelValue: {
  35945. type: Number,
  35946. default: 0
  35947. },
  35948. id: {
  35949. type: String,
  35950. default: void 0
  35951. },
  35952. lowThreshold: {
  35953. type: Number,
  35954. default: 2
  35955. },
  35956. highThreshold: {
  35957. type: Number,
  35958. default: 4
  35959. },
  35960. max: {
  35961. type: Number,
  35962. default: 5
  35963. },
  35964. colors: {
  35965. type: definePropType([Array, Object]),
  35966. default: () => mutable(["", "", ""])
  35967. },
  35968. voidColor: {
  35969. type: String,
  35970. default: ""
  35971. },
  35972. disabledVoidColor: {
  35973. type: String,
  35974. default: ""
  35975. },
  35976. icons: {
  35977. type: definePropType([Array, Object]),
  35978. default: () => [star_filled_default, star_filled_default, star_filled_default]
  35979. },
  35980. voidIcon: {
  35981. type: iconPropType,
  35982. default: () => star_default
  35983. },
  35984. disabledVoidIcon: {
  35985. type: iconPropType,
  35986. default: () => star_filled_default
  35987. },
  35988. disabled: Boolean,
  35989. allowHalf: Boolean,
  35990. showText: Boolean,
  35991. showScore: Boolean,
  35992. textColor: {
  35993. type: String,
  35994. default: ""
  35995. },
  35996. texts: {
  35997. type: definePropType(Array),
  35998. default: () => mutable([
  35999. "Extremely bad",
  36000. "Disappointed",
  36001. "Fair",
  36002. "Satisfied",
  36003. "Surprise"
  36004. ])
  36005. },
  36006. scoreTemplate: {
  36007. type: String,
  36008. default: "{value}"
  36009. },
  36010. size: useSizeProp,
  36011. clearable: Boolean,
  36012. ...useAriaProps(["ariaLabel"])
  36013. });
  36014. const rateEmits = {
  36015. [CHANGE_EVENT]: (value) => isNumber(value),
  36016. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  36017. };
  36018. const __default__$F = vue.defineComponent({
  36019. name: "ElRate"
  36020. });
  36021. const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
  36022. ...__default__$F,
  36023. props: rateProps,
  36024. emits: rateEmits,
  36025. setup(__props, { expose, emit }) {
  36026. const props = __props;
  36027. function getValueFromMap(value, map) {
  36028. const isExcludedObject = (val) => isObject$1(val);
  36029. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  36030. const val = map[key];
  36031. const excluded = isExcludedObject(val) ? val.excluded : false;
  36032. return excluded ? value < key : value <= key;
  36033. }).sort((a, b) => a - b);
  36034. const matchedValue = map[matchedKeys[0]];
  36035. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  36036. }
  36037. const formContext = vue.inject(formContextKey, void 0);
  36038. const formItemContext = vue.inject(formItemContextKey, void 0);
  36039. const rateSize = useFormSize();
  36040. const ns = useNamespace("rate");
  36041. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  36042. formItemContext
  36043. });
  36044. const currentValue = vue.ref(props.modelValue);
  36045. const hoverIndex = vue.ref(-1);
  36046. const pointerAtLeftHalf = vue.ref(true);
  36047. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  36048. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  36049. const rateStyles = vue.computed(() => {
  36050. return ns.cssVarBlock({
  36051. "void-color": props.voidColor,
  36052. "disabled-void-color": props.disabledVoidColor,
  36053. "fill-color": activeColor.value
  36054. });
  36055. });
  36056. const text = vue.computed(() => {
  36057. let result = "";
  36058. if (props.showScore) {
  36059. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  36060. } else if (props.showText) {
  36061. result = props.texts[Math.ceil(currentValue.value) - 1];
  36062. }
  36063. return result;
  36064. });
  36065. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  36066. const colorMap = vue.computed(() => isArray$1(props.colors) ? {
  36067. [props.lowThreshold]: props.colors[0],
  36068. [props.highThreshold]: { value: props.colors[1], excluded: true },
  36069. [props.max]: props.colors[2]
  36070. } : props.colors);
  36071. const activeColor = vue.computed(() => {
  36072. const color = getValueFromMap(currentValue.value, colorMap.value);
  36073. return isObject$1(color) ? "" : color;
  36074. });
  36075. const decimalStyle = vue.computed(() => {
  36076. let width = "";
  36077. if (rateDisabled.value) {
  36078. width = `${valueDecimal.value}%`;
  36079. } else if (props.allowHalf) {
  36080. width = "50%";
  36081. }
  36082. return {
  36083. color: activeColor.value,
  36084. width
  36085. };
  36086. });
  36087. const componentMap = vue.computed(() => {
  36088. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  36089. icons = vue.markRaw(icons);
  36090. return isArray$1(icons) ? {
  36091. [props.lowThreshold]: icons[0],
  36092. [props.highThreshold]: {
  36093. value: icons[1],
  36094. excluded: true
  36095. },
  36096. [props.max]: icons[2]
  36097. } : icons;
  36098. });
  36099. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  36100. 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));
  36101. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  36102. function showDecimalIcon(item) {
  36103. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  36104. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  36105. return showWhenDisabled || showWhenAllowHalf;
  36106. }
  36107. function emitValue(value) {
  36108. if (props.clearable && value === props.modelValue) {
  36109. value = 0;
  36110. }
  36111. emit(UPDATE_MODEL_EVENT, value);
  36112. if (props.modelValue !== value) {
  36113. emit("change", value);
  36114. }
  36115. }
  36116. function selectValue(value) {
  36117. if (rateDisabled.value) {
  36118. return;
  36119. }
  36120. if (props.allowHalf && pointerAtLeftHalf.value) {
  36121. emitValue(currentValue.value);
  36122. } else {
  36123. emitValue(value);
  36124. }
  36125. }
  36126. function handleKey(e) {
  36127. if (rateDisabled.value) {
  36128. return;
  36129. }
  36130. let _currentValue = currentValue.value;
  36131. const code = e.code;
  36132. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  36133. if (props.allowHalf) {
  36134. _currentValue += 0.5;
  36135. } else {
  36136. _currentValue += 1;
  36137. }
  36138. e.stopPropagation();
  36139. e.preventDefault();
  36140. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  36141. if (props.allowHalf) {
  36142. _currentValue -= 0.5;
  36143. } else {
  36144. _currentValue -= 1;
  36145. }
  36146. e.stopPropagation();
  36147. e.preventDefault();
  36148. }
  36149. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  36150. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  36151. emit(UPDATE_MODEL_EVENT, _currentValue);
  36152. emit("change", _currentValue);
  36153. return _currentValue;
  36154. }
  36155. function setCurrentValue(value, event) {
  36156. if (rateDisabled.value) {
  36157. return;
  36158. }
  36159. if (props.allowHalf && event) {
  36160. let target = event.target;
  36161. if (hasClass(target, ns.e("item"))) {
  36162. target = target.querySelector(`.${ns.e("icon")}`);
  36163. }
  36164. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  36165. target = target.parentNode;
  36166. }
  36167. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  36168. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  36169. } else {
  36170. currentValue.value = value;
  36171. }
  36172. hoverIndex.value = value;
  36173. }
  36174. function resetCurrentValue() {
  36175. if (rateDisabled.value) {
  36176. return;
  36177. }
  36178. if (props.allowHalf) {
  36179. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  36180. }
  36181. currentValue.value = props.modelValue;
  36182. hoverIndex.value = -1;
  36183. }
  36184. vue.watch(() => props.modelValue, (val) => {
  36185. currentValue.value = val;
  36186. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  36187. });
  36188. if (!props.modelValue) {
  36189. emit(UPDATE_MODEL_EVENT, 0);
  36190. }
  36191. expose({
  36192. setCurrentValue,
  36193. resetCurrentValue
  36194. });
  36195. return (_ctx, _cache) => {
  36196. var _a;
  36197. return vue.openBlock(), vue.createElementBlock("div", {
  36198. id: vue.unref(inputId),
  36199. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  36200. role: "slider",
  36201. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
  36202. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  36203. "aria-valuenow": currentValue.value,
  36204. "aria-valuetext": vue.unref(text) || void 0,
  36205. "aria-valuemin": "0",
  36206. "aria-valuemax": _ctx.max,
  36207. tabindex: "0",
  36208. style: vue.normalizeStyle(vue.unref(rateStyles)),
  36209. onKeydown: handleKey
  36210. }, [
  36211. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  36212. return vue.openBlock(), vue.createElementBlock("span", {
  36213. key,
  36214. class: vue.normalizeClass(vue.unref(ns).e("item")),
  36215. onMousemove: ($event) => setCurrentValue(item, $event),
  36216. onMouseleave: resetCurrentValue,
  36217. onClick: ($event) => selectValue(item)
  36218. }, [
  36219. vue.createVNode(vue.unref(ElIcon), {
  36220. class: vue.normalizeClass([
  36221. vue.unref(ns).e("icon"),
  36222. { hover: hoverIndex.value === item },
  36223. vue.unref(ns).is("active", item <= currentValue.value)
  36224. ])
  36225. }, {
  36226. default: vue.withCtx(() => [
  36227. !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  36228. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  36229. [vue.vShow, item <= currentValue.value]
  36230. ]),
  36231. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  36232. [vue.vShow, !(item <= currentValue.value)]
  36233. ])
  36234. ], 64)) : vue.createCommentVNode("v-if", true),
  36235. showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  36236. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), {
  36237. class: vue.normalizeClass([vue.unref(ns).em("decimal", "box")])
  36238. }, null, 8, ["class"])),
  36239. vue.createVNode(vue.unref(ElIcon), {
  36240. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  36241. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  36242. }, {
  36243. default: vue.withCtx(() => [
  36244. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  36245. ]),
  36246. _: 1
  36247. }, 8, ["style", "class"])
  36248. ], 64)) : vue.createCommentVNode("v-if", true)
  36249. ]),
  36250. _: 2
  36251. }, 1032, ["class"])
  36252. ], 42, ["onMousemove", "onClick"]);
  36253. }), 128)),
  36254. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  36255. key: 0,
  36256. class: vue.normalizeClass(vue.unref(ns).e("text")),
  36257. style: vue.normalizeStyle({ color: _ctx.textColor })
  36258. }, vue.toDisplayString(vue.unref(text)), 7)) : vue.createCommentVNode("v-if", true)
  36259. ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
  36260. };
  36261. }
  36262. });
  36263. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "rate.vue"]]);
  36264. const ElRate = withInstall(Rate);
  36265. const IconMap = {
  36266. success: "icon-success",
  36267. warning: "icon-warning",
  36268. error: "icon-error",
  36269. info: "icon-info"
  36270. };
  36271. const IconComponentMap = {
  36272. [IconMap.success]: circle_check_filled_default,
  36273. [IconMap.warning]: warning_filled_default,
  36274. [IconMap.error]: circle_close_filled_default,
  36275. [IconMap.info]: info_filled_default
  36276. };
  36277. const resultProps = buildProps({
  36278. title: {
  36279. type: String,
  36280. default: ""
  36281. },
  36282. subTitle: {
  36283. type: String,
  36284. default: ""
  36285. },
  36286. icon: {
  36287. type: String,
  36288. values: ["success", "warning", "info", "error"],
  36289. default: "info"
  36290. }
  36291. });
  36292. const __default__$E = vue.defineComponent({
  36293. name: "ElResult"
  36294. });
  36295. const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
  36296. ...__default__$E,
  36297. props: resultProps,
  36298. setup(__props) {
  36299. const props = __props;
  36300. const ns = useNamespace("result");
  36301. const resultIcon = vue.computed(() => {
  36302. const icon = props.icon;
  36303. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  36304. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  36305. return {
  36306. class: iconClass,
  36307. component: iconComponent
  36308. };
  36309. });
  36310. return (_ctx, _cache) => {
  36311. return vue.openBlock(), vue.createElementBlock("div", {
  36312. class: vue.normalizeClass(vue.unref(ns).b())
  36313. }, [
  36314. vue.createElementVNode("div", {
  36315. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  36316. }, [
  36317. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  36318. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  36319. key: 0,
  36320. class: vue.normalizeClass(vue.unref(resultIcon).class)
  36321. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  36322. ])
  36323. ], 2),
  36324. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  36325. key: 0,
  36326. class: vue.normalizeClass(vue.unref(ns).e("title"))
  36327. }, [
  36328. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  36329. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  36330. ])
  36331. ], 2)) : vue.createCommentVNode("v-if", true),
  36332. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  36333. key: 1,
  36334. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  36335. }, [
  36336. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  36337. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  36338. ])
  36339. ], 2)) : vue.createCommentVNode("v-if", true),
  36340. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  36341. key: 2,
  36342. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  36343. }, [
  36344. vue.renderSlot(_ctx.$slots, "extra")
  36345. ], 2)) : vue.createCommentVNode("v-if", true)
  36346. ], 2);
  36347. };
  36348. }
  36349. });
  36350. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__file", "result.vue"]]);
  36351. const ElResult = withInstall(Result);
  36352. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  36353. return typeof value === "number" && value !== value;
  36354. };
  36355. function isEqual(first, second) {
  36356. if (first === second) {
  36357. return true;
  36358. }
  36359. if (safeIsNaN(first) && safeIsNaN(second)) {
  36360. return true;
  36361. }
  36362. return false;
  36363. }
  36364. function areInputsEqual(newInputs, lastInputs) {
  36365. if (newInputs.length !== lastInputs.length) {
  36366. return false;
  36367. }
  36368. for (var i = 0; i < newInputs.length; i++) {
  36369. if (!isEqual(newInputs[i], lastInputs[i])) {
  36370. return false;
  36371. }
  36372. }
  36373. return true;
  36374. }
  36375. function memoizeOne(resultFn, isEqual2) {
  36376. if (isEqual2 === void 0) {
  36377. isEqual2 = areInputsEqual;
  36378. }
  36379. var cache = null;
  36380. function memoized() {
  36381. var newArgs = [];
  36382. for (var _i = 0; _i < arguments.length; _i++) {
  36383. newArgs[_i] = arguments[_i];
  36384. }
  36385. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  36386. return cache.lastResult;
  36387. }
  36388. var lastResult = resultFn.apply(this, newArgs);
  36389. cache = {
  36390. lastResult,
  36391. lastArgs: newArgs,
  36392. lastThis: this
  36393. };
  36394. return lastResult;
  36395. }
  36396. memoized.clear = function clear() {
  36397. cache = null;
  36398. };
  36399. return memoized;
  36400. }
  36401. const useCache = () => {
  36402. const vm = vue.getCurrentInstance();
  36403. const props = vm.proxy.$props;
  36404. return vue.computed(() => {
  36405. const _getItemStyleCache = (_, __, ___) => ({});
  36406. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  36407. });
  36408. };
  36409. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  36410. const ITEM_RENDER_EVT = "itemRendered";
  36411. const SCROLL_EVT = "scroll";
  36412. const FORWARD = "forward";
  36413. const BACKWARD = "backward";
  36414. const AUTO_ALIGNMENT = "auto";
  36415. const SMART_ALIGNMENT = "smart";
  36416. const START_ALIGNMENT = "start";
  36417. const CENTERED_ALIGNMENT = "center";
  36418. const END_ALIGNMENT = "end";
  36419. const HORIZONTAL = "horizontal";
  36420. const VERTICAL = "vertical";
  36421. const LTR = "ltr";
  36422. const RTL = "rtl";
  36423. const RTL_OFFSET_NAG = "negative";
  36424. const RTL_OFFSET_POS_ASC = "positive-ascending";
  36425. const RTL_OFFSET_POS_DESC = "positive-descending";
  36426. const ScrollbarDirKey = {
  36427. [HORIZONTAL]: "left",
  36428. [VERTICAL]: "top"
  36429. };
  36430. const SCROLLBAR_MIN_SIZE = 20;
  36431. const LayoutKeys = {
  36432. [HORIZONTAL]: "deltaX",
  36433. [VERTICAL]: "deltaY"
  36434. };
  36435. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  36436. let frameHandle;
  36437. let offset = 0;
  36438. const hasReachedEdge = (offset2) => {
  36439. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  36440. return edgeReached;
  36441. };
  36442. const onWheel = (e) => {
  36443. cAF(frameHandle);
  36444. const newOffset = e[LayoutKeys[layout.value]];
  36445. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  36446. return;
  36447. offset += newOffset;
  36448. if (!isFirefox()) {
  36449. e.preventDefault();
  36450. }
  36451. frameHandle = rAF(() => {
  36452. onWheelDelta(offset);
  36453. offset = 0;
  36454. });
  36455. };
  36456. return {
  36457. hasReachedEdge,
  36458. onWheel
  36459. };
  36460. };
  36461. var useWheel$1 = useWheel;
  36462. const itemSize$1 = buildProp({
  36463. type: definePropType([Number, Function]),
  36464. required: true
  36465. });
  36466. const estimatedItemSize = buildProp({
  36467. type: Number
  36468. });
  36469. const cache = buildProp({
  36470. type: Number,
  36471. default: 2
  36472. });
  36473. const direction = buildProp({
  36474. type: String,
  36475. values: ["ltr", "rtl"],
  36476. default: "ltr"
  36477. });
  36478. const initScrollOffset = buildProp({
  36479. type: Number,
  36480. default: 0
  36481. });
  36482. const total = buildProp({
  36483. type: Number,
  36484. required: true
  36485. });
  36486. const layout = buildProp({
  36487. type: String,
  36488. values: ["horizontal", "vertical"],
  36489. default: VERTICAL
  36490. });
  36491. const virtualizedProps = buildProps({
  36492. className: {
  36493. type: String,
  36494. default: ""
  36495. },
  36496. containerElement: {
  36497. type: definePropType([String, Object]),
  36498. default: "div"
  36499. },
  36500. data: {
  36501. type: definePropType(Array),
  36502. default: () => mutable([])
  36503. },
  36504. direction,
  36505. height: {
  36506. type: [String, Number],
  36507. required: true
  36508. },
  36509. innerElement: {
  36510. type: [String, Object],
  36511. default: "div"
  36512. },
  36513. style: {
  36514. type: definePropType([Object, String, Array])
  36515. },
  36516. useIsScrolling: {
  36517. type: Boolean,
  36518. default: false
  36519. },
  36520. width: {
  36521. type: [Number, String],
  36522. required: false
  36523. },
  36524. perfMode: {
  36525. type: Boolean,
  36526. default: true
  36527. },
  36528. scrollbarAlwaysOn: {
  36529. type: Boolean,
  36530. default: false
  36531. }
  36532. });
  36533. const virtualizedListProps = buildProps({
  36534. cache,
  36535. estimatedItemSize,
  36536. layout,
  36537. initScrollOffset,
  36538. total,
  36539. itemSize: itemSize$1,
  36540. ...virtualizedProps
  36541. });
  36542. const scrollbarSize = {
  36543. type: Number,
  36544. default: 6
  36545. };
  36546. const startGap = { type: Number, default: 0 };
  36547. const endGap = { type: Number, default: 2 };
  36548. const virtualizedGridProps = buildProps({
  36549. columnCache: cache,
  36550. columnWidth: itemSize$1,
  36551. estimatedColumnWidth: estimatedItemSize,
  36552. estimatedRowHeight: estimatedItemSize,
  36553. initScrollLeft: initScrollOffset,
  36554. initScrollTop: initScrollOffset,
  36555. itemKey: {
  36556. type: definePropType(Function),
  36557. default: ({
  36558. columnIndex,
  36559. rowIndex
  36560. }) => `${rowIndex}:${columnIndex}`
  36561. },
  36562. rowCache: cache,
  36563. rowHeight: itemSize$1,
  36564. totalColumn: total,
  36565. totalRow: total,
  36566. hScrollbarSize: scrollbarSize,
  36567. vScrollbarSize: scrollbarSize,
  36568. scrollbarStartGap: startGap,
  36569. scrollbarEndGap: endGap,
  36570. role: String,
  36571. ...virtualizedProps
  36572. });
  36573. const virtualizedScrollbarProps = buildProps({
  36574. alwaysOn: Boolean,
  36575. class: String,
  36576. layout,
  36577. total,
  36578. ratio: {
  36579. type: Number,
  36580. required: true
  36581. },
  36582. clientSize: {
  36583. type: Number,
  36584. required: true
  36585. },
  36586. scrollFrom: {
  36587. type: Number,
  36588. required: true
  36589. },
  36590. scrollbarSize,
  36591. startGap,
  36592. endGap,
  36593. visible: Boolean
  36594. });
  36595. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  36596. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  36597. const isRTL = (dir) => dir === RTL;
  36598. let cachedRTLResult = null;
  36599. function getRTLOffsetType(recalculate = false) {
  36600. if (cachedRTLResult === null || recalculate) {
  36601. const outerDiv = document.createElement("div");
  36602. const outerStyle = outerDiv.style;
  36603. outerStyle.width = "50px";
  36604. outerStyle.height = "50px";
  36605. outerStyle.overflow = "scroll";
  36606. outerStyle.direction = "rtl";
  36607. const innerDiv = document.createElement("div");
  36608. const innerStyle = innerDiv.style;
  36609. innerStyle.width = "100px";
  36610. innerStyle.height = "100px";
  36611. outerDiv.appendChild(innerDiv);
  36612. document.body.appendChild(outerDiv);
  36613. if (outerDiv.scrollLeft > 0) {
  36614. cachedRTLResult = RTL_OFFSET_POS_DESC;
  36615. } else {
  36616. outerDiv.scrollLeft = 1;
  36617. if (outerDiv.scrollLeft === 0) {
  36618. cachedRTLResult = RTL_OFFSET_NAG;
  36619. } else {
  36620. cachedRTLResult = RTL_OFFSET_POS_ASC;
  36621. }
  36622. }
  36623. document.body.removeChild(outerDiv);
  36624. return cachedRTLResult;
  36625. }
  36626. return cachedRTLResult;
  36627. }
  36628. function renderThumbStyle({ move, size, bar }, layout) {
  36629. const style = {};
  36630. const translate = `translate${bar.axis}(${move}px)`;
  36631. style[bar.size] = size;
  36632. style.transform = translate;
  36633. style.msTransform = translate;
  36634. style.webkitTransform = translate;
  36635. if (layout === "horizontal") {
  36636. style.height = "100%";
  36637. } else {
  36638. style.width = "100%";
  36639. }
  36640. return style;
  36641. }
  36642. const ScrollBar = vue.defineComponent({
  36643. name: "ElVirtualScrollBar",
  36644. props: virtualizedScrollbarProps,
  36645. emits: ["scroll", "start-move", "stop-move"],
  36646. setup(props, { emit }) {
  36647. const GAP = vue.computed(() => props.startGap + props.endGap);
  36648. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  36649. const nsScrollbar = useNamespace("scrollbar");
  36650. const trackRef = vue.ref();
  36651. const thumbRef = vue.ref();
  36652. let frameHandle = null;
  36653. let onselectstartStore = null;
  36654. const state = vue.reactive({
  36655. isDragging: false,
  36656. traveled: 0
  36657. });
  36658. const bar = vue.computed(() => BAR_MAP[props.layout]);
  36659. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  36660. const trackStyle = vue.computed(() => ({
  36661. position: "absolute",
  36662. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  36663. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  36664. [ScrollbarDirKey[props.layout]]: "2px",
  36665. right: "2px",
  36666. bottom: "2px",
  36667. borderRadius: "4px"
  36668. }));
  36669. const thumbSize = vue.computed(() => {
  36670. const ratio = props.ratio;
  36671. const clientSize = props.clientSize;
  36672. if (ratio >= 100) {
  36673. return Number.POSITIVE_INFINITY;
  36674. }
  36675. if (ratio >= 50) {
  36676. return ratio * clientSize / 100;
  36677. }
  36678. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  36679. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  36680. });
  36681. const thumbStyle = vue.computed(() => {
  36682. if (!Number.isFinite(thumbSize.value)) {
  36683. return {
  36684. display: "none"
  36685. };
  36686. }
  36687. const thumb = `${thumbSize.value}px`;
  36688. const style = renderThumbStyle({
  36689. bar: bar.value,
  36690. size: thumb,
  36691. move: state.traveled
  36692. }, props.layout);
  36693. return style;
  36694. });
  36695. const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP)));
  36696. const attachEvents = () => {
  36697. window.addEventListener("mousemove", onMouseMove);
  36698. window.addEventListener("mouseup", onMouseUp);
  36699. const thumbEl = vue.unref(thumbRef);
  36700. if (!thumbEl)
  36701. return;
  36702. onselectstartStore = document.onselectstart;
  36703. document.onselectstart = () => false;
  36704. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  36705. thumbEl.addEventListener("touchend", onMouseUp);
  36706. };
  36707. const detachEvents = () => {
  36708. window.removeEventListener("mousemove", onMouseMove);
  36709. window.removeEventListener("mouseup", onMouseUp);
  36710. document.onselectstart = onselectstartStore;
  36711. onselectstartStore = null;
  36712. const thumbEl = vue.unref(thumbRef);
  36713. if (!thumbEl)
  36714. return;
  36715. thumbEl.removeEventListener("touchmove", onMouseMove);
  36716. thumbEl.removeEventListener("touchend", onMouseUp);
  36717. };
  36718. const onThumbMouseDown = (e) => {
  36719. e.stopImmediatePropagation();
  36720. if (e.ctrlKey || [1, 2].includes(e.button)) {
  36721. return;
  36722. }
  36723. state.isDragging = true;
  36724. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  36725. emit("start-move");
  36726. attachEvents();
  36727. };
  36728. const onMouseUp = () => {
  36729. state.isDragging = false;
  36730. state[bar.value.axis] = 0;
  36731. emit("stop-move");
  36732. detachEvents();
  36733. };
  36734. const onMouseMove = (e) => {
  36735. const { isDragging } = state;
  36736. if (!isDragging)
  36737. return;
  36738. if (!thumbRef.value || !trackRef.value)
  36739. return;
  36740. const prevPage = state[bar.value.axis];
  36741. if (!prevPage)
  36742. return;
  36743. cAF(frameHandle);
  36744. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  36745. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  36746. const distance = offset - thumbClickPosition;
  36747. frameHandle = rAF(() => {
  36748. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  36749. emit("scroll", distance, totalSteps.value);
  36750. });
  36751. };
  36752. const clickTrackHandler = (e) => {
  36753. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  36754. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  36755. const distance = offset - thumbHalf;
  36756. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  36757. emit("scroll", distance, totalSteps.value);
  36758. };
  36759. vue.watch(() => props.scrollFrom, (v) => {
  36760. if (state.isDragging)
  36761. return;
  36762. state.traveled = Math.ceil(v * totalSteps.value);
  36763. });
  36764. vue.onBeforeUnmount(() => {
  36765. detachEvents();
  36766. });
  36767. return () => {
  36768. return vue.h("div", {
  36769. role: "presentation",
  36770. ref: trackRef,
  36771. class: [
  36772. nsVirtualScrollbar.b(),
  36773. props.class,
  36774. (props.alwaysOn || state.isDragging) && "always-on"
  36775. ],
  36776. style: trackStyle.value,
  36777. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  36778. onTouchstartPrevent: onThumbMouseDown
  36779. }, vue.h("div", {
  36780. ref: thumbRef,
  36781. class: nsScrollbar.e("thumb"),
  36782. style: thumbStyle.value,
  36783. onMousedown: onThumbMouseDown
  36784. }, []));
  36785. };
  36786. }
  36787. });
  36788. var Scrollbar = ScrollBar;
  36789. const createList = ({
  36790. name,
  36791. getOffset,
  36792. getItemSize,
  36793. getItemOffset,
  36794. getEstimatedTotalSize,
  36795. getStartIndexForOffset,
  36796. getStopIndexForStartIndex,
  36797. initCache,
  36798. clearCache,
  36799. validateProps
  36800. }) => {
  36801. return vue.defineComponent({
  36802. name: name != null ? name : "ElVirtualList",
  36803. props: virtualizedListProps,
  36804. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  36805. setup(props, { emit, expose }) {
  36806. validateProps(props);
  36807. const instance = vue.getCurrentInstance();
  36808. const ns = useNamespace("vl");
  36809. const dynamicSizeCache = vue.ref(initCache(props, instance));
  36810. const getItemStyleCache = useCache();
  36811. const windowRef = vue.ref();
  36812. const innerRef = vue.ref();
  36813. const scrollbarRef = vue.ref();
  36814. const states = vue.ref({
  36815. isScrolling: false,
  36816. scrollDir: "forward",
  36817. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  36818. updateRequested: false,
  36819. isScrollbarDragging: false,
  36820. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  36821. });
  36822. const itemsToRender = vue.computed(() => {
  36823. const { total, cache } = props;
  36824. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  36825. if (total === 0) {
  36826. return [0, 0, 0, 0];
  36827. }
  36828. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  36829. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  36830. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  36831. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  36832. return [
  36833. Math.max(0, startIndex - cacheBackward),
  36834. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  36835. startIndex,
  36836. stopIndex
  36837. ];
  36838. });
  36839. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  36840. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  36841. const windowStyle = vue.computed(() => [
  36842. {
  36843. position: "relative",
  36844. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  36845. WebkitOverflowScrolling: "touch",
  36846. willChange: "transform"
  36847. },
  36848. {
  36849. direction: props.direction,
  36850. height: isNumber(props.height) ? `${props.height}px` : props.height,
  36851. width: isNumber(props.width) ? `${props.width}px` : props.width
  36852. },
  36853. props.style
  36854. ]);
  36855. const innerStyle = vue.computed(() => {
  36856. const size = vue.unref(estimatedTotalSize);
  36857. const horizontal = vue.unref(_isHorizontal);
  36858. return {
  36859. height: horizontal ? "100%" : `${size}px`,
  36860. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  36861. width: horizontal ? `${size}px` : "100%"
  36862. };
  36863. });
  36864. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  36865. const { onWheel } = useWheel$1({
  36866. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  36867. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  36868. layout: vue.computed(() => props.layout)
  36869. }, (offset) => {
  36870. var _a, _b;
  36871. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  36872. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  36873. });
  36874. useEventListener(windowRef, "wheel", onWheel, {
  36875. passive: false
  36876. });
  36877. const emitEvents = () => {
  36878. const { total } = props;
  36879. if (total > 0) {
  36880. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  36881. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  36882. }
  36883. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  36884. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  36885. };
  36886. const scrollVertically = (e) => {
  36887. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  36888. const _states = vue.unref(states);
  36889. if (_states.scrollOffset === scrollTop) {
  36890. return;
  36891. }
  36892. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  36893. states.value = {
  36894. ..._states,
  36895. isScrolling: true,
  36896. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  36897. scrollOffset,
  36898. updateRequested: false
  36899. };
  36900. vue.nextTick(resetIsScrolling);
  36901. };
  36902. const scrollHorizontally = (e) => {
  36903. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  36904. const _states = vue.unref(states);
  36905. if (_states.scrollOffset === scrollLeft) {
  36906. return;
  36907. }
  36908. const { direction } = props;
  36909. let scrollOffset = scrollLeft;
  36910. if (direction === RTL) {
  36911. switch (getRTLOffsetType()) {
  36912. case RTL_OFFSET_NAG: {
  36913. scrollOffset = -scrollLeft;
  36914. break;
  36915. }
  36916. case RTL_OFFSET_POS_DESC: {
  36917. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  36918. break;
  36919. }
  36920. }
  36921. }
  36922. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  36923. states.value = {
  36924. ..._states,
  36925. isScrolling: true,
  36926. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  36927. scrollOffset,
  36928. updateRequested: false
  36929. };
  36930. vue.nextTick(resetIsScrolling);
  36931. };
  36932. const onScroll = (e) => {
  36933. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  36934. emitEvents();
  36935. };
  36936. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  36937. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  36938. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  36939. };
  36940. const scrollTo = (offset) => {
  36941. offset = Math.max(offset, 0);
  36942. if (offset === vue.unref(states).scrollOffset) {
  36943. return;
  36944. }
  36945. states.value = {
  36946. ...vue.unref(states),
  36947. scrollOffset: offset,
  36948. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  36949. updateRequested: true
  36950. };
  36951. vue.nextTick(resetIsScrolling);
  36952. };
  36953. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  36954. const { scrollOffset } = vue.unref(states);
  36955. idx = Math.max(0, Math.min(idx, props.total - 1));
  36956. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  36957. };
  36958. const getItemStyle = (idx) => {
  36959. const { direction, itemSize, layout } = props;
  36960. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  36961. let style;
  36962. if (hasOwn(itemStyleCache, String(idx))) {
  36963. style = itemStyleCache[idx];
  36964. } else {
  36965. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  36966. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  36967. const horizontal = vue.unref(_isHorizontal);
  36968. const isRtl = direction === RTL;
  36969. const offsetHorizontal = horizontal ? offset : 0;
  36970. itemStyleCache[idx] = style = {
  36971. position: "absolute",
  36972. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  36973. right: isRtl ? `${offsetHorizontal}px` : void 0,
  36974. top: !horizontal ? `${offset}px` : 0,
  36975. height: !horizontal ? `${size}px` : "100%",
  36976. width: horizontal ? `${size}px` : "100%"
  36977. };
  36978. }
  36979. return style;
  36980. };
  36981. const resetIsScrolling = () => {
  36982. states.value.isScrolling = false;
  36983. vue.nextTick(() => {
  36984. getItemStyleCache.value(-1, null, null);
  36985. });
  36986. };
  36987. const resetScrollTop = () => {
  36988. const window = windowRef.value;
  36989. if (window) {
  36990. window.scrollTop = 0;
  36991. }
  36992. };
  36993. vue.onMounted(() => {
  36994. if (!isClient)
  36995. return;
  36996. const { initScrollOffset } = props;
  36997. const windowElement = vue.unref(windowRef);
  36998. if (isNumber(initScrollOffset) && windowElement) {
  36999. if (vue.unref(_isHorizontal)) {
  37000. windowElement.scrollLeft = initScrollOffset;
  37001. } else {
  37002. windowElement.scrollTop = initScrollOffset;
  37003. }
  37004. }
  37005. emitEvents();
  37006. });
  37007. vue.onUpdated(() => {
  37008. const { direction, layout } = props;
  37009. const { scrollOffset, updateRequested } = vue.unref(states);
  37010. const windowElement = vue.unref(windowRef);
  37011. if (updateRequested && windowElement) {
  37012. if (layout === HORIZONTAL) {
  37013. if (direction === RTL) {
  37014. switch (getRTLOffsetType()) {
  37015. case RTL_OFFSET_NAG: {
  37016. windowElement.scrollLeft = -scrollOffset;
  37017. break;
  37018. }
  37019. case RTL_OFFSET_POS_ASC: {
  37020. windowElement.scrollLeft = scrollOffset;
  37021. break;
  37022. }
  37023. default: {
  37024. const { clientWidth, scrollWidth } = windowElement;
  37025. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  37026. break;
  37027. }
  37028. }
  37029. } else {
  37030. windowElement.scrollLeft = scrollOffset;
  37031. }
  37032. } else {
  37033. windowElement.scrollTop = scrollOffset;
  37034. }
  37035. }
  37036. });
  37037. vue.onActivated(() => {
  37038. vue.unref(windowRef).scrollTop = vue.unref(states).scrollOffset;
  37039. });
  37040. const api = {
  37041. ns,
  37042. clientSize,
  37043. estimatedTotalSize,
  37044. windowStyle,
  37045. windowRef,
  37046. innerRef,
  37047. innerStyle,
  37048. itemsToRender,
  37049. scrollbarRef,
  37050. states,
  37051. getItemStyle,
  37052. onScroll,
  37053. onScrollbarScroll,
  37054. onWheel,
  37055. scrollTo,
  37056. scrollToItem,
  37057. resetScrollTop
  37058. };
  37059. expose({
  37060. windowRef,
  37061. innerRef,
  37062. getItemStyleCache,
  37063. scrollTo,
  37064. scrollToItem,
  37065. resetScrollTop,
  37066. states
  37067. });
  37068. return api;
  37069. },
  37070. render(ctx) {
  37071. var _a;
  37072. const {
  37073. $slots,
  37074. className,
  37075. clientSize,
  37076. containerElement,
  37077. data,
  37078. getItemStyle,
  37079. innerElement,
  37080. itemsToRender,
  37081. innerStyle,
  37082. layout,
  37083. total,
  37084. onScroll,
  37085. onScrollbarScroll,
  37086. states,
  37087. useIsScrolling,
  37088. windowStyle,
  37089. ns
  37090. } = ctx;
  37091. const [start, end] = itemsToRender;
  37092. const Container = vue.resolveDynamicComponent(containerElement);
  37093. const Inner = vue.resolveDynamicComponent(innerElement);
  37094. const children = [];
  37095. if (total > 0) {
  37096. for (let i = start; i <= end; i++) {
  37097. children.push(vue.h(vue.Fragment, { key: i }, (_a = $slots.default) == null ? void 0 : _a.call($slots, {
  37098. data,
  37099. index: i,
  37100. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  37101. style: getItemStyle(i)
  37102. })));
  37103. }
  37104. }
  37105. const InnerNode = [
  37106. vue.h(Inner, {
  37107. style: innerStyle,
  37108. ref: "innerRef"
  37109. }, !isString$1(Inner) ? {
  37110. default: () => children
  37111. } : children)
  37112. ];
  37113. const scrollbar = vue.h(Scrollbar, {
  37114. ref: "scrollbarRef",
  37115. clientSize,
  37116. layout,
  37117. onScroll: onScrollbarScroll,
  37118. ratio: clientSize * 100 / this.estimatedTotalSize,
  37119. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  37120. total
  37121. });
  37122. const listContainer = vue.h(Container, {
  37123. class: [ns.e("window"), className],
  37124. style: windowStyle,
  37125. onScroll,
  37126. ref: "windowRef",
  37127. key: 0
  37128. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  37129. return vue.h("div", {
  37130. key: 0,
  37131. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  37132. }, [listContainer, scrollbar]);
  37133. }
  37134. });
  37135. };
  37136. var createList$1 = createList;
  37137. const FixedSizeList = createList$1({
  37138. name: "ElFixedSizeList",
  37139. getItemOffset: ({ itemSize }, index) => index * itemSize,
  37140. getItemSize: ({ itemSize }) => itemSize,
  37141. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  37142. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  37143. const size = isHorizontal(layout) ? width : height;
  37144. const lastItemOffset = Math.max(0, total * itemSize - size);
  37145. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  37146. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  37147. if (alignment === SMART_ALIGNMENT) {
  37148. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  37149. alignment = AUTO_ALIGNMENT;
  37150. } else {
  37151. alignment = CENTERED_ALIGNMENT;
  37152. }
  37153. }
  37154. switch (alignment) {
  37155. case START_ALIGNMENT: {
  37156. return maxOffset;
  37157. }
  37158. case END_ALIGNMENT: {
  37159. return minOffset;
  37160. }
  37161. case CENTERED_ALIGNMENT: {
  37162. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  37163. if (middleOffset < Math.ceil(size / 2)) {
  37164. return 0;
  37165. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  37166. return lastItemOffset;
  37167. } else {
  37168. return middleOffset;
  37169. }
  37170. }
  37171. case AUTO_ALIGNMENT:
  37172. default: {
  37173. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  37174. return scrollOffset;
  37175. } else if (scrollOffset < minOffset) {
  37176. return minOffset;
  37177. } else {
  37178. return maxOffset;
  37179. }
  37180. }
  37181. }
  37182. },
  37183. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  37184. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  37185. const offset = startIndex * itemSize;
  37186. const size = isHorizontal(layout) ? width : height;
  37187. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  37188. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  37189. },
  37190. initCache() {
  37191. return void 0;
  37192. },
  37193. clearCache: true,
  37194. validateProps() {
  37195. }
  37196. });
  37197. var FixedSizeList$1 = FixedSizeList;
  37198. const getItemFromCache$1 = (props, index, listCache) => {
  37199. const { itemSize } = props;
  37200. const { items, lastVisitedIndex } = listCache;
  37201. if (index > lastVisitedIndex) {
  37202. let offset = 0;
  37203. if (lastVisitedIndex >= 0) {
  37204. const item = items[lastVisitedIndex];
  37205. offset = item.offset + item.size;
  37206. }
  37207. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  37208. const size = itemSize(i);
  37209. items[i] = {
  37210. offset,
  37211. size
  37212. };
  37213. offset += size;
  37214. }
  37215. listCache.lastVisitedIndex = index;
  37216. }
  37217. return items[index];
  37218. };
  37219. const findItem$1 = (props, listCache, offset) => {
  37220. const { items, lastVisitedIndex } = listCache;
  37221. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  37222. if (lastVisitedOffset >= offset) {
  37223. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  37224. }
  37225. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  37226. };
  37227. const bs$1 = (props, listCache, low, high, offset) => {
  37228. while (low <= high) {
  37229. const mid = low + Math.floor((high - low) / 2);
  37230. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  37231. if (currentOffset === offset) {
  37232. return mid;
  37233. } else if (currentOffset < offset) {
  37234. low = mid + 1;
  37235. } else if (currentOffset > offset) {
  37236. high = mid - 1;
  37237. }
  37238. }
  37239. return Math.max(0, low - 1);
  37240. };
  37241. const es$1 = (props, listCache, index, offset) => {
  37242. const { total } = props;
  37243. let exponent = 1;
  37244. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  37245. index += exponent;
  37246. exponent *= 2;
  37247. }
  37248. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  37249. };
  37250. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  37251. let totalSizeOfMeasuredItems = 0;
  37252. if (lastVisitedIndex >= total) {
  37253. lastVisitedIndex = total - 1;
  37254. }
  37255. if (lastVisitedIndex >= 0) {
  37256. const item = items[lastVisitedIndex];
  37257. totalSizeOfMeasuredItems = item.offset + item.size;
  37258. }
  37259. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  37260. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  37261. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  37262. };
  37263. const DynamicSizeList = createList$1({
  37264. name: "ElDynamicSizeList",
  37265. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  37266. getItemSize: (_, index, { items }) => items[index].size,
  37267. getEstimatedTotalSize,
  37268. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  37269. const { height, layout, width } = props;
  37270. const size = isHorizontal(layout) ? width : height;
  37271. const item = getItemFromCache$1(props, index, listCache);
  37272. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  37273. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  37274. const minOffset = Math.max(0, item.offset - size + item.size);
  37275. if (alignment === SMART_ALIGNMENT) {
  37276. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  37277. alignment = AUTO_ALIGNMENT;
  37278. } else {
  37279. alignment = CENTERED_ALIGNMENT;
  37280. }
  37281. }
  37282. switch (alignment) {
  37283. case START_ALIGNMENT: {
  37284. return maxOffset;
  37285. }
  37286. case END_ALIGNMENT: {
  37287. return minOffset;
  37288. }
  37289. case CENTERED_ALIGNMENT: {
  37290. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  37291. }
  37292. case AUTO_ALIGNMENT:
  37293. default: {
  37294. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  37295. return scrollOffset;
  37296. } else if (scrollOffset < minOffset) {
  37297. return minOffset;
  37298. } else {
  37299. return maxOffset;
  37300. }
  37301. }
  37302. }
  37303. },
  37304. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  37305. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  37306. const { height, total, layout, width } = props;
  37307. const size = isHorizontal(layout) ? width : height;
  37308. const item = getItemFromCache$1(props, startIndex, listCache);
  37309. const maxOffset = scrollOffset + size;
  37310. let offset = item.offset + item.size;
  37311. let stopIndex = startIndex;
  37312. while (stopIndex < total - 1 && offset < maxOffset) {
  37313. stopIndex++;
  37314. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  37315. }
  37316. return stopIndex;
  37317. },
  37318. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  37319. const cache = {
  37320. items: {},
  37321. estimatedItemSize,
  37322. lastVisitedIndex: -1
  37323. };
  37324. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  37325. var _a, _b;
  37326. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  37327. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  37328. if (forceUpdate) {
  37329. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  37330. }
  37331. };
  37332. return cache;
  37333. },
  37334. clearCache: false,
  37335. validateProps: ({ itemSize }) => {
  37336. }
  37337. });
  37338. var DynamicSizeList$1 = DynamicSizeList;
  37339. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  37340. let frameHandle = null;
  37341. let xOffset = 0;
  37342. let yOffset = 0;
  37343. const hasReachedEdge = (x, y) => {
  37344. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  37345. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  37346. return xEdgeReached && yEdgeReached;
  37347. };
  37348. const onWheel = (e) => {
  37349. cAF(frameHandle);
  37350. let x = e.deltaX;
  37351. let y = e.deltaY;
  37352. if (Math.abs(x) > Math.abs(y)) {
  37353. y = 0;
  37354. } else {
  37355. x = 0;
  37356. }
  37357. if (e.shiftKey && y !== 0) {
  37358. x = y;
  37359. y = 0;
  37360. }
  37361. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  37362. return;
  37363. xOffset += x;
  37364. yOffset += y;
  37365. e.preventDefault();
  37366. frameHandle = rAF(() => {
  37367. onWheelDelta(xOffset, yOffset);
  37368. xOffset = 0;
  37369. yOffset = 0;
  37370. });
  37371. };
  37372. return {
  37373. hasReachedEdge,
  37374. onWheel
  37375. };
  37376. };
  37377. const createGrid = ({
  37378. name,
  37379. clearCache,
  37380. getColumnPosition,
  37381. getColumnStartIndexForOffset,
  37382. getColumnStopIndexForStartIndex,
  37383. getEstimatedTotalHeight,
  37384. getEstimatedTotalWidth,
  37385. getColumnOffset,
  37386. getRowOffset,
  37387. getRowPosition,
  37388. getRowStartIndexForOffset,
  37389. getRowStopIndexForStartIndex,
  37390. initCache,
  37391. injectToInstance,
  37392. validateProps
  37393. }) => {
  37394. return vue.defineComponent({
  37395. name: name != null ? name : "ElVirtualList",
  37396. props: virtualizedGridProps,
  37397. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  37398. setup(props, { emit, expose, slots }) {
  37399. const ns = useNamespace("vl");
  37400. validateProps(props);
  37401. const instance = vue.getCurrentInstance();
  37402. const cache = vue.ref(initCache(props, instance));
  37403. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  37404. const windowRef = vue.ref();
  37405. const hScrollbar = vue.ref();
  37406. const vScrollbar = vue.ref();
  37407. const innerRef = vue.ref(null);
  37408. const states = vue.ref({
  37409. isScrolling: false,
  37410. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  37411. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  37412. updateRequested: false,
  37413. xAxisScrollDir: FORWARD,
  37414. yAxisScrollDir: FORWARD
  37415. });
  37416. const getItemStyleCache = useCache();
  37417. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  37418. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  37419. const columnsToRender = vue.computed(() => {
  37420. const { totalColumn, totalRow, columnCache } = props;
  37421. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  37422. if (totalColumn === 0 || totalRow === 0) {
  37423. return [0, 0, 0, 0];
  37424. }
  37425. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  37426. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  37427. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  37428. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  37429. return [
  37430. Math.max(0, startIndex - cacheBackward),
  37431. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  37432. startIndex,
  37433. stopIndex
  37434. ];
  37435. });
  37436. const rowsToRender = vue.computed(() => {
  37437. const { totalColumn, totalRow, rowCache } = props;
  37438. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  37439. if (totalColumn === 0 || totalRow === 0) {
  37440. return [0, 0, 0, 0];
  37441. }
  37442. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  37443. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  37444. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  37445. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  37446. return [
  37447. Math.max(0, startIndex - cacheBackward),
  37448. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  37449. startIndex,
  37450. stopIndex
  37451. ];
  37452. });
  37453. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  37454. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  37455. const windowStyle = vue.computed(() => {
  37456. var _a;
  37457. return [
  37458. {
  37459. position: "relative",
  37460. overflow: "hidden",
  37461. WebkitOverflowScrolling: "touch",
  37462. willChange: "transform"
  37463. },
  37464. {
  37465. direction: props.direction,
  37466. height: isNumber(props.height) ? `${props.height}px` : props.height,
  37467. width: isNumber(props.width) ? `${props.width}px` : props.width
  37468. },
  37469. (_a = props.style) != null ? _a : {}
  37470. ];
  37471. });
  37472. const innerStyle = vue.computed(() => {
  37473. const width = `${vue.unref(estimatedTotalWidth)}px`;
  37474. const height = `${vue.unref(estimatedTotalHeight)}px`;
  37475. return {
  37476. height,
  37477. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  37478. width
  37479. };
  37480. });
  37481. const emitEvents = () => {
  37482. const { totalColumn, totalRow } = props;
  37483. if (totalColumn > 0 && totalRow > 0) {
  37484. const [
  37485. columnCacheStart,
  37486. columnCacheEnd,
  37487. columnVisibleStart,
  37488. columnVisibleEnd
  37489. ] = vue.unref(columnsToRender);
  37490. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  37491. emit(ITEM_RENDER_EVT, {
  37492. columnCacheStart,
  37493. columnCacheEnd,
  37494. rowCacheStart,
  37495. rowCacheEnd,
  37496. columnVisibleStart,
  37497. columnVisibleEnd,
  37498. rowVisibleStart,
  37499. rowVisibleEnd
  37500. });
  37501. }
  37502. const {
  37503. scrollLeft,
  37504. scrollTop,
  37505. updateRequested,
  37506. xAxisScrollDir,
  37507. yAxisScrollDir
  37508. } = vue.unref(states);
  37509. emit(SCROLL_EVT, {
  37510. xAxisScrollDir,
  37511. scrollLeft,
  37512. yAxisScrollDir,
  37513. scrollTop,
  37514. updateRequested
  37515. });
  37516. };
  37517. const onScroll = (e) => {
  37518. const {
  37519. clientHeight,
  37520. clientWidth,
  37521. scrollHeight,
  37522. scrollLeft,
  37523. scrollTop,
  37524. scrollWidth
  37525. } = e.currentTarget;
  37526. const _states = vue.unref(states);
  37527. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  37528. return;
  37529. }
  37530. let _scrollLeft = scrollLeft;
  37531. if (isRTL(props.direction)) {
  37532. switch (getRTLOffsetType()) {
  37533. case RTL_OFFSET_NAG:
  37534. _scrollLeft = -scrollLeft;
  37535. break;
  37536. case RTL_OFFSET_POS_DESC:
  37537. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  37538. break;
  37539. }
  37540. }
  37541. states.value = {
  37542. ..._states,
  37543. isScrolling: true,
  37544. scrollLeft: _scrollLeft,
  37545. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  37546. updateRequested: true,
  37547. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  37548. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  37549. };
  37550. vue.nextTick(() => resetIsScrolling());
  37551. onUpdated();
  37552. emitEvents();
  37553. };
  37554. const onVerticalScroll = (distance, totalSteps) => {
  37555. const height = vue.unref(parsedHeight);
  37556. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  37557. scrollTo({
  37558. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  37559. });
  37560. };
  37561. const onHorizontalScroll = (distance, totalSteps) => {
  37562. const width = vue.unref(parsedWidth);
  37563. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  37564. scrollTo({
  37565. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  37566. });
  37567. };
  37568. const { onWheel } = useGridWheel({
  37569. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  37570. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - vue.unref(parsedWidth)),
  37571. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  37572. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value - vue.unref(parsedHeight))
  37573. }, (x, y) => {
  37574. var _a, _b, _c, _d;
  37575. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  37576. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  37577. const width = vue.unref(parsedWidth);
  37578. const height = vue.unref(parsedHeight);
  37579. scrollTo({
  37580. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  37581. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  37582. });
  37583. });
  37584. useEventListener(windowRef, "wheel", onWheel, {
  37585. passive: false
  37586. });
  37587. const scrollTo = ({
  37588. scrollLeft = states.value.scrollLeft,
  37589. scrollTop = states.value.scrollTop
  37590. }) => {
  37591. scrollLeft = Math.max(scrollLeft, 0);
  37592. scrollTop = Math.max(scrollTop, 0);
  37593. const _states = vue.unref(states);
  37594. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  37595. return;
  37596. }
  37597. states.value = {
  37598. ..._states,
  37599. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  37600. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  37601. scrollLeft,
  37602. scrollTop,
  37603. updateRequested: true
  37604. };
  37605. vue.nextTick(() => resetIsScrolling());
  37606. onUpdated();
  37607. emitEvents();
  37608. };
  37609. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  37610. const _states = vue.unref(states);
  37611. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  37612. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  37613. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  37614. const _cache = vue.unref(cache);
  37615. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  37616. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  37617. scrollTo({
  37618. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  37619. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  37620. });
  37621. };
  37622. const getItemStyle = (rowIndex, columnIndex) => {
  37623. const { columnWidth, direction, rowHeight } = props;
  37624. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  37625. const key = `${rowIndex},${columnIndex}`;
  37626. if (hasOwn(itemStyleCache, key)) {
  37627. return itemStyleCache[key];
  37628. } else {
  37629. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  37630. const _cache = vue.unref(cache);
  37631. const rtl = isRTL(direction);
  37632. const [height, top] = getRowPosition(props, rowIndex, _cache);
  37633. const [width] = getColumnPosition(props, columnIndex, _cache);
  37634. itemStyleCache[key] = {
  37635. position: "absolute",
  37636. left: rtl ? void 0 : `${left}px`,
  37637. right: rtl ? `${left}px` : void 0,
  37638. top: `${top}px`,
  37639. height: `${height}px`,
  37640. width: `${width}px`
  37641. };
  37642. return itemStyleCache[key];
  37643. }
  37644. };
  37645. const resetIsScrolling = () => {
  37646. states.value.isScrolling = false;
  37647. vue.nextTick(() => {
  37648. getItemStyleCache.value(-1, null, null);
  37649. });
  37650. };
  37651. vue.onMounted(() => {
  37652. if (!isClient)
  37653. return;
  37654. const { initScrollLeft, initScrollTop } = props;
  37655. const windowElement = vue.unref(windowRef);
  37656. if (windowElement) {
  37657. if (isNumber(initScrollLeft)) {
  37658. windowElement.scrollLeft = initScrollLeft;
  37659. }
  37660. if (isNumber(initScrollTop)) {
  37661. windowElement.scrollTop = initScrollTop;
  37662. }
  37663. }
  37664. emitEvents();
  37665. });
  37666. const onUpdated = () => {
  37667. const { direction } = props;
  37668. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  37669. const windowElement = vue.unref(windowRef);
  37670. if (updateRequested && windowElement) {
  37671. if (direction === RTL) {
  37672. switch (getRTLOffsetType()) {
  37673. case RTL_OFFSET_NAG: {
  37674. windowElement.scrollLeft = -scrollLeft;
  37675. break;
  37676. }
  37677. case RTL_OFFSET_POS_ASC: {
  37678. windowElement.scrollLeft = scrollLeft;
  37679. break;
  37680. }
  37681. default: {
  37682. const { clientWidth, scrollWidth } = windowElement;
  37683. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  37684. break;
  37685. }
  37686. }
  37687. } else {
  37688. windowElement.scrollLeft = Math.max(0, scrollLeft);
  37689. }
  37690. windowElement.scrollTop = Math.max(0, scrollTop);
  37691. }
  37692. };
  37693. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  37694. expose({
  37695. windowRef,
  37696. innerRef,
  37697. getItemStyleCache,
  37698. scrollTo,
  37699. scrollToItem,
  37700. states,
  37701. resetAfterColumnIndex,
  37702. resetAfterRowIndex,
  37703. resetAfter
  37704. });
  37705. const renderScrollbars = () => {
  37706. const {
  37707. scrollbarAlwaysOn,
  37708. scrollbarStartGap,
  37709. scrollbarEndGap,
  37710. totalColumn,
  37711. totalRow
  37712. } = props;
  37713. const width = vue.unref(parsedWidth);
  37714. const height = vue.unref(parsedHeight);
  37715. const estimatedWidth = vue.unref(estimatedTotalWidth);
  37716. const estimatedHeight = vue.unref(estimatedTotalHeight);
  37717. const { scrollLeft, scrollTop } = vue.unref(states);
  37718. const horizontalScrollbar = vue.h(Scrollbar, {
  37719. ref: hScrollbar,
  37720. alwaysOn: scrollbarAlwaysOn,
  37721. startGap: scrollbarStartGap,
  37722. endGap: scrollbarEndGap,
  37723. class: ns.e("horizontal"),
  37724. clientSize: width,
  37725. layout: "horizontal",
  37726. onScroll: onHorizontalScroll,
  37727. ratio: width * 100 / estimatedWidth,
  37728. scrollFrom: scrollLeft / (estimatedWidth - width),
  37729. total: totalRow,
  37730. visible: true
  37731. });
  37732. const verticalScrollbar = vue.h(Scrollbar, {
  37733. ref: vScrollbar,
  37734. alwaysOn: scrollbarAlwaysOn,
  37735. startGap: scrollbarStartGap,
  37736. endGap: scrollbarEndGap,
  37737. class: ns.e("vertical"),
  37738. clientSize: height,
  37739. layout: "vertical",
  37740. onScroll: onVerticalScroll,
  37741. ratio: height * 100 / estimatedHeight,
  37742. scrollFrom: scrollTop / (estimatedHeight - height),
  37743. total: totalColumn,
  37744. visible: true
  37745. });
  37746. return {
  37747. horizontalScrollbar,
  37748. verticalScrollbar
  37749. };
  37750. };
  37751. const renderItems = () => {
  37752. var _a;
  37753. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  37754. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  37755. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  37756. const children = [];
  37757. if (totalRow > 0 && totalColumn > 0) {
  37758. for (let row = rowStart; row <= rowEnd; row++) {
  37759. for (let column = columnStart; column <= columnEnd; column++) {
  37760. const key = itemKey({ columnIndex: column, data, rowIndex: row });
  37761. children.push(vue.h(vue.Fragment, { key }, (_a = slots.default) == null ? void 0 : _a.call(slots, {
  37762. columnIndex: column,
  37763. data,
  37764. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  37765. style: getItemStyle(row, column),
  37766. rowIndex: row
  37767. })));
  37768. }
  37769. }
  37770. }
  37771. return children;
  37772. };
  37773. const renderInner = () => {
  37774. const Inner = vue.resolveDynamicComponent(props.innerElement);
  37775. const children = renderItems();
  37776. return [
  37777. vue.h(Inner, {
  37778. style: vue.unref(innerStyle),
  37779. ref: innerRef
  37780. }, !isString$1(Inner) ? {
  37781. default: () => children
  37782. } : children)
  37783. ];
  37784. };
  37785. const renderWindow = () => {
  37786. const Container = vue.resolveDynamicComponent(props.containerElement);
  37787. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  37788. const Inner = renderInner();
  37789. return vue.h("div", {
  37790. key: 0,
  37791. class: ns.e("wrapper"),
  37792. role: props.role
  37793. }, [
  37794. vue.h(Container, {
  37795. class: props.className,
  37796. style: vue.unref(windowStyle),
  37797. onScroll,
  37798. ref: windowRef
  37799. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  37800. horizontalScrollbar,
  37801. verticalScrollbar
  37802. ]);
  37803. };
  37804. return renderWindow;
  37805. }
  37806. });
  37807. };
  37808. var createGrid$1 = createGrid;
  37809. const FixedSizeGrid = createGrid$1({
  37810. name: "ElFixedSizeGrid",
  37811. getColumnPosition: ({ columnWidth }, index) => [
  37812. columnWidth,
  37813. index * columnWidth
  37814. ],
  37815. getRowPosition: ({ rowHeight }, index) => [
  37816. rowHeight,
  37817. index * rowHeight
  37818. ],
  37819. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  37820. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  37821. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  37822. width = Number(width);
  37823. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  37824. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  37825. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  37826. if (alignment === "smart") {
  37827. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  37828. alignment = AUTO_ALIGNMENT;
  37829. } else {
  37830. alignment = CENTERED_ALIGNMENT;
  37831. }
  37832. }
  37833. switch (alignment) {
  37834. case START_ALIGNMENT:
  37835. return maxOffset;
  37836. case END_ALIGNMENT:
  37837. return minOffset;
  37838. case CENTERED_ALIGNMENT: {
  37839. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  37840. if (middleOffset < Math.ceil(width / 2)) {
  37841. return 0;
  37842. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  37843. return lastColumnOffset;
  37844. } else {
  37845. return middleOffset;
  37846. }
  37847. }
  37848. case AUTO_ALIGNMENT:
  37849. default:
  37850. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  37851. return scrollLeft;
  37852. } else if (minOffset > maxOffset) {
  37853. return minOffset;
  37854. } else if (scrollLeft < minOffset) {
  37855. return minOffset;
  37856. } else {
  37857. return maxOffset;
  37858. }
  37859. }
  37860. },
  37861. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  37862. height = Number(height);
  37863. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  37864. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  37865. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  37866. if (align === SMART_ALIGNMENT) {
  37867. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  37868. align = AUTO_ALIGNMENT;
  37869. } else {
  37870. align = CENTERED_ALIGNMENT;
  37871. }
  37872. }
  37873. switch (align) {
  37874. case START_ALIGNMENT:
  37875. return maxOffset;
  37876. case END_ALIGNMENT:
  37877. return minOffset;
  37878. case CENTERED_ALIGNMENT: {
  37879. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  37880. if (middleOffset < Math.ceil(height / 2)) {
  37881. return 0;
  37882. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  37883. return lastRowOffset;
  37884. } else {
  37885. return middleOffset;
  37886. }
  37887. }
  37888. case AUTO_ALIGNMENT:
  37889. default:
  37890. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  37891. return scrollTop;
  37892. } else if (minOffset > maxOffset) {
  37893. return minOffset;
  37894. } else if (scrollTop < minOffset) {
  37895. return minOffset;
  37896. } else {
  37897. return maxOffset;
  37898. }
  37899. }
  37900. },
  37901. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  37902. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  37903. const left = startIndex * columnWidth;
  37904. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  37905. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  37906. },
  37907. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  37908. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  37909. const top = startIndex * rowHeight;
  37910. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  37911. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  37912. },
  37913. initCache: () => void 0,
  37914. clearCache: true,
  37915. validateProps: ({ columnWidth, rowHeight }) => {
  37916. }
  37917. });
  37918. var FixedSizeGrid$1 = FixedSizeGrid;
  37919. const { max, min, floor } = Math;
  37920. const ACCESS_SIZER_KEY_MAP = {
  37921. column: "columnWidth",
  37922. row: "rowHeight"
  37923. };
  37924. const ACCESS_LAST_VISITED_KEY_MAP = {
  37925. column: "lastVisitedColumnIndex",
  37926. row: "lastVisitedRowIndex"
  37927. };
  37928. const getItemFromCache = (props, index, gridCache, type) => {
  37929. const [cachedItems, sizer, lastVisited] = [
  37930. gridCache[type],
  37931. props[ACCESS_SIZER_KEY_MAP[type]],
  37932. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  37933. ];
  37934. if (index > lastVisited) {
  37935. let offset = 0;
  37936. if (lastVisited >= 0) {
  37937. const item = cachedItems[lastVisited];
  37938. offset = item.offset + item.size;
  37939. }
  37940. for (let i = lastVisited + 1; i <= index; i++) {
  37941. const size = sizer(i);
  37942. cachedItems[i] = {
  37943. offset,
  37944. size
  37945. };
  37946. offset += size;
  37947. }
  37948. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  37949. }
  37950. return cachedItems[index];
  37951. };
  37952. const bs = (props, gridCache, low, high, offset, type) => {
  37953. while (low <= high) {
  37954. const mid = low + floor((high - low) / 2);
  37955. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  37956. if (currentOffset === offset) {
  37957. return mid;
  37958. } else if (currentOffset < offset) {
  37959. low = mid + 1;
  37960. } else {
  37961. high = mid - 1;
  37962. }
  37963. }
  37964. return max(0, low - 1);
  37965. };
  37966. const es = (props, gridCache, idx, offset, type) => {
  37967. const total = type === "column" ? props.totalColumn : props.totalRow;
  37968. let exponent = 1;
  37969. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  37970. idx += exponent;
  37971. exponent *= 2;
  37972. }
  37973. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  37974. };
  37975. const findItem = (props, gridCache, offset, type) => {
  37976. const [cache, lastVisitedIndex] = [
  37977. gridCache[type],
  37978. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  37979. ];
  37980. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  37981. if (lastVisitedItemOffset >= offset) {
  37982. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  37983. }
  37984. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  37985. };
  37986. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  37987. let sizeOfVisitedRows = 0;
  37988. if (lastVisitedRowIndex >= totalRow) {
  37989. lastVisitedRowIndex = totalRow - 1;
  37990. }
  37991. if (lastVisitedRowIndex >= 0) {
  37992. const item = row[lastVisitedRowIndex];
  37993. sizeOfVisitedRows = item.offset + item.size;
  37994. }
  37995. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  37996. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  37997. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  37998. };
  37999. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  38000. let sizeOfVisitedColumns = 0;
  38001. if (lastVisitedColumnIndex > totalColumn) {
  38002. lastVisitedColumnIndex = totalColumn - 1;
  38003. }
  38004. if (lastVisitedColumnIndex >= 0) {
  38005. const item = column[lastVisitedColumnIndex];
  38006. sizeOfVisitedColumns = item.offset + item.size;
  38007. }
  38008. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  38009. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  38010. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  38011. };
  38012. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  38013. column: getEstimatedTotalWidth,
  38014. row: getEstimatedTotalHeight
  38015. };
  38016. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  38017. const [size, estimatedSizeAssociates] = [
  38018. type === "row" ? props.height : props.width,
  38019. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  38020. ];
  38021. const item = getItemFromCache(props, index, cache, type);
  38022. const estimatedSize = estimatedSizeAssociates(props, cache);
  38023. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  38024. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  38025. if (alignment === SMART_ALIGNMENT) {
  38026. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38027. alignment = AUTO_ALIGNMENT;
  38028. } else {
  38029. alignment = CENTERED_ALIGNMENT;
  38030. }
  38031. }
  38032. switch (alignment) {
  38033. case START_ALIGNMENT: {
  38034. return maxOffset;
  38035. }
  38036. case END_ALIGNMENT: {
  38037. return minOffset;
  38038. }
  38039. case CENTERED_ALIGNMENT: {
  38040. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38041. }
  38042. case AUTO_ALIGNMENT:
  38043. default: {
  38044. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38045. return scrollOffset;
  38046. } else if (minOffset > maxOffset) {
  38047. return minOffset;
  38048. } else if (scrollOffset < minOffset) {
  38049. return minOffset;
  38050. } else {
  38051. return maxOffset;
  38052. }
  38053. }
  38054. }
  38055. };
  38056. const DynamicSizeGrid = createGrid$1({
  38057. name: "ElDynamicSizeGrid",
  38058. getColumnPosition: (props, idx, cache) => {
  38059. const item = getItemFromCache(props, idx, cache, "column");
  38060. return [item.size, item.offset];
  38061. },
  38062. getRowPosition: (props, idx, cache) => {
  38063. const item = getItemFromCache(props, idx, cache, "row");
  38064. return [item.size, item.offset];
  38065. },
  38066. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  38067. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  38068. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  38069. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  38070. const item = getItemFromCache(props, startIndex, cache, "column");
  38071. const maxOffset = scrollLeft + props.width;
  38072. let offset = item.offset + item.size;
  38073. let stopIndex = startIndex;
  38074. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  38075. stopIndex++;
  38076. offset += getItemFromCache(props, startIndex, cache, "column").size;
  38077. }
  38078. return stopIndex;
  38079. },
  38080. getEstimatedTotalHeight,
  38081. getEstimatedTotalWidth,
  38082. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  38083. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  38084. const { totalRow, height } = props;
  38085. const item = getItemFromCache(props, startIndex, cache, "row");
  38086. const maxOffset = scrollTop + height;
  38087. let offset = item.size + item.offset;
  38088. let stopIndex = startIndex;
  38089. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  38090. stopIndex++;
  38091. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  38092. }
  38093. return stopIndex;
  38094. },
  38095. injectToInstance: (instance, cache) => {
  38096. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  38097. var _a, _b;
  38098. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  38099. if (isNumber(columnIndex)) {
  38100. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  38101. }
  38102. if (isNumber(rowIndex)) {
  38103. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  38104. }
  38105. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  38106. if (forceUpdate)
  38107. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  38108. };
  38109. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  38110. resetAfter({
  38111. columnIndex
  38112. }, forceUpdate);
  38113. };
  38114. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  38115. resetAfter({
  38116. rowIndex
  38117. }, forceUpdate);
  38118. };
  38119. Object.assign(instance.proxy, {
  38120. resetAfterColumnIndex,
  38121. resetAfterRowIndex,
  38122. resetAfter
  38123. });
  38124. },
  38125. initCache: ({
  38126. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  38127. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  38128. }) => {
  38129. const cache = {
  38130. column: {},
  38131. estimatedColumnWidth,
  38132. estimatedRowHeight,
  38133. lastVisitedColumnIndex: -1,
  38134. lastVisitedRowIndex: -1,
  38135. row: {}
  38136. };
  38137. return cache;
  38138. },
  38139. clearCache: false,
  38140. validateProps: ({ columnWidth, rowHeight }) => {
  38141. }
  38142. });
  38143. var DynamicSizeGrid$1 = DynamicSizeGrid;
  38144. const _sfc_main$N = vue.defineComponent({
  38145. props: {
  38146. item: {
  38147. type: Object,
  38148. required: true
  38149. },
  38150. style: Object,
  38151. height: Number
  38152. },
  38153. setup() {
  38154. const ns = useNamespace("select");
  38155. return {
  38156. ns
  38157. };
  38158. }
  38159. });
  38160. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  38161. return vue.openBlock(), vue.createElementBlock("div", {
  38162. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  38163. style: vue.normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }])
  38164. }, vue.toDisplayString(_ctx.item.label), 7);
  38165. }
  38166. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  38167. function useOption(props, { emit }) {
  38168. return {
  38169. hoverItem: () => {
  38170. if (!props.disabled) {
  38171. emit("hover", props.index);
  38172. }
  38173. },
  38174. selectOptionClick: () => {
  38175. if (!props.disabled) {
  38176. emit("select", props.item, props.index);
  38177. }
  38178. }
  38179. };
  38180. }
  38181. const defaultProps$4 = {
  38182. label: "label",
  38183. value: "value",
  38184. disabled: "disabled",
  38185. options: "options"
  38186. };
  38187. function useProps(props) {
  38188. const aliasProps = vue.computed(() => ({ ...defaultProps$4, ...props.props }));
  38189. const getLabel = (option) => get(option, aliasProps.value.label);
  38190. const getValue = (option) => get(option, aliasProps.value.value);
  38191. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  38192. const getOptions = (option) => get(option, aliasProps.value.options);
  38193. return {
  38194. aliasProps,
  38195. getLabel,
  38196. getValue,
  38197. getDisabled,
  38198. getOptions
  38199. };
  38200. }
  38201. const SelectProps = buildProps({
  38202. allowCreate: Boolean,
  38203. autocomplete: {
  38204. type: definePropType(String),
  38205. default: "none"
  38206. },
  38207. automaticDropdown: Boolean,
  38208. clearable: Boolean,
  38209. clearIcon: {
  38210. type: iconPropType,
  38211. default: circle_close_default
  38212. },
  38213. effect: {
  38214. type: definePropType(String),
  38215. default: "light"
  38216. },
  38217. collapseTags: Boolean,
  38218. collapseTagsTooltip: Boolean,
  38219. maxCollapseTags: {
  38220. type: Number,
  38221. default: 1
  38222. },
  38223. defaultFirstOption: Boolean,
  38224. disabled: Boolean,
  38225. estimatedOptionHeight: {
  38226. type: Number,
  38227. default: void 0
  38228. },
  38229. filterable: Boolean,
  38230. filterMethod: Function,
  38231. height: {
  38232. type: Number,
  38233. default: 274
  38234. },
  38235. itemHeight: {
  38236. type: Number,
  38237. default: 34
  38238. },
  38239. id: String,
  38240. loading: Boolean,
  38241. loadingText: String,
  38242. modelValue: {
  38243. type: definePropType([Array, String, Number, Boolean, Object])
  38244. },
  38245. multiple: Boolean,
  38246. multipleLimit: {
  38247. type: Number,
  38248. default: 0
  38249. },
  38250. name: String,
  38251. noDataText: String,
  38252. noMatchText: String,
  38253. remoteMethod: Function,
  38254. reserveKeyword: {
  38255. type: Boolean,
  38256. default: true
  38257. },
  38258. options: {
  38259. type: definePropType(Array),
  38260. required: true
  38261. },
  38262. placeholder: {
  38263. type: String
  38264. },
  38265. teleported: useTooltipContentProps.teleported,
  38266. persistent: {
  38267. type: Boolean,
  38268. default: true
  38269. },
  38270. popperClass: {
  38271. type: String,
  38272. default: ""
  38273. },
  38274. popperOptions: {
  38275. type: definePropType(Object),
  38276. default: () => ({})
  38277. },
  38278. remote: Boolean,
  38279. size: useSizeProp,
  38280. props: {
  38281. type: definePropType(Object),
  38282. default: () => defaultProps$4
  38283. },
  38284. valueKey: {
  38285. type: String,
  38286. default: "value"
  38287. },
  38288. scrollbarAlwaysOn: Boolean,
  38289. validateEvent: {
  38290. type: Boolean,
  38291. default: true
  38292. },
  38293. placement: {
  38294. type: definePropType(String),
  38295. values: Ee,
  38296. default: "bottom-start"
  38297. },
  38298. fallbackPlacements: {
  38299. type: definePropType(Array),
  38300. default: ["bottom-start", "top-start", "right", "left"]
  38301. },
  38302. tagType: { ...tagProps.type, default: "info" },
  38303. tagEffect: { ...tagProps.effect, default: "light" },
  38304. ...useEmptyValuesProps,
  38305. ...useAriaProps(["ariaLabel"])
  38306. });
  38307. const OptionProps = buildProps({
  38308. data: Array,
  38309. disabled: Boolean,
  38310. hovering: Boolean,
  38311. item: {
  38312. type: definePropType(Object),
  38313. required: true
  38314. },
  38315. index: Number,
  38316. style: Object,
  38317. selected: Boolean,
  38318. created: Boolean
  38319. });
  38320. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  38321. const _sfc_main$M = vue.defineComponent({
  38322. props: OptionProps,
  38323. emits: ["select", "hover"],
  38324. setup(props, { emit }) {
  38325. const select = vue.inject(selectV2InjectionKey);
  38326. const ns = useNamespace("select");
  38327. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  38328. const { getLabel } = useProps(select.props);
  38329. return {
  38330. ns,
  38331. hoverItem,
  38332. selectOptionClick,
  38333. getLabel
  38334. };
  38335. }
  38336. });
  38337. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  38338. return vue.openBlock(), vue.createElementBlock("li", {
  38339. "aria-selected": _ctx.selected,
  38340. style: vue.normalizeStyle(_ctx.style),
  38341. class: vue.normalizeClass([
  38342. _ctx.ns.be("dropdown", "item"),
  38343. _ctx.ns.is("selected", _ctx.selected),
  38344. _ctx.ns.is("disabled", _ctx.disabled),
  38345. _ctx.ns.is("created", _ctx.created),
  38346. _ctx.ns.is("hovering", _ctx.hovering)
  38347. ]),
  38348. onMouseenter: _ctx.hoverItem,
  38349. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  38350. }, [
  38351. vue.renderSlot(_ctx.$slots, "default", {
  38352. item: _ctx.item,
  38353. index: _ctx.index,
  38354. disabled: _ctx.disabled
  38355. }, () => [
  38356. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  38357. ])
  38358. ], 46, ["aria-selected", "onMouseenter", "onClick"]);
  38359. }
  38360. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  38361. var ElSelectMenu = vue.defineComponent({
  38362. name: "ElSelectDropdown",
  38363. props: {
  38364. loading: Boolean,
  38365. data: {
  38366. type: Array,
  38367. required: true
  38368. },
  38369. hoveringIndex: Number,
  38370. width: Number
  38371. },
  38372. setup(props, {
  38373. slots,
  38374. expose
  38375. }) {
  38376. const select = vue.inject(selectV2InjectionKey);
  38377. const ns = useNamespace("select");
  38378. const {
  38379. getLabel,
  38380. getValue,
  38381. getDisabled
  38382. } = useProps(select.props);
  38383. const cachedHeights = vue.ref([]);
  38384. const listRef = vue.ref();
  38385. const size = vue.computed(() => props.data.length);
  38386. vue.watch(() => size.value, () => {
  38387. var _a, _b;
  38388. (_b = (_a = select.tooltipRef.value).updatePopper) == null ? void 0 : _b.call(_a);
  38389. });
  38390. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  38391. const listProps = vue.computed(() => {
  38392. if (isSized.value) {
  38393. return {
  38394. itemSize: select.props.itemHeight
  38395. };
  38396. }
  38397. return {
  38398. estimatedSize: select.props.estimatedOptionHeight,
  38399. itemSize: (idx) => cachedHeights.value[idx]
  38400. };
  38401. });
  38402. const contains = (arr = [], target) => {
  38403. const {
  38404. props: {
  38405. valueKey
  38406. }
  38407. } = select;
  38408. if (!isObject$1(target)) {
  38409. return arr.includes(target);
  38410. }
  38411. return arr && arr.some((item) => {
  38412. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  38413. });
  38414. };
  38415. const isEqual = (selected, target) => {
  38416. if (!isObject$1(target)) {
  38417. return selected === target;
  38418. } else {
  38419. const {
  38420. valueKey
  38421. } = select.props;
  38422. return get(selected, valueKey) === get(target, valueKey);
  38423. }
  38424. };
  38425. const isItemSelected = (modelValue, target) => {
  38426. if (select.props.multiple) {
  38427. return contains(modelValue, getValue(target));
  38428. }
  38429. return isEqual(modelValue, getValue(target));
  38430. };
  38431. const isItemDisabled = (modelValue, selected) => {
  38432. const {
  38433. disabled,
  38434. multiple,
  38435. multipleLimit
  38436. } = select.props;
  38437. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  38438. };
  38439. const isItemHovering = (target) => props.hoveringIndex === target;
  38440. const scrollToItem = (index) => {
  38441. const list = listRef.value;
  38442. if (list) {
  38443. list.scrollToItem(index);
  38444. }
  38445. };
  38446. const resetScrollTop = () => {
  38447. const list = listRef.value;
  38448. if (list) {
  38449. list.resetScrollTop();
  38450. }
  38451. };
  38452. expose({
  38453. listRef,
  38454. isSized,
  38455. isItemDisabled,
  38456. isItemHovering,
  38457. isItemSelected,
  38458. scrollToItem,
  38459. resetScrollTop
  38460. });
  38461. const Item = (itemProps) => {
  38462. const {
  38463. index,
  38464. data,
  38465. style
  38466. } = itemProps;
  38467. const sized = vue.unref(isSized);
  38468. const {
  38469. itemSize,
  38470. estimatedSize
  38471. } = vue.unref(listProps);
  38472. const {
  38473. modelValue
  38474. } = select.props;
  38475. const {
  38476. onSelect,
  38477. onHover
  38478. } = select;
  38479. const item = data[index];
  38480. if (item.type === "Group") {
  38481. return vue.createVNode(GroupItem, {
  38482. "item": item,
  38483. "style": style,
  38484. "height": sized ? itemSize : estimatedSize
  38485. }, null);
  38486. }
  38487. const isSelected = isItemSelected(modelValue, item);
  38488. const isDisabled = isItemDisabled(modelValue, isSelected);
  38489. const isHovering = isItemHovering(index);
  38490. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  38491. "selected": isSelected,
  38492. "disabled": getDisabled(item) || isDisabled,
  38493. "created": !!item.created,
  38494. "hovering": isHovering,
  38495. "item": item,
  38496. "onSelect": onSelect,
  38497. "onHover": onHover
  38498. }), {
  38499. default: (props2) => {
  38500. var _a;
  38501. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props2)) || vue.createVNode("span", null, [getLabel(item)]);
  38502. }
  38503. });
  38504. };
  38505. const {
  38506. onKeyboardNavigate,
  38507. onKeyboardSelect
  38508. } = select;
  38509. const onForward = () => {
  38510. onKeyboardNavigate("forward");
  38511. };
  38512. const onBackward = () => {
  38513. onKeyboardNavigate("backward");
  38514. };
  38515. const onEscOrTab = () => {
  38516. select.expanded = false;
  38517. };
  38518. const onKeydown = (e) => {
  38519. const {
  38520. code
  38521. } = e;
  38522. const {
  38523. tab,
  38524. esc,
  38525. down,
  38526. up,
  38527. enter
  38528. } = EVENT_CODE;
  38529. if (code !== tab) {
  38530. e.preventDefault();
  38531. e.stopPropagation();
  38532. }
  38533. switch (code) {
  38534. case tab:
  38535. case esc: {
  38536. onEscOrTab();
  38537. break;
  38538. }
  38539. case down: {
  38540. onForward();
  38541. break;
  38542. }
  38543. case up: {
  38544. onBackward();
  38545. break;
  38546. }
  38547. case enter: {
  38548. onKeyboardSelect();
  38549. break;
  38550. }
  38551. }
  38552. };
  38553. return () => {
  38554. var _a, _b, _c, _d;
  38555. const {
  38556. data,
  38557. width
  38558. } = props;
  38559. const {
  38560. height,
  38561. multiple,
  38562. scrollbarAlwaysOn
  38563. } = select.props;
  38564. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  38565. return vue.createVNode("div", {
  38566. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  38567. "style": {
  38568. width: `${width}px`
  38569. }
  38570. }, [(_a = slots.header) == null ? void 0 : _a.call(slots), ((_b = slots.loading) == null ? void 0 : _b.call(slots)) || ((_c = slots.empty) == null ? void 0 : _c.call(slots)) || vue.createVNode(List, vue.mergeProps({
  38571. "ref": listRef
  38572. }, vue.unref(listProps), {
  38573. "className": ns.be("dropdown", "list"),
  38574. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  38575. "data": data,
  38576. "height": height,
  38577. "width": width,
  38578. "total": data.length,
  38579. "onKeydown": onKeydown
  38580. }), {
  38581. default: (props2) => vue.createVNode(Item, props2, null)
  38582. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  38583. };
  38584. }
  38585. });
  38586. function useAllowCreate(props, states) {
  38587. const { aliasProps, getLabel, getValue } = useProps(props);
  38588. const createOptionCount = vue.ref(0);
  38589. const cachedSelectedOption = vue.ref(null);
  38590. const enableAllowCreateMode = vue.computed(() => {
  38591. return props.allowCreate && props.filterable;
  38592. });
  38593. function hasExistingOption(query) {
  38594. const hasOption = (option) => getLabel(option) === query;
  38595. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  38596. }
  38597. function selectNewOption(option) {
  38598. if (!enableAllowCreateMode.value) {
  38599. return;
  38600. }
  38601. if (props.multiple && option.created) {
  38602. createOptionCount.value++;
  38603. } else {
  38604. cachedSelectedOption.value = option;
  38605. }
  38606. }
  38607. function createNewOption(query) {
  38608. if (enableAllowCreateMode.value) {
  38609. if (query && query.length > 0) {
  38610. if (hasExistingOption(query)) {
  38611. return;
  38612. }
  38613. const newOption = {
  38614. [aliasProps.value.value]: query,
  38615. [aliasProps.value.label]: query,
  38616. created: true,
  38617. [aliasProps.value.disabled]: false
  38618. };
  38619. if (states.createdOptions.length >= createOptionCount.value) {
  38620. states.createdOptions[createOptionCount.value] = newOption;
  38621. } else {
  38622. states.createdOptions.push(newOption);
  38623. }
  38624. } else {
  38625. if (props.multiple) {
  38626. states.createdOptions.length = createOptionCount.value;
  38627. } else {
  38628. const selectedOption = cachedSelectedOption.value;
  38629. states.createdOptions.length = 0;
  38630. if (selectedOption && selectedOption.created) {
  38631. states.createdOptions.push(selectedOption);
  38632. }
  38633. }
  38634. }
  38635. }
  38636. }
  38637. function removeNewOption(option) {
  38638. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  38639. return;
  38640. }
  38641. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  38642. if (~idx) {
  38643. states.createdOptions.splice(idx, 1);
  38644. createOptionCount.value--;
  38645. }
  38646. }
  38647. function clearAllNewOption() {
  38648. if (enableAllowCreateMode.value) {
  38649. states.createdOptions.length = 0;
  38650. createOptionCount.value = 0;
  38651. }
  38652. }
  38653. return {
  38654. createNewOption,
  38655. removeNewOption,
  38656. selectNewOption,
  38657. clearAllNewOption
  38658. };
  38659. }
  38660. const MINIMUM_INPUT_WIDTH = 11;
  38661. const useSelect$1 = (props, emit) => {
  38662. const { t } = useLocale();
  38663. const nsSelect = useNamespace("select");
  38664. const nsInput = useNamespace("input");
  38665. const { form: elForm, formItem: elFormItem } = useFormItem();
  38666. const { inputId } = useFormItemInputId(props, {
  38667. formItemContext: elFormItem
  38668. });
  38669. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  38670. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  38671. const states = vue.reactive({
  38672. inputValue: "",
  38673. cachedOptions: [],
  38674. createdOptions: [],
  38675. hoveringIndex: -1,
  38676. inputHovering: false,
  38677. selectionWidth: 0,
  38678. calculatorWidth: 0,
  38679. collapseItemWidth: 0,
  38680. previousQuery: null,
  38681. previousValue: void 0,
  38682. selectedLabel: "",
  38683. menuVisibleOnFocus: false,
  38684. isBeforeHide: false
  38685. });
  38686. const popperSize = vue.ref(-1);
  38687. const selectRef = vue.ref(null);
  38688. const selectionRef = vue.ref(null);
  38689. const tooltipRef = vue.ref(null);
  38690. const tagTooltipRef = vue.ref(null);
  38691. const inputRef = vue.ref(null);
  38692. const calculatorRef = vue.ref(null);
  38693. const prefixRef = vue.ref(null);
  38694. const suffixRef = vue.ref(null);
  38695. const menuRef = vue.ref(null);
  38696. const tagMenuRef = vue.ref(null);
  38697. const collapseItemRef = vue.ref(null);
  38698. const {
  38699. isComposing,
  38700. handleCompositionStart,
  38701. handleCompositionEnd,
  38702. handleCompositionUpdate
  38703. } = useComposition({
  38704. afterComposition: (e) => onInput(e)
  38705. });
  38706. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  38707. beforeFocus() {
  38708. return selectDisabled.value;
  38709. },
  38710. afterFocus() {
  38711. if (props.automaticDropdown && !expanded.value) {
  38712. expanded.value = true;
  38713. states.menuVisibleOnFocus = true;
  38714. }
  38715. },
  38716. beforeBlur(event) {
  38717. var _a, _b;
  38718. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  38719. },
  38720. afterBlur() {
  38721. expanded.value = false;
  38722. states.menuVisibleOnFocus = false;
  38723. }
  38724. });
  38725. const allOptions = vue.ref([]);
  38726. const filteredOptions = vue.ref([]);
  38727. const expanded = vue.ref(false);
  38728. const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  38729. const popupHeight = vue.computed(() => {
  38730. const totalHeight = filteredOptions.value.length * props.itemHeight;
  38731. return totalHeight > props.height ? props.height : totalHeight;
  38732. });
  38733. const hasModelValue = vue.computed(() => {
  38734. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  38735. });
  38736. const showClearBtn = vue.computed(() => {
  38737. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  38738. });
  38739. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : arrow_down_default);
  38740. const iconReverse = vue.computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  38741. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  38742. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  38743. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  38744. const emptyText = vue.computed(() => {
  38745. if (props.loading) {
  38746. return props.loadingText || t("el.select.loading");
  38747. } else {
  38748. if (props.remote && !states.inputValue && allOptions.value.length === 0)
  38749. return false;
  38750. if (props.filterable && states.inputValue && allOptions.value.length > 0 && filteredOptions.value.length === 0) {
  38751. return props.noMatchText || t("el.select.noMatch");
  38752. }
  38753. if (allOptions.value.length === 0) {
  38754. return props.noDataText || t("el.select.noData");
  38755. }
  38756. }
  38757. return null;
  38758. });
  38759. const filterOptions = (query) => {
  38760. const isValidOption = (o) => {
  38761. if (props.filterable && isFunction$1(props.filterMethod))
  38762. return true;
  38763. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  38764. return true;
  38765. const regexp = new RegExp(escapeStringRegexp(query), "i");
  38766. return query ? regexp.test(getLabel(o) || "") : true;
  38767. };
  38768. if (props.loading) {
  38769. return [];
  38770. }
  38771. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  38772. const options = getOptions(item);
  38773. if (isArray$1(options)) {
  38774. const filtered = options.filter(isValidOption);
  38775. if (filtered.length > 0) {
  38776. all.push({
  38777. label: getLabel(item),
  38778. type: "Group"
  38779. }, ...filtered);
  38780. }
  38781. } else if (props.remote || isValidOption(item)) {
  38782. all.push(item);
  38783. }
  38784. return all;
  38785. }, []);
  38786. };
  38787. const updateOptions = () => {
  38788. allOptions.value = filterOptions("");
  38789. filteredOptions.value = filterOptions(states.inputValue);
  38790. };
  38791. const allOptionsValueMap = vue.computed(() => {
  38792. const valueMap = /* @__PURE__ */ new Map();
  38793. allOptions.value.forEach((option, index) => {
  38794. valueMap.set(getValueKey(getValue(option)), { option, index });
  38795. });
  38796. return valueMap;
  38797. });
  38798. const filteredOptionsValueMap = vue.computed(() => {
  38799. const valueMap = /* @__PURE__ */ new Map();
  38800. filteredOptions.value.forEach((option, index) => {
  38801. valueMap.set(getValueKey(getValue(option)), { option, index });
  38802. });
  38803. return valueMap;
  38804. });
  38805. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  38806. const selectSize = useFormSize();
  38807. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  38808. const calculatePopperSize = () => {
  38809. var _a;
  38810. popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  38811. };
  38812. const getGapWidth = () => {
  38813. if (!selectionRef.value)
  38814. return 0;
  38815. const style = window.getComputedStyle(selectionRef.value);
  38816. return Number.parseFloat(style.gap || "6px");
  38817. };
  38818. const tagStyle = vue.computed(() => {
  38819. const gapWidth = getGapWidth();
  38820. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  38821. return { maxWidth: `${maxWidth}px` };
  38822. });
  38823. const collapseTagStyle = vue.computed(() => {
  38824. return { maxWidth: `${states.selectionWidth}px` };
  38825. });
  38826. const inputStyle = vue.computed(() => ({
  38827. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH)}px`
  38828. }));
  38829. const shouldShowPlaceholder = vue.computed(() => {
  38830. if (isArray$1(props.modelValue)) {
  38831. return props.modelValue.length === 0 && !states.inputValue;
  38832. }
  38833. return props.filterable ? !states.inputValue : true;
  38834. });
  38835. const currentPlaceholder = vue.computed(() => {
  38836. var _a;
  38837. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  38838. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  38839. });
  38840. const popperRef = vue.computed(() => {
  38841. var _a, _b;
  38842. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  38843. });
  38844. const indexRef = vue.computed(() => {
  38845. if (props.multiple) {
  38846. const len = props.modelValue.length;
  38847. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  38848. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  38849. return index;
  38850. }
  38851. } else {
  38852. if (props.modelValue && filteredOptionsValueMap.value.has(props.modelValue)) {
  38853. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  38854. return index;
  38855. }
  38856. }
  38857. return -1;
  38858. });
  38859. const dropdownMenuVisible = vue.computed({
  38860. get() {
  38861. return expanded.value && emptyText.value !== false;
  38862. },
  38863. set(val) {
  38864. expanded.value = val;
  38865. }
  38866. });
  38867. const showTagList = vue.computed(() => {
  38868. if (!props.multiple) {
  38869. return [];
  38870. }
  38871. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  38872. });
  38873. const collapseTagList = vue.computed(() => {
  38874. if (!props.multiple) {
  38875. return [];
  38876. }
  38877. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  38878. });
  38879. const {
  38880. createNewOption,
  38881. removeNewOption,
  38882. selectNewOption,
  38883. clearAllNewOption
  38884. } = useAllowCreate(props, states);
  38885. const toggleMenu = () => {
  38886. if (selectDisabled.value)
  38887. return;
  38888. if (states.menuVisibleOnFocus) {
  38889. states.menuVisibleOnFocus = false;
  38890. } else {
  38891. expanded.value = !expanded.value;
  38892. }
  38893. };
  38894. const onInputChange = () => {
  38895. if (states.inputValue.length > 0 && !expanded.value) {
  38896. expanded.value = true;
  38897. }
  38898. createNewOption(states.inputValue);
  38899. handleQueryChange(states.inputValue);
  38900. };
  38901. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  38902. const handleQueryChange = (val) => {
  38903. if (states.previousQuery === val || isComposing.value) {
  38904. return;
  38905. }
  38906. states.previousQuery = val;
  38907. if (props.filterable && isFunction$1(props.filterMethod)) {
  38908. props.filterMethod(val);
  38909. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  38910. props.remoteMethod(val);
  38911. }
  38912. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  38913. vue.nextTick(checkDefaultFirstOption);
  38914. } else {
  38915. vue.nextTick(updateHoveringIndex);
  38916. }
  38917. };
  38918. const checkDefaultFirstOption = () => {
  38919. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  38920. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  38921. const firstOriginOption = optionsInDropdown[0];
  38922. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  38923. };
  38924. const emitChange = (val) => {
  38925. if (!isEqual$1(props.modelValue, val)) {
  38926. emit(CHANGE_EVENT, val);
  38927. }
  38928. };
  38929. const update = (val) => {
  38930. emit(UPDATE_MODEL_EVENT, val);
  38931. emitChange(val);
  38932. states.previousValue = props.multiple ? String(val) : val;
  38933. };
  38934. const getValueIndex = (arr = [], value) => {
  38935. if (!isObject$1(value)) {
  38936. return arr.indexOf(value);
  38937. }
  38938. const valueKey = props.valueKey;
  38939. let index = -1;
  38940. arr.some((item, i) => {
  38941. if (get(item, valueKey) === get(value, valueKey)) {
  38942. index = i;
  38943. return true;
  38944. }
  38945. return false;
  38946. });
  38947. return index;
  38948. };
  38949. const getValueKey = (item) => {
  38950. return isObject$1(item) ? get(item, props.valueKey) : item;
  38951. };
  38952. const handleResize = () => {
  38953. calculatePopperSize();
  38954. };
  38955. const resetSelectionWidth = () => {
  38956. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  38957. };
  38958. const resetCalculatorWidth = () => {
  38959. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  38960. };
  38961. const resetCollapseItemWidth = () => {
  38962. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  38963. };
  38964. const updateTooltip = () => {
  38965. var _a, _b;
  38966. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  38967. };
  38968. const updateTagTooltip = () => {
  38969. var _a, _b;
  38970. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  38971. };
  38972. const onSelect = (option) => {
  38973. if (props.multiple) {
  38974. let selectedOptions = props.modelValue.slice();
  38975. const index = getValueIndex(selectedOptions, getValue(option));
  38976. if (index > -1) {
  38977. selectedOptions = [
  38978. ...selectedOptions.slice(0, index),
  38979. ...selectedOptions.slice(index + 1)
  38980. ];
  38981. states.cachedOptions.splice(index, 1);
  38982. removeNewOption(option);
  38983. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  38984. selectedOptions = [...selectedOptions, getValue(option)];
  38985. states.cachedOptions.push(option);
  38986. selectNewOption(option);
  38987. }
  38988. update(selectedOptions);
  38989. if (option.created) {
  38990. handleQueryChange("");
  38991. }
  38992. if (props.filterable && !props.reserveKeyword) {
  38993. states.inputValue = "";
  38994. }
  38995. } else {
  38996. states.selectedLabel = getLabel(option);
  38997. update(getValue(option));
  38998. expanded.value = false;
  38999. selectNewOption(option);
  39000. if (!option.created) {
  39001. clearAllNewOption();
  39002. }
  39003. }
  39004. focus();
  39005. };
  39006. const deleteTag = (event, option) => {
  39007. let selectedOptions = props.modelValue.slice();
  39008. const index = getValueIndex(selectedOptions, getValue(option));
  39009. if (index > -1 && !selectDisabled.value) {
  39010. selectedOptions = [
  39011. ...props.modelValue.slice(0, index),
  39012. ...props.modelValue.slice(index + 1)
  39013. ];
  39014. states.cachedOptions.splice(index, 1);
  39015. update(selectedOptions);
  39016. emit("remove-tag", getValue(option));
  39017. removeNewOption(option);
  39018. }
  39019. event.stopPropagation();
  39020. focus();
  39021. };
  39022. const focus = () => {
  39023. var _a;
  39024. (_a = inputRef.value) == null ? void 0 : _a.focus();
  39025. };
  39026. const blur = () => {
  39027. var _a;
  39028. (_a = inputRef.value) == null ? void 0 : _a.blur();
  39029. };
  39030. const handleEsc = () => {
  39031. if (states.inputValue.length > 0) {
  39032. states.inputValue = "";
  39033. } else {
  39034. expanded.value = false;
  39035. }
  39036. };
  39037. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  39038. const handleDel = (e) => {
  39039. if (!props.multiple)
  39040. return;
  39041. if (e.code === EVENT_CODE.delete)
  39042. return;
  39043. if (states.inputValue.length === 0) {
  39044. e.preventDefault();
  39045. const selected = props.modelValue.slice();
  39046. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  39047. if (lastNotDisabledIndex < 0)
  39048. return;
  39049. const removeTagValue = selected[lastNotDisabledIndex];
  39050. selected.splice(lastNotDisabledIndex, 1);
  39051. const option = states.cachedOptions[lastNotDisabledIndex];
  39052. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  39053. removeNewOption(option);
  39054. update(selected);
  39055. emit("remove-tag", removeTagValue);
  39056. }
  39057. };
  39058. const handleClear = () => {
  39059. let emptyValue;
  39060. if (isArray$1(props.modelValue)) {
  39061. emptyValue = [];
  39062. } else {
  39063. emptyValue = valueOnClear.value;
  39064. }
  39065. if (props.multiple) {
  39066. states.cachedOptions = [];
  39067. } else {
  39068. states.selectedLabel = "";
  39069. }
  39070. expanded.value = false;
  39071. update(emptyValue);
  39072. emit("clear");
  39073. clearAllNewOption();
  39074. focus();
  39075. };
  39076. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  39077. const options = filteredOptions.value;
  39078. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) {
  39079. return;
  39080. }
  39081. if (!expanded.value) {
  39082. return toggleMenu();
  39083. }
  39084. if (hoveringIndex === void 0) {
  39085. hoveringIndex = states.hoveringIndex;
  39086. }
  39087. let newIndex = -1;
  39088. if (direction === "forward") {
  39089. newIndex = hoveringIndex + 1;
  39090. if (newIndex >= options.length) {
  39091. newIndex = 0;
  39092. }
  39093. } else if (direction === "backward") {
  39094. newIndex = hoveringIndex - 1;
  39095. if (newIndex < 0 || newIndex >= options.length) {
  39096. newIndex = options.length - 1;
  39097. }
  39098. }
  39099. const option = options[newIndex];
  39100. if (getDisabled(option) || option.type === "Group") {
  39101. return onKeyboardNavigate(direction, newIndex);
  39102. } else {
  39103. states.hoveringIndex = newIndex;
  39104. scrollToItem(newIndex);
  39105. }
  39106. };
  39107. const onKeyboardSelect = () => {
  39108. if (!expanded.value) {
  39109. return toggleMenu();
  39110. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  39111. onSelect(filteredOptions.value[states.hoveringIndex]);
  39112. }
  39113. };
  39114. const onHoverOption = (idx) => {
  39115. states.hoveringIndex = idx;
  39116. };
  39117. const updateHoveringIndex = () => {
  39118. if (!props.multiple) {
  39119. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  39120. return getValueKey(item) === getValueKey(props.modelValue);
  39121. });
  39122. } else {
  39123. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(item)));
  39124. }
  39125. };
  39126. const onInput = (event) => {
  39127. states.inputValue = event.target.value;
  39128. if (props.remote) {
  39129. debouncedOnInputChange();
  39130. } else {
  39131. return onInputChange();
  39132. }
  39133. };
  39134. const handleClickOutside = () => {
  39135. expanded.value = false;
  39136. isFocused.value && blur();
  39137. };
  39138. const handleMenuEnter = () => {
  39139. states.isBeforeHide = false;
  39140. return vue.nextTick(() => {
  39141. if (~indexRef.value) {
  39142. scrollToItem(states.hoveringIndex);
  39143. }
  39144. });
  39145. };
  39146. const scrollToItem = (index) => {
  39147. menuRef.value.scrollToItem(index);
  39148. };
  39149. const getOption = (value) => {
  39150. const selectValue = getValueKey(value);
  39151. if (allOptionsValueMap.value.has(selectValue)) {
  39152. const { option } = allOptionsValueMap.value.get(selectValue);
  39153. return option;
  39154. }
  39155. return {
  39156. [aliasProps.value.value]: value,
  39157. [aliasProps.value.label]: value
  39158. };
  39159. };
  39160. const initStates = () => {
  39161. if (props.multiple) {
  39162. if (props.modelValue.length > 0) {
  39163. states.cachedOptions.length = 0;
  39164. states.previousValue = props.modelValue.toString();
  39165. for (const value of props.modelValue) {
  39166. const option = getOption(value);
  39167. states.cachedOptions.push(option);
  39168. }
  39169. } else {
  39170. states.cachedOptions = [];
  39171. states.previousValue = void 0;
  39172. }
  39173. } else {
  39174. if (hasModelValue.value) {
  39175. states.previousValue = props.modelValue;
  39176. const options = filteredOptions.value;
  39177. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  39178. if (~selectedItemIndex) {
  39179. states.selectedLabel = getLabel(options[selectedItemIndex]);
  39180. } else {
  39181. states.selectedLabel = getValueKey(props.modelValue);
  39182. }
  39183. } else {
  39184. states.selectedLabel = "";
  39185. states.previousValue = void 0;
  39186. }
  39187. }
  39188. clearAllNewOption();
  39189. calculatePopperSize();
  39190. };
  39191. vue.watch(expanded, (val) => {
  39192. if (val) {
  39193. handleQueryChange("");
  39194. } else {
  39195. states.inputValue = "";
  39196. states.previousQuery = null;
  39197. states.isBeforeHide = true;
  39198. createNewOption("");
  39199. }
  39200. emit("visible-change", val);
  39201. });
  39202. vue.watch(() => props.modelValue, (val, oldVal) => {
  39203. var _a;
  39204. if (!val || props.multiple && val.toString() !== states.previousValue || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  39205. initStates();
  39206. }
  39207. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  39208. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  39209. }
  39210. }, {
  39211. deep: true
  39212. });
  39213. vue.watch(() => props.options, () => {
  39214. const input = inputRef.value;
  39215. if (!input || input && document.activeElement !== input) {
  39216. initStates();
  39217. }
  39218. }, {
  39219. deep: true,
  39220. flush: "post"
  39221. });
  39222. vue.watch(() => filteredOptions.value, () => {
  39223. return menuRef.value && vue.nextTick(menuRef.value.resetScrollTop);
  39224. });
  39225. vue.watchEffect(() => {
  39226. if (states.isBeforeHide)
  39227. return;
  39228. updateOptions();
  39229. });
  39230. vue.watchEffect(() => {
  39231. const { valueKey, options } = props;
  39232. const duplicateValue = /* @__PURE__ */ new Map();
  39233. for (const item of options) {
  39234. const optionValue = getValue(item);
  39235. let v = optionValue;
  39236. if (isObject$1(v)) {
  39237. v = get(optionValue, valueKey);
  39238. }
  39239. if (duplicateValue.get(v)) {
  39240. break;
  39241. } else {
  39242. duplicateValue.set(v, true);
  39243. }
  39244. }
  39245. });
  39246. vue.onMounted(() => {
  39247. initStates();
  39248. });
  39249. useResizeObserver(selectRef, handleResize);
  39250. useResizeObserver(selectionRef, resetSelectionWidth);
  39251. useResizeObserver(calculatorRef, resetCalculatorWidth);
  39252. useResizeObserver(menuRef, updateTooltip);
  39253. useResizeObserver(wrapperRef, updateTooltip);
  39254. useResizeObserver(tagMenuRef, updateTagTooltip);
  39255. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  39256. return {
  39257. inputId,
  39258. collapseTagSize,
  39259. currentPlaceholder,
  39260. expanded,
  39261. emptyText,
  39262. popupHeight,
  39263. debounce: debounce$1,
  39264. allOptions,
  39265. filteredOptions,
  39266. iconComponent,
  39267. iconReverse,
  39268. tagStyle,
  39269. collapseTagStyle,
  39270. inputStyle,
  39271. popperSize,
  39272. dropdownMenuVisible,
  39273. hasModelValue,
  39274. shouldShowPlaceholder,
  39275. selectDisabled,
  39276. selectSize,
  39277. showClearBtn,
  39278. states,
  39279. isFocused,
  39280. nsSelect,
  39281. nsInput,
  39282. calculatorRef,
  39283. inputRef,
  39284. menuRef,
  39285. tagMenuRef,
  39286. tooltipRef,
  39287. tagTooltipRef,
  39288. selectRef,
  39289. wrapperRef,
  39290. selectionRef,
  39291. prefixRef,
  39292. suffixRef,
  39293. collapseItemRef,
  39294. popperRef,
  39295. validateState,
  39296. validateIcon,
  39297. showTagList,
  39298. collapseTagList,
  39299. debouncedOnInputChange,
  39300. deleteTag,
  39301. getLabel,
  39302. getValue,
  39303. getDisabled,
  39304. getValueKey,
  39305. handleClear,
  39306. handleClickOutside,
  39307. handleDel,
  39308. handleEsc,
  39309. focus,
  39310. blur,
  39311. handleMenuEnter,
  39312. handleResize,
  39313. resetSelectionWidth,
  39314. resetCalculatorWidth,
  39315. updateTooltip,
  39316. updateTagTooltip,
  39317. updateOptions,
  39318. toggleMenu,
  39319. scrollTo: scrollToItem,
  39320. onInput,
  39321. onKeyboardNavigate,
  39322. onKeyboardSelect,
  39323. onSelect,
  39324. onHover: onHoverOption,
  39325. handleCompositionStart,
  39326. handleCompositionEnd,
  39327. handleCompositionUpdate
  39328. };
  39329. };
  39330. var useSelect$2 = useSelect$1;
  39331. const _sfc_main$L = vue.defineComponent({
  39332. name: "ElSelectV2",
  39333. components: {
  39334. ElSelectMenu,
  39335. ElTag,
  39336. ElTooltip,
  39337. ElIcon
  39338. },
  39339. directives: { ClickOutside },
  39340. props: SelectProps,
  39341. emits: [
  39342. UPDATE_MODEL_EVENT,
  39343. CHANGE_EVENT,
  39344. "remove-tag",
  39345. "clear",
  39346. "visible-change",
  39347. "focus",
  39348. "blur"
  39349. ],
  39350. setup(props, { emit }) {
  39351. const modelValue = vue.computed(() => {
  39352. const { modelValue: rawModelValue, multiple } = props;
  39353. const fallback = multiple ? [] : void 0;
  39354. if (isArray$1(rawModelValue)) {
  39355. return multiple ? rawModelValue : fallback;
  39356. }
  39357. return multiple ? fallback : rawModelValue;
  39358. });
  39359. const API = useSelect$2(vue.reactive({
  39360. ...vue.toRefs(props),
  39361. modelValue
  39362. }), emit);
  39363. vue.provide(selectV2InjectionKey, {
  39364. props: vue.reactive({
  39365. ...vue.toRefs(props),
  39366. height: API.popupHeight,
  39367. modelValue
  39368. }),
  39369. tooltipRef: API.tooltipRef,
  39370. onSelect: API.onSelect,
  39371. onHover: API.onHover,
  39372. onKeyboardNavigate: API.onKeyboardNavigate,
  39373. onKeyboardSelect: API.onKeyboardSelect
  39374. });
  39375. return {
  39376. ...API,
  39377. modelValue
  39378. };
  39379. }
  39380. });
  39381. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  39382. const _component_el_tag = vue.resolveComponent("el-tag");
  39383. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  39384. const _component_el_icon = vue.resolveComponent("el-icon");
  39385. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  39386. const _directive_click_outside = vue.resolveDirective("click-outside");
  39387. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  39388. ref: "selectRef",
  39389. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  39390. onMouseenter: ($event) => _ctx.states.inputHovering = true,
  39391. onMouseleave: ($event) => _ctx.states.inputHovering = false
  39392. }, [
  39393. vue.createVNode(_component_el_tooltip, {
  39394. ref: "tooltipRef",
  39395. visible: _ctx.dropdownMenuVisible,
  39396. teleported: _ctx.teleported,
  39397. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  39398. "gpu-acceleration": false,
  39399. "stop-popper-mouse-event": false,
  39400. "popper-options": _ctx.popperOptions,
  39401. "fallback-placements": _ctx.fallbackPlacements,
  39402. effect: _ctx.effect,
  39403. placement: _ctx.placement,
  39404. pure: "",
  39405. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  39406. trigger: "click",
  39407. persistent: _ctx.persistent,
  39408. onBeforeShow: _ctx.handleMenuEnter,
  39409. onHide: ($event) => _ctx.states.isBeforeHide = false
  39410. }, {
  39411. default: vue.withCtx(() => [
  39412. vue.createElementVNode("div", {
  39413. ref: "wrapperRef",
  39414. class: vue.normalizeClass([
  39415. _ctx.nsSelect.e("wrapper"),
  39416. _ctx.nsSelect.is("focused", _ctx.isFocused),
  39417. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  39418. _ctx.nsSelect.is("filterable", _ctx.filterable),
  39419. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  39420. ]),
  39421. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  39422. }, [
  39423. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  39424. key: 0,
  39425. ref: "prefixRef",
  39426. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  39427. }, [
  39428. vue.renderSlot(_ctx.$slots, "prefix")
  39429. ], 2)) : vue.createCommentVNode("v-if", true),
  39430. vue.createElementVNode("div", {
  39431. ref: "selectionRef",
  39432. class: vue.normalizeClass([
  39433. _ctx.nsSelect.e("selection"),
  39434. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  39435. ])
  39436. }, [
  39437. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  39438. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  39439. return vue.openBlock(), vue.createElementBlock("div", {
  39440. key: _ctx.getValueKey(_ctx.getValue(item)),
  39441. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  39442. }, [
  39443. vue.createVNode(_component_el_tag, {
  39444. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  39445. size: _ctx.collapseTagSize,
  39446. type: _ctx.tagType,
  39447. effect: _ctx.tagEffect,
  39448. "disable-transitions": "",
  39449. style: vue.normalizeStyle(_ctx.tagStyle),
  39450. onClose: ($event) => _ctx.deleteTag($event, item)
  39451. }, {
  39452. default: vue.withCtx(() => [
  39453. vue.createElementVNode("span", {
  39454. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  39455. }, [
  39456. vue.renderSlot(_ctx.$slots, "label", {
  39457. label: _ctx.getLabel(item),
  39458. value: _ctx.getValue(item)
  39459. }, () => [
  39460. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(item)), 1)
  39461. ])
  39462. ], 2)
  39463. ]),
  39464. _: 2
  39465. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  39466. ], 2);
  39467. }), 128)),
  39468. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  39469. key: 0,
  39470. ref: "tagTooltipRef",
  39471. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  39472. "fallback-placements": ["bottom", "top", "right", "left"],
  39473. effect: _ctx.effect,
  39474. placement: "bottom",
  39475. teleported: _ctx.teleported
  39476. }, {
  39477. default: vue.withCtx(() => [
  39478. vue.createElementVNode("div", {
  39479. ref: "collapseItemRef",
  39480. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  39481. }, [
  39482. vue.createVNode(_component_el_tag, {
  39483. closable: false,
  39484. size: _ctx.collapseTagSize,
  39485. type: _ctx.tagType,
  39486. effect: _ctx.tagEffect,
  39487. style: vue.normalizeStyle(_ctx.collapseTagStyle),
  39488. "disable-transitions": ""
  39489. }, {
  39490. default: vue.withCtx(() => [
  39491. vue.createElementVNode("span", {
  39492. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  39493. }, " + " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  39494. ]),
  39495. _: 1
  39496. }, 8, ["size", "type", "effect", "style"])
  39497. ], 2)
  39498. ]),
  39499. content: vue.withCtx(() => [
  39500. vue.createElementVNode("div", {
  39501. ref: "tagMenuRef",
  39502. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  39503. }, [
  39504. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (selected) => {
  39505. return vue.openBlock(), vue.createElementBlock("div", {
  39506. key: _ctx.getValueKey(_ctx.getValue(selected)),
  39507. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  39508. }, [
  39509. vue.createVNode(_component_el_tag, {
  39510. class: "in-tooltip",
  39511. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  39512. size: _ctx.collapseTagSize,
  39513. type: _ctx.tagType,
  39514. effect: _ctx.tagEffect,
  39515. "disable-transitions": "",
  39516. onClose: ($event) => _ctx.deleteTag($event, selected)
  39517. }, {
  39518. default: vue.withCtx(() => [
  39519. vue.createElementVNode("span", {
  39520. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  39521. }, [
  39522. vue.renderSlot(_ctx.$slots, "label", {
  39523. label: _ctx.getLabel(selected),
  39524. value: _ctx.getValue(selected)
  39525. }, () => [
  39526. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(selected)), 1)
  39527. ])
  39528. ], 2)
  39529. ]),
  39530. _: 2
  39531. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  39532. ], 2);
  39533. }), 128))
  39534. ], 2)
  39535. ]),
  39536. _: 3
  39537. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  39538. ]) : vue.createCommentVNode("v-if", true),
  39539. !_ctx.selectDisabled ? (vue.openBlock(), vue.createElementBlock("div", {
  39540. key: 1,
  39541. class: vue.normalizeClass([
  39542. _ctx.nsSelect.e("selected-item"),
  39543. _ctx.nsSelect.e("input-wrapper"),
  39544. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  39545. ])
  39546. }, [
  39547. vue.withDirectives(vue.createElementVNode("input", {
  39548. id: _ctx.inputId,
  39549. ref: "inputRef",
  39550. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  39551. style: vue.normalizeStyle(_ctx.inputStyle),
  39552. autocomplete: _ctx.autocomplete,
  39553. "aria-autocomplete": "list",
  39554. "aria-haspopup": "listbox",
  39555. autocapitalize: "off",
  39556. "aria-expanded": _ctx.expanded,
  39557. "aria-label": _ctx.ariaLabel,
  39558. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  39559. disabled: _ctx.selectDisabled,
  39560. role: "combobox",
  39561. readonly: !_ctx.filterable,
  39562. spellcheck: "false",
  39563. type: "text",
  39564. name: _ctx.name,
  39565. onInput: _ctx.onInput,
  39566. onCompositionstart: _ctx.handleCompositionStart,
  39567. onCompositionupdate: _ctx.handleCompositionUpdate,
  39568. onCompositionend: _ctx.handleCompositionEnd,
  39569. onKeydown: [
  39570. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"]),
  39571. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"]),
  39572. vue.withKeys(vue.withModifiers(_ctx.onKeyboardSelect, ["stop", "prevent"]), ["enter"]),
  39573. vue.withKeys(vue.withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  39574. vue.withKeys(vue.withModifiers(_ctx.handleDel, ["stop"]), ["delete"])
  39575. ],
  39576. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  39577. }, null, 46, ["id", "onUpdate:modelValue", "autocomplete", "aria-expanded", "aria-label", "disabled", "readonly", "name", "onInput", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown", "onClick"]), [
  39578. [vue.vModelText, _ctx.states.inputValue]
  39579. ]),
  39580. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  39581. key: 0,
  39582. ref: "calculatorRef",
  39583. "aria-hidden": "true",
  39584. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  39585. textContent: vue.toDisplayString(_ctx.states.inputValue)
  39586. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  39587. ], 2)) : vue.createCommentVNode("v-if", true),
  39588. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  39589. key: 2,
  39590. class: vue.normalizeClass([
  39591. _ctx.nsSelect.e("selected-item"),
  39592. _ctx.nsSelect.e("placeholder"),
  39593. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  39594. ])
  39595. }, [
  39596. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  39597. key: 0,
  39598. label: _ctx.currentPlaceholder,
  39599. value: _ctx.modelValue
  39600. }, () => [
  39601. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  39602. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  39603. ], 2)) : vue.createCommentVNode("v-if", true)
  39604. ], 2),
  39605. vue.createElementVNode("div", {
  39606. ref: "suffixRef",
  39607. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  39608. }, [
  39609. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  39610. key: 0,
  39611. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  39612. }, {
  39613. default: vue.withCtx(() => [
  39614. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  39615. ]),
  39616. _: 1
  39617. }, 8, ["class"])), [
  39618. [vue.vShow, !_ctx.showClearBtn]
  39619. ]) : vue.createCommentVNode("v-if", true),
  39620. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  39621. key: 1,
  39622. class: vue.normalizeClass([
  39623. _ctx.nsSelect.e("caret"),
  39624. _ctx.nsInput.e("icon"),
  39625. _ctx.nsSelect.e("clear")
  39626. ]),
  39627. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  39628. }, {
  39629. default: vue.withCtx(() => [
  39630. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  39631. ]),
  39632. _: 1
  39633. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  39634. _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  39635. key: 2,
  39636. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  39637. }, {
  39638. default: vue.withCtx(() => [
  39639. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  39640. ]),
  39641. _: 1
  39642. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  39643. ], 2)
  39644. ], 10, ["onClick"])
  39645. ]),
  39646. content: vue.withCtx(() => [
  39647. vue.createVNode(_component_el_select_menu, {
  39648. ref: "menuRef",
  39649. data: _ctx.filteredOptions,
  39650. width: _ctx.popperSize,
  39651. "hovering-index": _ctx.states.hoveringIndex,
  39652. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  39653. }, vue.createSlots({
  39654. default: vue.withCtx((scope) => [
  39655. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  39656. ]),
  39657. _: 2
  39658. }, [
  39659. _ctx.$slots.header ? {
  39660. name: "header",
  39661. fn: vue.withCtx(() => [
  39662. vue.createElementVNode("div", {
  39663. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header"))
  39664. }, [
  39665. vue.renderSlot(_ctx.$slots, "header")
  39666. ], 2)
  39667. ])
  39668. } : void 0,
  39669. _ctx.$slots.loading && _ctx.loading ? {
  39670. name: "loading",
  39671. fn: vue.withCtx(() => [
  39672. vue.createElementVNode("div", {
  39673. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  39674. }, [
  39675. vue.renderSlot(_ctx.$slots, "loading")
  39676. ], 2)
  39677. ])
  39678. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  39679. name: "empty",
  39680. fn: vue.withCtx(() => [
  39681. vue.createElementVNode("div", {
  39682. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  39683. }, [
  39684. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  39685. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  39686. ])
  39687. ], 2)
  39688. ])
  39689. } : void 0,
  39690. _ctx.$slots.footer ? {
  39691. name: "footer",
  39692. fn: vue.withCtx(() => [
  39693. vue.createElementVNode("div", {
  39694. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer"))
  39695. }, [
  39696. vue.renderSlot(_ctx.$slots, "footer")
  39697. ], 2)
  39698. ])
  39699. } : void 0
  39700. ]), 1032, ["data", "width", "hovering-index", "scrollbar-always-on"])
  39701. ]),
  39702. _: 3
  39703. }, 8, ["visible", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "onBeforeShow", "onHide"])
  39704. ], 42, ["onMouseenter", "onMouseleave"])), [
  39705. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  39706. ]);
  39707. }
  39708. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  39709. const ElSelectV2 = withInstall(Select);
  39710. const skeletonProps = buildProps({
  39711. animated: {
  39712. type: Boolean,
  39713. default: false
  39714. },
  39715. count: {
  39716. type: Number,
  39717. default: 1
  39718. },
  39719. rows: {
  39720. type: Number,
  39721. default: 3
  39722. },
  39723. loading: {
  39724. type: Boolean,
  39725. default: true
  39726. },
  39727. throttle: {
  39728. type: Number
  39729. }
  39730. });
  39731. const skeletonItemProps = buildProps({
  39732. variant: {
  39733. type: String,
  39734. values: [
  39735. "circle",
  39736. "rect",
  39737. "h1",
  39738. "h3",
  39739. "text",
  39740. "caption",
  39741. "p",
  39742. "image",
  39743. "button"
  39744. ],
  39745. default: "text"
  39746. }
  39747. });
  39748. const __default__$D = vue.defineComponent({
  39749. name: "ElSkeletonItem"
  39750. });
  39751. const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
  39752. ...__default__$D,
  39753. props: skeletonItemProps,
  39754. setup(__props) {
  39755. const ns = useNamespace("skeleton");
  39756. return (_ctx, _cache) => {
  39757. return vue.openBlock(), vue.createElementBlock("div", {
  39758. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  39759. }, [
  39760. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  39761. ], 2);
  39762. };
  39763. }
  39764. });
  39765. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "skeleton-item.vue"]]);
  39766. const __default__$C = vue.defineComponent({
  39767. name: "ElSkeleton"
  39768. });
  39769. const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
  39770. ...__default__$C,
  39771. props: skeletonProps,
  39772. setup(__props, { expose }) {
  39773. const props = __props;
  39774. const ns = useNamespace("skeleton");
  39775. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  39776. expose({
  39777. uiLoading
  39778. });
  39779. return (_ctx, _cache) => {
  39780. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  39781. key: 0,
  39782. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  39783. }, _ctx.$attrs), [
  39784. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  39785. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  39786. _ctx.loading ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  39787. vue.createVNode(SkeletonItem, {
  39788. class: vue.normalizeClass(vue.unref(ns).is("first")),
  39789. variant: "p"
  39790. }, null, 8, ["class"]),
  39791. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  39792. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  39793. key: item,
  39794. class: vue.normalizeClass([
  39795. vue.unref(ns).e("paragraph"),
  39796. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  39797. ]),
  39798. variant: "p"
  39799. }, null, 8, ["class"]);
  39800. }), 128))
  39801. ]) : vue.createCommentVNode("v-if", true)
  39802. ], 64);
  39803. }), 128))
  39804. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  39805. };
  39806. }
  39807. });
  39808. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "skeleton.vue"]]);
  39809. const ElSkeleton = withInstall(Skeleton, {
  39810. SkeletonItem
  39811. });
  39812. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  39813. const sliderContextKey = Symbol("sliderContextKey");
  39814. const sliderProps = buildProps({
  39815. modelValue: {
  39816. type: definePropType([Number, Array]),
  39817. default: 0
  39818. },
  39819. id: {
  39820. type: String,
  39821. default: void 0
  39822. },
  39823. min: {
  39824. type: Number,
  39825. default: 0
  39826. },
  39827. max: {
  39828. type: Number,
  39829. default: 100
  39830. },
  39831. step: {
  39832. type: Number,
  39833. default: 1
  39834. },
  39835. showInput: Boolean,
  39836. showInputControls: {
  39837. type: Boolean,
  39838. default: true
  39839. },
  39840. size: useSizeProp,
  39841. inputSize: useSizeProp,
  39842. showStops: Boolean,
  39843. showTooltip: {
  39844. type: Boolean,
  39845. default: true
  39846. },
  39847. formatTooltip: {
  39848. type: definePropType(Function),
  39849. default: void 0
  39850. },
  39851. disabled: Boolean,
  39852. range: Boolean,
  39853. vertical: Boolean,
  39854. height: String,
  39855. debounce: {
  39856. type: Number,
  39857. default: 300
  39858. },
  39859. rangeStartLabel: {
  39860. type: String,
  39861. default: void 0
  39862. },
  39863. rangeEndLabel: {
  39864. type: String,
  39865. default: void 0
  39866. },
  39867. formatValueText: {
  39868. type: definePropType(Function),
  39869. default: void 0
  39870. },
  39871. tooltipClass: {
  39872. type: String,
  39873. default: void 0
  39874. },
  39875. placement: {
  39876. type: String,
  39877. values: Ee,
  39878. default: "top"
  39879. },
  39880. marks: {
  39881. type: definePropType(Object)
  39882. },
  39883. validateEvent: {
  39884. type: Boolean,
  39885. default: true
  39886. },
  39887. ...useAriaProps(["ariaLabel"])
  39888. });
  39889. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  39890. const sliderEmits = {
  39891. [UPDATE_MODEL_EVENT]: isValidValue$1,
  39892. [INPUT_EVENT]: isValidValue$1,
  39893. [CHANGE_EVENT]: isValidValue$1
  39894. };
  39895. const useLifecycle = (props, initData, resetSize) => {
  39896. const sliderWrapper = vue.ref();
  39897. vue.onMounted(async () => {
  39898. if (props.range) {
  39899. if (Array.isArray(props.modelValue)) {
  39900. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  39901. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  39902. } else {
  39903. initData.firstValue = props.min;
  39904. initData.secondValue = props.max;
  39905. }
  39906. initData.oldValue = [initData.firstValue, initData.secondValue];
  39907. } else {
  39908. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  39909. initData.firstValue = props.min;
  39910. } else {
  39911. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  39912. }
  39913. initData.oldValue = initData.firstValue;
  39914. }
  39915. useEventListener(window, "resize", resetSize);
  39916. await vue.nextTick();
  39917. resetSize();
  39918. });
  39919. return {
  39920. sliderWrapper
  39921. };
  39922. };
  39923. const useMarks = (props) => {
  39924. return vue.computed(() => {
  39925. if (!props.marks) {
  39926. return [];
  39927. }
  39928. const marksKeys = Object.keys(props.marks);
  39929. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  39930. point,
  39931. position: (point - props.min) * 100 / (props.max - props.min),
  39932. mark: props.marks[point]
  39933. }));
  39934. });
  39935. };
  39936. const useSlide = (props, initData, emit) => {
  39937. const { form: elForm, formItem: elFormItem } = useFormItem();
  39938. const slider = vue.shallowRef();
  39939. const firstButton = vue.ref();
  39940. const secondButton = vue.ref();
  39941. const buttonRefs = {
  39942. firstButton,
  39943. secondButton
  39944. };
  39945. const sliderDisabled = vue.computed(() => {
  39946. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  39947. });
  39948. const minValue = vue.computed(() => {
  39949. return Math.min(initData.firstValue, initData.secondValue);
  39950. });
  39951. const maxValue = vue.computed(() => {
  39952. return Math.max(initData.firstValue, initData.secondValue);
  39953. });
  39954. const barSize = vue.computed(() => {
  39955. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  39956. });
  39957. const barStart = vue.computed(() => {
  39958. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  39959. });
  39960. const runwayStyle = vue.computed(() => {
  39961. return props.vertical ? { height: props.height } : {};
  39962. });
  39963. const barStyle = vue.computed(() => {
  39964. return props.vertical ? {
  39965. height: barSize.value,
  39966. bottom: barStart.value
  39967. } : {
  39968. width: barSize.value,
  39969. left: barStart.value
  39970. };
  39971. });
  39972. const resetSize = () => {
  39973. if (slider.value) {
  39974. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  39975. }
  39976. };
  39977. const getButtonRefByPercent = (percent) => {
  39978. const targetValue = props.min + percent * (props.max - props.min) / 100;
  39979. if (!props.range) {
  39980. return firstButton;
  39981. }
  39982. let buttonRefName;
  39983. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  39984. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  39985. } else {
  39986. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  39987. }
  39988. return buttonRefs[buttonRefName];
  39989. };
  39990. const setPosition = (percent) => {
  39991. const buttonRef = getButtonRefByPercent(percent);
  39992. buttonRef.value.setPosition(percent);
  39993. return buttonRef;
  39994. };
  39995. const setFirstValue = (firstValue) => {
  39996. initData.firstValue = firstValue != null ? firstValue : props.min;
  39997. _emit(props.range ? [minValue.value, maxValue.value] : firstValue != null ? firstValue : props.min);
  39998. };
  39999. const setSecondValue = (secondValue) => {
  40000. initData.secondValue = secondValue;
  40001. if (props.range) {
  40002. _emit([minValue.value, maxValue.value]);
  40003. }
  40004. };
  40005. const _emit = (val) => {
  40006. emit(UPDATE_MODEL_EVENT, val);
  40007. emit(INPUT_EVENT, val);
  40008. };
  40009. const emitChange = async () => {
  40010. await vue.nextTick();
  40011. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  40012. };
  40013. const handleSliderPointerEvent = (event) => {
  40014. var _a, _b, _c, _d, _e, _f;
  40015. if (sliderDisabled.value || initData.dragging)
  40016. return;
  40017. resetSize();
  40018. let newPercent = 0;
  40019. if (props.vertical) {
  40020. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  40021. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  40022. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  40023. } else {
  40024. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  40025. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  40026. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  40027. }
  40028. if (newPercent < 0 || newPercent > 100)
  40029. return;
  40030. return setPosition(newPercent);
  40031. };
  40032. const onSliderWrapperPrevent = (event) => {
  40033. var _a, _b;
  40034. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  40035. event.preventDefault();
  40036. }
  40037. };
  40038. const onSliderDown = async (event) => {
  40039. const buttonRef = handleSliderPointerEvent(event);
  40040. if (buttonRef) {
  40041. await vue.nextTick();
  40042. buttonRef.value.onButtonDown(event);
  40043. }
  40044. };
  40045. const onSliderClick = (event) => {
  40046. const buttonRef = handleSliderPointerEvent(event);
  40047. if (buttonRef) {
  40048. emitChange();
  40049. }
  40050. };
  40051. const onSliderMarkerDown = (position) => {
  40052. if (sliderDisabled.value || initData.dragging)
  40053. return;
  40054. setPosition(position);
  40055. };
  40056. return {
  40057. elFormItem,
  40058. slider,
  40059. firstButton,
  40060. secondButton,
  40061. sliderDisabled,
  40062. minValue,
  40063. maxValue,
  40064. runwayStyle,
  40065. barStyle,
  40066. resetSize,
  40067. setPosition,
  40068. emitChange,
  40069. onSliderWrapperPrevent,
  40070. onSliderClick,
  40071. onSliderDown,
  40072. onSliderMarkerDown,
  40073. setFirstValue,
  40074. setSecondValue
  40075. };
  40076. };
  40077. const { left, down, right, up, home, end, pageUp, pageDown } = EVENT_CODE;
  40078. const useTooltip = (props, formatTooltip, showTooltip) => {
  40079. const tooltip = vue.ref();
  40080. const tooltipVisible = vue.ref(false);
  40081. const enableFormat = vue.computed(() => {
  40082. return formatTooltip.value instanceof Function;
  40083. });
  40084. const formatValue = vue.computed(() => {
  40085. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  40086. });
  40087. const displayTooltip = debounce(() => {
  40088. showTooltip.value && (tooltipVisible.value = true);
  40089. }, 50);
  40090. const hideTooltip = debounce(() => {
  40091. showTooltip.value && (tooltipVisible.value = false);
  40092. }, 50);
  40093. return {
  40094. tooltip,
  40095. tooltipVisible,
  40096. formatValue,
  40097. displayTooltip,
  40098. hideTooltip
  40099. };
  40100. };
  40101. const useSliderButton = (props, initData, emit) => {
  40102. const {
  40103. disabled,
  40104. min,
  40105. max,
  40106. step,
  40107. showTooltip,
  40108. precision,
  40109. sliderSize,
  40110. formatTooltip,
  40111. emitChange,
  40112. resetSize,
  40113. updateDragging
  40114. } = vue.inject(sliderContextKey);
  40115. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  40116. const button = vue.ref();
  40117. const currentPosition = vue.computed(() => {
  40118. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  40119. });
  40120. const wrapperStyle = vue.computed(() => {
  40121. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  40122. });
  40123. const handleMouseEnter = () => {
  40124. initData.hovering = true;
  40125. displayTooltip();
  40126. };
  40127. const handleMouseLeave = () => {
  40128. initData.hovering = false;
  40129. if (!initData.dragging) {
  40130. hideTooltip();
  40131. }
  40132. };
  40133. const onButtonDown = (event) => {
  40134. if (disabled.value)
  40135. return;
  40136. event.preventDefault();
  40137. onDragStart(event);
  40138. window.addEventListener("mousemove", onDragging);
  40139. window.addEventListener("touchmove", onDragging);
  40140. window.addEventListener("mouseup", onDragEnd);
  40141. window.addEventListener("touchend", onDragEnd);
  40142. window.addEventListener("contextmenu", onDragEnd);
  40143. button.value.focus();
  40144. };
  40145. const incrementPosition = (amount) => {
  40146. if (disabled.value)
  40147. return;
  40148. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  40149. setPosition(initData.newPosition);
  40150. emitChange();
  40151. };
  40152. const onLeftKeyDown = () => {
  40153. incrementPosition(-step.value);
  40154. };
  40155. const onRightKeyDown = () => {
  40156. incrementPosition(step.value);
  40157. };
  40158. const onPageDownKeyDown = () => {
  40159. incrementPosition(-step.value * 4);
  40160. };
  40161. const onPageUpKeyDown = () => {
  40162. incrementPosition(step.value * 4);
  40163. };
  40164. const onHomeKeyDown = () => {
  40165. if (disabled.value)
  40166. return;
  40167. setPosition(0);
  40168. emitChange();
  40169. };
  40170. const onEndKeyDown = () => {
  40171. if (disabled.value)
  40172. return;
  40173. setPosition(100);
  40174. emitChange();
  40175. };
  40176. const onKeyDown = (event) => {
  40177. let isPreventDefault = true;
  40178. if ([left, down].includes(event.key)) {
  40179. onLeftKeyDown();
  40180. } else if ([right, up].includes(event.key)) {
  40181. onRightKeyDown();
  40182. } else if (event.key === home) {
  40183. onHomeKeyDown();
  40184. } else if (event.key === end) {
  40185. onEndKeyDown();
  40186. } else if (event.key === pageDown) {
  40187. onPageDownKeyDown();
  40188. } else if (event.key === pageUp) {
  40189. onPageUpKeyDown();
  40190. } else {
  40191. isPreventDefault = false;
  40192. }
  40193. isPreventDefault && event.preventDefault();
  40194. };
  40195. const getClientXY = (event) => {
  40196. let clientX;
  40197. let clientY;
  40198. if (event.type.startsWith("touch")) {
  40199. clientY = event.touches[0].clientY;
  40200. clientX = event.touches[0].clientX;
  40201. } else {
  40202. clientY = event.clientY;
  40203. clientX = event.clientX;
  40204. }
  40205. return {
  40206. clientX,
  40207. clientY
  40208. };
  40209. };
  40210. const onDragStart = (event) => {
  40211. initData.dragging = true;
  40212. initData.isClick = true;
  40213. const { clientX, clientY } = getClientXY(event);
  40214. if (props.vertical) {
  40215. initData.startY = clientY;
  40216. } else {
  40217. initData.startX = clientX;
  40218. }
  40219. initData.startPosition = Number.parseFloat(currentPosition.value);
  40220. initData.newPosition = initData.startPosition;
  40221. };
  40222. const onDragging = (event) => {
  40223. if (initData.dragging) {
  40224. initData.isClick = false;
  40225. displayTooltip();
  40226. resetSize();
  40227. let diff;
  40228. const { clientX, clientY } = getClientXY(event);
  40229. if (props.vertical) {
  40230. initData.currentY = clientY;
  40231. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  40232. } else {
  40233. initData.currentX = clientX;
  40234. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  40235. }
  40236. initData.newPosition = initData.startPosition + diff;
  40237. setPosition(initData.newPosition);
  40238. }
  40239. };
  40240. const onDragEnd = () => {
  40241. if (initData.dragging) {
  40242. setTimeout(() => {
  40243. initData.dragging = false;
  40244. if (!initData.hovering) {
  40245. hideTooltip();
  40246. }
  40247. if (!initData.isClick) {
  40248. setPosition(initData.newPosition);
  40249. }
  40250. emitChange();
  40251. }, 0);
  40252. window.removeEventListener("mousemove", onDragging);
  40253. window.removeEventListener("touchmove", onDragging);
  40254. window.removeEventListener("mouseup", onDragEnd);
  40255. window.removeEventListener("touchend", onDragEnd);
  40256. window.removeEventListener("contextmenu", onDragEnd);
  40257. }
  40258. };
  40259. const setPosition = async (newPosition) => {
  40260. if (newPosition === null || Number.isNaN(+newPosition))
  40261. return;
  40262. if (newPosition < 0) {
  40263. newPosition = 0;
  40264. } else if (newPosition > 100) {
  40265. newPosition = 100;
  40266. }
  40267. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  40268. const steps = Math.round(newPosition / lengthPerStep);
  40269. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  40270. value = Number.parseFloat(value.toFixed(precision.value));
  40271. if (value !== props.modelValue) {
  40272. emit(UPDATE_MODEL_EVENT, value);
  40273. }
  40274. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  40275. initData.oldValue = props.modelValue;
  40276. }
  40277. await vue.nextTick();
  40278. initData.dragging && displayTooltip();
  40279. tooltip.value.updatePopper();
  40280. };
  40281. vue.watch(() => initData.dragging, (val) => {
  40282. updateDragging(val);
  40283. });
  40284. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  40285. return {
  40286. disabled,
  40287. button,
  40288. tooltip,
  40289. tooltipVisible,
  40290. showTooltip,
  40291. wrapperStyle,
  40292. formatValue,
  40293. handleMouseEnter,
  40294. handleMouseLeave,
  40295. onButtonDown,
  40296. onKeyDown,
  40297. setPosition
  40298. };
  40299. };
  40300. const useStops = (props, initData, minValue, maxValue) => {
  40301. const stops = vue.computed(() => {
  40302. if (!props.showStops || props.min > props.max)
  40303. return [];
  40304. if (props.step === 0) {
  40305. return [];
  40306. }
  40307. const stopCount = (props.max - props.min) / props.step;
  40308. const stepWidth = 100 * props.step / (props.max - props.min);
  40309. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  40310. if (props.range) {
  40311. return result.filter((step) => {
  40312. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  40313. });
  40314. } else {
  40315. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  40316. }
  40317. });
  40318. const getStopStyle = (position) => {
  40319. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  40320. };
  40321. return {
  40322. stops,
  40323. getStopStyle
  40324. };
  40325. };
  40326. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  40327. const _emit = (val) => {
  40328. emit(UPDATE_MODEL_EVENT, val);
  40329. emit(INPUT_EVENT, val);
  40330. };
  40331. const valueChanged = () => {
  40332. if (props.range) {
  40333. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  40334. } else {
  40335. return props.modelValue !== initData.oldValue;
  40336. }
  40337. };
  40338. const setValues = () => {
  40339. var _a, _b;
  40340. if (props.min > props.max) {
  40341. throwError("Slider", "min should not be greater than max.");
  40342. }
  40343. const val = props.modelValue;
  40344. if (props.range && Array.isArray(val)) {
  40345. if (val[1] < props.min) {
  40346. _emit([props.min, props.min]);
  40347. } else if (val[0] > props.max) {
  40348. _emit([props.max, props.max]);
  40349. } else if (val[0] < props.min) {
  40350. _emit([props.min, val[1]]);
  40351. } else if (val[1] > props.max) {
  40352. _emit([val[0], props.max]);
  40353. } else {
  40354. initData.firstValue = val[0];
  40355. initData.secondValue = val[1];
  40356. if (valueChanged()) {
  40357. if (props.validateEvent) {
  40358. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  40359. }
  40360. initData.oldValue = val.slice();
  40361. }
  40362. }
  40363. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  40364. if (val < props.min) {
  40365. _emit(props.min);
  40366. } else if (val > props.max) {
  40367. _emit(props.max);
  40368. } else {
  40369. initData.firstValue = val;
  40370. if (valueChanged()) {
  40371. if (props.validateEvent) {
  40372. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  40373. }
  40374. initData.oldValue = val;
  40375. }
  40376. }
  40377. }
  40378. };
  40379. setValues();
  40380. vue.watch(() => initData.dragging, (val) => {
  40381. if (!val) {
  40382. setValues();
  40383. }
  40384. });
  40385. vue.watch(() => props.modelValue, (val, oldVal) => {
  40386. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  40387. return;
  40388. }
  40389. setValues();
  40390. }, {
  40391. deep: true
  40392. });
  40393. vue.watch(() => [props.min, props.max], () => {
  40394. setValues();
  40395. });
  40396. };
  40397. const sliderButtonProps = buildProps({
  40398. modelValue: {
  40399. type: Number,
  40400. default: 0
  40401. },
  40402. vertical: Boolean,
  40403. tooltipClass: String,
  40404. placement: {
  40405. type: String,
  40406. values: Ee,
  40407. default: "top"
  40408. }
  40409. });
  40410. const sliderButtonEmits = {
  40411. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  40412. };
  40413. const __default__$B = vue.defineComponent({
  40414. name: "ElSliderButton"
  40415. });
  40416. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  40417. ...__default__$B,
  40418. props: sliderButtonProps,
  40419. emits: sliderButtonEmits,
  40420. setup(__props, { expose, emit }) {
  40421. const props = __props;
  40422. const ns = useNamespace("slider");
  40423. const initData = vue.reactive({
  40424. hovering: false,
  40425. dragging: false,
  40426. isClick: false,
  40427. startX: 0,
  40428. currentX: 0,
  40429. startY: 0,
  40430. currentY: 0,
  40431. startPosition: 0,
  40432. newPosition: 0,
  40433. oldValue: props.modelValue
  40434. });
  40435. const {
  40436. disabled,
  40437. button,
  40438. tooltip,
  40439. showTooltip,
  40440. tooltipVisible,
  40441. wrapperStyle,
  40442. formatValue,
  40443. handleMouseEnter,
  40444. handleMouseLeave,
  40445. onButtonDown,
  40446. onKeyDown,
  40447. setPosition
  40448. } = useSliderButton(props, initData, emit);
  40449. const { hovering, dragging } = vue.toRefs(initData);
  40450. expose({
  40451. onButtonDown,
  40452. onKeyDown,
  40453. setPosition,
  40454. hovering,
  40455. dragging
  40456. });
  40457. return (_ctx, _cache) => {
  40458. return vue.openBlock(), vue.createElementBlock("div", {
  40459. ref_key: "button",
  40460. ref: button,
  40461. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  40462. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  40463. tabindex: vue.unref(disabled) ? -1 : 0,
  40464. onMouseenter: vue.unref(handleMouseEnter),
  40465. onMouseleave: vue.unref(handleMouseLeave),
  40466. onMousedown: vue.unref(onButtonDown),
  40467. onFocus: vue.unref(handleMouseEnter),
  40468. onBlur: vue.unref(handleMouseLeave),
  40469. onKeydown: vue.unref(onKeyDown)
  40470. }, [
  40471. vue.createVNode(vue.unref(ElTooltip), {
  40472. ref_key: "tooltip",
  40473. ref: tooltip,
  40474. visible: vue.unref(tooltipVisible),
  40475. placement: _ctx.placement,
  40476. "fallback-placements": ["top", "bottom", "right", "left"],
  40477. "stop-popper-mouse-event": false,
  40478. "popper-class": _ctx.tooltipClass,
  40479. disabled: !vue.unref(showTooltip),
  40480. persistent: ""
  40481. }, {
  40482. content: vue.withCtx(() => [
  40483. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  40484. ]),
  40485. default: vue.withCtx(() => [
  40486. vue.createElementVNode("div", {
  40487. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  40488. }, null, 2)
  40489. ]),
  40490. _: 1
  40491. }, 8, ["visible", "placement", "popper-class", "disabled"])
  40492. ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]);
  40493. };
  40494. }
  40495. });
  40496. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "button.vue"]]);
  40497. const sliderMarkerProps = buildProps({
  40498. mark: {
  40499. type: definePropType([String, Object]),
  40500. default: void 0
  40501. }
  40502. });
  40503. var SliderMarker = vue.defineComponent({
  40504. name: "ElSliderMarker",
  40505. props: sliderMarkerProps,
  40506. setup(props) {
  40507. const ns = useNamespace("slider");
  40508. const label = vue.computed(() => {
  40509. return isString$1(props.mark) ? props.mark : props.mark.label;
  40510. });
  40511. const style = vue.computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  40512. return () => vue.h("div", {
  40513. class: ns.e("marks-text"),
  40514. style: style.value
  40515. }, label.value);
  40516. }
  40517. });
  40518. const __default__$A = vue.defineComponent({
  40519. name: "ElSlider"
  40520. });
  40521. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  40522. ...__default__$A,
  40523. props: sliderProps,
  40524. emits: sliderEmits,
  40525. setup(__props, { expose, emit }) {
  40526. const props = __props;
  40527. const ns = useNamespace("slider");
  40528. const { t } = useLocale();
  40529. const initData = vue.reactive({
  40530. firstValue: 0,
  40531. secondValue: 0,
  40532. oldValue: 0,
  40533. dragging: false,
  40534. sliderSize: 1
  40535. });
  40536. const {
  40537. elFormItem,
  40538. slider,
  40539. firstButton,
  40540. secondButton,
  40541. sliderDisabled,
  40542. minValue,
  40543. maxValue,
  40544. runwayStyle,
  40545. barStyle,
  40546. resetSize,
  40547. emitChange,
  40548. onSliderWrapperPrevent,
  40549. onSliderClick,
  40550. onSliderDown,
  40551. onSliderMarkerDown,
  40552. setFirstValue,
  40553. setSecondValue
  40554. } = useSlide(props, initData, emit);
  40555. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  40556. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  40557. formItemContext: elFormItem
  40558. });
  40559. const sliderWrapperSize = useFormSize();
  40560. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  40561. const groupLabel = vue.computed(() => {
  40562. return props.ariaLabel || t("el.slider.defaultLabel", {
  40563. min: props.min,
  40564. max: props.max
  40565. });
  40566. });
  40567. const firstButtonLabel = vue.computed(() => {
  40568. if (props.range) {
  40569. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  40570. } else {
  40571. return groupLabel.value;
  40572. }
  40573. });
  40574. const firstValueText = vue.computed(() => {
  40575. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  40576. });
  40577. const secondButtonLabel = vue.computed(() => {
  40578. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  40579. });
  40580. const secondValueText = vue.computed(() => {
  40581. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  40582. });
  40583. const sliderKls = vue.computed(() => [
  40584. ns.b(),
  40585. ns.m(sliderWrapperSize.value),
  40586. ns.is("vertical", props.vertical),
  40587. { [ns.m("with-input")]: props.showInput }
  40588. ]);
  40589. const markList = useMarks(props);
  40590. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  40591. const precision = vue.computed(() => {
  40592. const precisions = [props.min, props.max, props.step].map((item) => {
  40593. const decimal = `${item}`.split(".")[1];
  40594. return decimal ? decimal.length : 0;
  40595. });
  40596. return Math.max.apply(null, precisions);
  40597. });
  40598. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  40599. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  40600. const updateDragging = (val) => {
  40601. initData.dragging = val;
  40602. };
  40603. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, {
  40604. passive: false
  40605. });
  40606. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, {
  40607. passive: false
  40608. });
  40609. vue.provide(sliderContextKey, {
  40610. ...vue.toRefs(props),
  40611. sliderSize,
  40612. disabled: sliderDisabled,
  40613. precision,
  40614. emitChange,
  40615. resetSize,
  40616. updateDragging
  40617. });
  40618. expose({
  40619. onSliderClick
  40620. });
  40621. return (_ctx, _cache) => {
  40622. var _a, _b;
  40623. return vue.openBlock(), vue.createElementBlock("div", {
  40624. id: _ctx.range ? vue.unref(inputId) : void 0,
  40625. ref_key: "sliderWrapper",
  40626. ref: sliderWrapper,
  40627. class: vue.normalizeClass(vue.unref(sliderKls)),
  40628. role: _ctx.range ? "group" : void 0,
  40629. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  40630. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0
  40631. }, [
  40632. vue.createElementVNode("div", {
  40633. ref_key: "slider",
  40634. ref: slider,
  40635. class: vue.normalizeClass([
  40636. vue.unref(ns).e("runway"),
  40637. { "show-input": _ctx.showInput && !_ctx.range },
  40638. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  40639. ]),
  40640. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  40641. onMousedown: vue.unref(onSliderDown),
  40642. onTouchstartPassive: vue.unref(onSliderDown)
  40643. }, [
  40644. vue.createElementVNode("div", {
  40645. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  40646. style: vue.normalizeStyle(vue.unref(barStyle))
  40647. }, null, 6),
  40648. vue.createVNode(SliderButton, {
  40649. id: !_ctx.range ? vue.unref(inputId) : void 0,
  40650. ref_key: "firstButton",
  40651. ref: firstButton,
  40652. "model-value": vue.unref(firstValue),
  40653. vertical: _ctx.vertical,
  40654. "tooltip-class": _ctx.tooltipClass,
  40655. placement: _ctx.placement,
  40656. role: "slider",
  40657. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  40658. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  40659. "aria-valuemin": _ctx.min,
  40660. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  40661. "aria-valuenow": vue.unref(firstValue),
  40662. "aria-valuetext": vue.unref(firstValueText),
  40663. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  40664. "aria-disabled": vue.unref(sliderDisabled),
  40665. "onUpdate:modelValue": vue.unref(setFirstValue)
  40666. }, 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"]),
  40667. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  40668. key: 0,
  40669. ref_key: "secondButton",
  40670. ref: secondButton,
  40671. "model-value": vue.unref(secondValue),
  40672. vertical: _ctx.vertical,
  40673. "tooltip-class": _ctx.tooltipClass,
  40674. placement: _ctx.placement,
  40675. role: "slider",
  40676. "aria-label": vue.unref(secondButtonLabel),
  40677. "aria-valuemin": vue.unref(firstValue),
  40678. "aria-valuemax": _ctx.max,
  40679. "aria-valuenow": vue.unref(secondValue),
  40680. "aria-valuetext": vue.unref(secondValueText),
  40681. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  40682. "aria-disabled": vue.unref(sliderDisabled),
  40683. "onUpdate:modelValue": vue.unref(setSecondValue)
  40684. }, 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),
  40685. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", { key: 1 }, [
  40686. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  40687. return vue.openBlock(), vue.createElementBlock("div", {
  40688. key,
  40689. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  40690. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  40691. }, null, 6);
  40692. }), 128))
  40693. ])) : vue.createCommentVNode("v-if", true),
  40694. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  40695. vue.createElementVNode("div", null, [
  40696. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  40697. return vue.openBlock(), vue.createElementBlock("div", {
  40698. key,
  40699. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  40700. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  40701. }, null, 6);
  40702. }), 128))
  40703. ]),
  40704. vue.createElementVNode("div", {
  40705. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  40706. }, [
  40707. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  40708. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  40709. key,
  40710. mark: item.mark,
  40711. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  40712. onMousedown: vue.withModifiers(($event) => vue.unref(onSliderMarkerDown)(item.position), ["stop"])
  40713. }, null, 8, ["mark", "style", "onMousedown"]);
  40714. }), 128))
  40715. ], 2)
  40716. ], 64)) : vue.createCommentVNode("v-if", true)
  40717. ], 46, ["onMousedown", "onTouchstartPassive"]),
  40718. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  40719. key: 0,
  40720. ref: "input",
  40721. "model-value": vue.unref(firstValue),
  40722. class: vue.normalizeClass(vue.unref(ns).e("input")),
  40723. step: _ctx.step,
  40724. disabled: vue.unref(sliderDisabled),
  40725. controls: _ctx.showInputControls,
  40726. min: _ctx.min,
  40727. max: _ctx.max,
  40728. precision: vue.unref(precision),
  40729. debounce: _ctx.debounce,
  40730. size: vue.unref(sliderInputSize),
  40731. "onUpdate:modelValue": vue.unref(setFirstValue),
  40732. onChange: vue.unref(emitChange)
  40733. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  40734. ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
  40735. };
  40736. }
  40737. });
  40738. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "slider.vue"]]);
  40739. const ElSlider = withInstall(Slider);
  40740. const spaceItemProps = buildProps({
  40741. prefixCls: {
  40742. type: String
  40743. }
  40744. });
  40745. const SpaceItem = vue.defineComponent({
  40746. name: "ElSpaceItem",
  40747. props: spaceItemProps,
  40748. setup(props, { slots }) {
  40749. const ns = useNamespace("space");
  40750. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  40751. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  40752. }
  40753. });
  40754. const SIZE_MAP = {
  40755. small: 8,
  40756. default: 12,
  40757. large: 16
  40758. };
  40759. function useSpace(props) {
  40760. const ns = useNamespace("space");
  40761. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  40762. const horizontalSize = vue.ref(0);
  40763. const verticalSize = vue.ref(0);
  40764. const containerStyle = vue.computed(() => {
  40765. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  40766. const alignment = {
  40767. alignItems: props.alignment
  40768. };
  40769. const gap = {
  40770. rowGap: `${verticalSize.value}px`,
  40771. columnGap: `${horizontalSize.value}px`
  40772. };
  40773. return [wrapKls, alignment, gap, props.style];
  40774. });
  40775. const itemStyle = vue.computed(() => {
  40776. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  40777. });
  40778. vue.watchEffect(() => {
  40779. const { size = "small", wrap, direction: dir, fill } = props;
  40780. if (isArray$1(size)) {
  40781. const [h = 0, v = 0] = size;
  40782. horizontalSize.value = h;
  40783. verticalSize.value = v;
  40784. } else {
  40785. let val;
  40786. if (isNumber(size)) {
  40787. val = size;
  40788. } else {
  40789. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  40790. }
  40791. if ((wrap || fill) && dir === "horizontal") {
  40792. horizontalSize.value = verticalSize.value = val;
  40793. } else {
  40794. if (dir === "horizontal") {
  40795. horizontalSize.value = val;
  40796. verticalSize.value = 0;
  40797. } else {
  40798. verticalSize.value = val;
  40799. horizontalSize.value = 0;
  40800. }
  40801. }
  40802. }
  40803. });
  40804. return {
  40805. classes,
  40806. containerStyle,
  40807. itemStyle
  40808. };
  40809. }
  40810. const spaceProps = buildProps({
  40811. direction: {
  40812. type: String,
  40813. values: ["horizontal", "vertical"],
  40814. default: "horizontal"
  40815. },
  40816. class: {
  40817. type: definePropType([
  40818. String,
  40819. Object,
  40820. Array
  40821. ]),
  40822. default: ""
  40823. },
  40824. style: {
  40825. type: definePropType([String, Array, Object]),
  40826. default: ""
  40827. },
  40828. alignment: {
  40829. type: definePropType(String),
  40830. default: "center"
  40831. },
  40832. prefixCls: {
  40833. type: String
  40834. },
  40835. spacer: {
  40836. type: definePropType([Object, String, Number, Array]),
  40837. default: null,
  40838. validator: (val) => vue.isVNode(val) || isNumber(val) || isString$1(val)
  40839. },
  40840. wrap: Boolean,
  40841. fill: Boolean,
  40842. fillRatio: {
  40843. type: Number,
  40844. default: 100
  40845. },
  40846. size: {
  40847. type: [String, Array, Number],
  40848. values: componentSizes,
  40849. validator: (val) => {
  40850. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  40851. }
  40852. }
  40853. });
  40854. const Space = vue.defineComponent({
  40855. name: "ElSpace",
  40856. props: spaceProps,
  40857. setup(props, { slots }) {
  40858. const { classes, containerStyle, itemStyle } = useSpace(props);
  40859. function extractChildren(children, parentKey = "", extractedChildren = []) {
  40860. const { prefixCls } = props;
  40861. children.forEach((child, loopKey) => {
  40862. if (isFragment(child)) {
  40863. if (isArray$1(child.children)) {
  40864. child.children.forEach((nested, key) => {
  40865. if (isFragment(nested) && isArray$1(nested.children)) {
  40866. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  40867. } else {
  40868. extractedChildren.push(vue.createVNode(SpaceItem, {
  40869. style: itemStyle.value,
  40870. prefixCls,
  40871. key: `nested-${parentKey + key}`
  40872. }, {
  40873. default: () => [nested]
  40874. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  40875. }
  40876. });
  40877. }
  40878. } else if (isValidElementNode(child)) {
  40879. extractedChildren.push(vue.createVNode(SpaceItem, {
  40880. style: itemStyle.value,
  40881. prefixCls,
  40882. key: `LoopKey${parentKey + loopKey}`
  40883. }, {
  40884. default: () => [child]
  40885. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  40886. }
  40887. });
  40888. return extractedChildren;
  40889. }
  40890. return () => {
  40891. var _a;
  40892. const { spacer, direction } = props;
  40893. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  40894. if (((_a = children.children) != null ? _a : []).length === 0)
  40895. return null;
  40896. if (isArray$1(children.children)) {
  40897. let extractedChildren = extractChildren(children.children);
  40898. if (spacer) {
  40899. const len = extractedChildren.length - 1;
  40900. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  40901. const children2 = [...acc, child];
  40902. if (idx !== len) {
  40903. children2.push(vue.createVNode("span", {
  40904. style: [
  40905. itemStyle.value,
  40906. direction === "vertical" ? "width: 100%" : null
  40907. ],
  40908. key: idx
  40909. }, [
  40910. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  40911. ], PatchFlags.STYLE));
  40912. }
  40913. return children2;
  40914. }, []);
  40915. }
  40916. return vue.createVNode("div", {
  40917. class: classes.value,
  40918. style: containerStyle.value
  40919. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  40920. }
  40921. return children.children;
  40922. };
  40923. }
  40924. });
  40925. const ElSpace = withInstall(Space);
  40926. const statisticProps = buildProps({
  40927. decimalSeparator: {
  40928. type: String,
  40929. default: "."
  40930. },
  40931. groupSeparator: {
  40932. type: String,
  40933. default: ","
  40934. },
  40935. precision: {
  40936. type: Number,
  40937. default: 0
  40938. },
  40939. formatter: Function,
  40940. value: {
  40941. type: definePropType([Number, Object]),
  40942. default: 0
  40943. },
  40944. prefix: String,
  40945. suffix: String,
  40946. title: String,
  40947. valueStyle: {
  40948. type: definePropType([String, Object, Array])
  40949. }
  40950. });
  40951. const __default__$z = vue.defineComponent({
  40952. name: "ElStatistic"
  40953. });
  40954. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  40955. ...__default__$z,
  40956. props: statisticProps,
  40957. setup(__props, { expose }) {
  40958. const props = __props;
  40959. const ns = useNamespace("statistic");
  40960. const displayValue = vue.computed(() => {
  40961. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  40962. if (isFunction$1(formatter))
  40963. return formatter(value);
  40964. if (!isNumber(value) || Number.isNaN(value))
  40965. return value;
  40966. let [integer, decimal = ""] = String(value).split(".");
  40967. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  40968. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  40969. return [integer, decimal].join(decimal ? decimalSeparator : "");
  40970. });
  40971. expose({
  40972. displayValue
  40973. });
  40974. return (_ctx, _cache) => {
  40975. return vue.openBlock(), vue.createElementBlock("div", {
  40976. class: vue.normalizeClass(vue.unref(ns).b())
  40977. }, [
  40978. _ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  40979. key: 0,
  40980. class: vue.normalizeClass(vue.unref(ns).e("head"))
  40981. }, [
  40982. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  40983. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  40984. ])
  40985. ], 2)) : vue.createCommentVNode("v-if", true),
  40986. vue.createElementVNode("div", {
  40987. class: vue.normalizeClass(vue.unref(ns).e("content"))
  40988. }, [
  40989. _ctx.$slots.prefix || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  40990. key: 0,
  40991. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  40992. }, [
  40993. vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
  40994. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.prefix), 1)
  40995. ])
  40996. ], 2)) : vue.createCommentVNode("v-if", true),
  40997. vue.createElementVNode("span", {
  40998. class: vue.normalizeClass(vue.unref(ns).e("number")),
  40999. style: vue.normalizeStyle(_ctx.valueStyle)
  41000. }, vue.toDisplayString(vue.unref(displayValue)), 7),
  41001. _ctx.$slots.suffix || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("div", {
  41002. key: 1,
  41003. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  41004. }, [
  41005. vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
  41006. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.suffix), 1)
  41007. ])
  41008. ], 2)) : vue.createCommentVNode("v-if", true)
  41009. ], 2)
  41010. ], 2);
  41011. };
  41012. }
  41013. });
  41014. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "statistic.vue"]]);
  41015. const ElStatistic = withInstall(Statistic);
  41016. const countdownProps = buildProps({
  41017. format: {
  41018. type: String,
  41019. default: "HH:mm:ss"
  41020. },
  41021. prefix: String,
  41022. suffix: String,
  41023. title: String,
  41024. value: {
  41025. type: definePropType([Number, Object]),
  41026. default: 0
  41027. },
  41028. valueStyle: {
  41029. type: definePropType([String, Object, Array])
  41030. }
  41031. });
  41032. const countdownEmits = {
  41033. finish: () => true,
  41034. [CHANGE_EVENT]: (value) => isNumber(value)
  41035. };
  41036. const timeUnits = [
  41037. ["Y", 1e3 * 60 * 60 * 24 * 365],
  41038. ["M", 1e3 * 60 * 60 * 24 * 30],
  41039. ["D", 1e3 * 60 * 60 * 24],
  41040. ["H", 1e3 * 60 * 60],
  41041. ["m", 1e3 * 60],
  41042. ["s", 1e3],
  41043. ["S", 1]
  41044. ];
  41045. const getTime = (value) => {
  41046. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  41047. };
  41048. const formatTime$1 = (timestamp, format) => {
  41049. let timeLeft = timestamp;
  41050. const escapeRegex = /\[([^\]]*)]/g;
  41051. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  41052. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  41053. if (replaceRegex.test(current)) {
  41054. const value = Math.floor(timeLeft / unit);
  41055. timeLeft -= value * unit;
  41056. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  41057. }
  41058. return current;
  41059. }, format);
  41060. return replacedText.replace(escapeRegex, "$1");
  41061. };
  41062. const __default__$y = vue.defineComponent({
  41063. name: "ElCountdown"
  41064. });
  41065. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  41066. ...__default__$y,
  41067. props: countdownProps,
  41068. emits: countdownEmits,
  41069. setup(__props, { expose, emit }) {
  41070. const props = __props;
  41071. let timer;
  41072. const rawValue = vue.ref(0);
  41073. const displayValue = vue.computed(() => formatTime$1(rawValue.value, props.format));
  41074. const formatter = (val) => formatTime$1(val, props.format);
  41075. const stopTimer = () => {
  41076. if (timer) {
  41077. cAF(timer);
  41078. timer = void 0;
  41079. }
  41080. };
  41081. const startTimer = () => {
  41082. const timestamp = getTime(props.value);
  41083. const frameFunc = () => {
  41084. let diff = timestamp - Date.now();
  41085. emit("change", diff);
  41086. if (diff <= 0) {
  41087. diff = 0;
  41088. stopTimer();
  41089. emit("finish");
  41090. } else {
  41091. timer = rAF(frameFunc);
  41092. }
  41093. rawValue.value = diff;
  41094. };
  41095. timer = rAF(frameFunc);
  41096. };
  41097. vue.onMounted(() => {
  41098. rawValue.value = getTime(props.value) - Date.now();
  41099. vue.watch(() => [props.value, props.format], () => {
  41100. stopTimer();
  41101. startTimer();
  41102. }, {
  41103. immediate: true
  41104. });
  41105. });
  41106. vue.onBeforeUnmount(() => {
  41107. stopTimer();
  41108. });
  41109. expose({
  41110. displayValue
  41111. });
  41112. return (_ctx, _cache) => {
  41113. return vue.openBlock(), vue.createBlock(vue.unref(ElStatistic), {
  41114. value: rawValue.value,
  41115. title: _ctx.title,
  41116. prefix: _ctx.prefix,
  41117. suffix: _ctx.suffix,
  41118. "value-style": _ctx.valueStyle,
  41119. formatter
  41120. }, vue.createSlots({ _: 2 }, [
  41121. vue.renderList(_ctx.$slots, (_, name) => {
  41122. return {
  41123. name,
  41124. fn: vue.withCtx(() => [
  41125. vue.renderSlot(_ctx.$slots, name)
  41126. ])
  41127. };
  41128. })
  41129. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  41130. };
  41131. }
  41132. });
  41133. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "countdown.vue"]]);
  41134. const ElCountdown = withInstall(Countdown);
  41135. const stepsProps = buildProps({
  41136. space: {
  41137. type: [Number, String],
  41138. default: ""
  41139. },
  41140. active: {
  41141. type: Number,
  41142. default: 0
  41143. },
  41144. direction: {
  41145. type: String,
  41146. default: "horizontal",
  41147. values: ["horizontal", "vertical"]
  41148. },
  41149. alignCenter: {
  41150. type: Boolean
  41151. },
  41152. simple: {
  41153. type: Boolean
  41154. },
  41155. finishStatus: {
  41156. type: String,
  41157. values: ["wait", "process", "finish", "error", "success"],
  41158. default: "finish"
  41159. },
  41160. processStatus: {
  41161. type: String,
  41162. values: ["wait", "process", "finish", "error", "success"],
  41163. default: "process"
  41164. }
  41165. });
  41166. const stepsEmits = {
  41167. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  41168. };
  41169. const __default__$x = vue.defineComponent({
  41170. name: "ElSteps"
  41171. });
  41172. const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
  41173. ...__default__$x,
  41174. props: stepsProps,
  41175. emits: stepsEmits,
  41176. setup(__props, { emit }) {
  41177. const props = __props;
  41178. const ns = useNamespace("steps");
  41179. const {
  41180. children: steps,
  41181. addChild: addStep,
  41182. removeChild: removeStep
  41183. } = useOrderedChildren(vue.getCurrentInstance(), "ElStep");
  41184. vue.watch(steps, () => {
  41185. steps.value.forEach((instance, index) => {
  41186. instance.setIndex(index);
  41187. });
  41188. });
  41189. vue.provide("ElSteps", { props, steps, addStep, removeStep });
  41190. vue.watch(() => props.active, (newVal, oldVal) => {
  41191. emit(CHANGE_EVENT, newVal, oldVal);
  41192. });
  41193. return (_ctx, _cache) => {
  41194. return vue.openBlock(), vue.createElementBlock("div", {
  41195. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  41196. }, [
  41197. vue.renderSlot(_ctx.$slots, "default")
  41198. ], 2);
  41199. };
  41200. }
  41201. });
  41202. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "steps.vue"]]);
  41203. const stepProps = buildProps({
  41204. title: {
  41205. type: String,
  41206. default: ""
  41207. },
  41208. icon: {
  41209. type: iconPropType
  41210. },
  41211. description: {
  41212. type: String,
  41213. default: ""
  41214. },
  41215. status: {
  41216. type: String,
  41217. values: ["", "wait", "process", "finish", "error", "success"],
  41218. default: ""
  41219. }
  41220. });
  41221. const __default__$w = vue.defineComponent({
  41222. name: "ElStep"
  41223. });
  41224. const _sfc_main$D = vue.defineComponent({
  41225. ...__default__$w,
  41226. props: stepProps,
  41227. setup(__props) {
  41228. const props = __props;
  41229. const ns = useNamespace("step");
  41230. const index = vue.ref(-1);
  41231. const lineStyle = vue.ref({});
  41232. const internalStatus = vue.ref("");
  41233. const parent = vue.inject("ElSteps");
  41234. const currentInstance = vue.getCurrentInstance();
  41235. vue.onMounted(() => {
  41236. vue.watch([
  41237. () => parent.props.active,
  41238. () => parent.props.processStatus,
  41239. () => parent.props.finishStatus
  41240. ], ([active]) => {
  41241. updateStatus(active);
  41242. }, { immediate: true });
  41243. });
  41244. vue.onBeforeUnmount(() => {
  41245. parent.removeStep(stepItemState.uid);
  41246. });
  41247. const currentStatus = vue.computed(() => {
  41248. return props.status || internalStatus.value;
  41249. });
  41250. const prevStatus = vue.computed(() => {
  41251. const prevStep = parent.steps.value[index.value - 1];
  41252. return prevStep ? prevStep.currentStatus : "wait";
  41253. });
  41254. const isCenter = vue.computed(() => {
  41255. return parent.props.alignCenter;
  41256. });
  41257. const isVertical = vue.computed(() => {
  41258. return parent.props.direction === "vertical";
  41259. });
  41260. const isSimple = vue.computed(() => {
  41261. return parent.props.simple;
  41262. });
  41263. const stepsCount = vue.computed(() => {
  41264. return parent.steps.value.length;
  41265. });
  41266. const isLast = vue.computed(() => {
  41267. var _a;
  41268. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  41269. });
  41270. const space = vue.computed(() => {
  41271. return isSimple.value ? "" : parent.props.space;
  41272. });
  41273. const containerKls = vue.computed(() => {
  41274. return [
  41275. ns.b(),
  41276. ns.is(isSimple.value ? "simple" : parent.props.direction),
  41277. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  41278. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  41279. ];
  41280. });
  41281. const style = vue.computed(() => {
  41282. const style2 = {
  41283. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  41284. };
  41285. if (isVertical.value)
  41286. return style2;
  41287. if (isLast.value) {
  41288. style2.maxWidth = `${100 / stepsCount.value}%`;
  41289. }
  41290. return style2;
  41291. });
  41292. const setIndex = (val) => {
  41293. index.value = val;
  41294. };
  41295. const calcProgress = (status) => {
  41296. const isWait = status === "wait";
  41297. const style2 = {
  41298. transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
  41299. };
  41300. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  41301. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  41302. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  41303. lineStyle.value = style2;
  41304. };
  41305. const updateStatus = (activeIndex) => {
  41306. if (activeIndex > index.value) {
  41307. internalStatus.value = parent.props.finishStatus;
  41308. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  41309. internalStatus.value = parent.props.processStatus;
  41310. } else {
  41311. internalStatus.value = "wait";
  41312. }
  41313. const prevChild = parent.steps.value[index.value - 1];
  41314. if (prevChild)
  41315. prevChild.calcProgress(internalStatus.value);
  41316. };
  41317. const stepItemState = vue.reactive({
  41318. uid: currentInstance.uid,
  41319. currentStatus,
  41320. setIndex,
  41321. calcProgress
  41322. });
  41323. parent.addStep(stepItemState);
  41324. return (_ctx, _cache) => {
  41325. return vue.openBlock(), vue.createElementBlock("div", {
  41326. style: vue.normalizeStyle(vue.unref(style)),
  41327. class: vue.normalizeClass(vue.unref(containerKls))
  41328. }, [
  41329. vue.createCommentVNode(" icon & line "),
  41330. vue.createElementVNode("div", {
  41331. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  41332. }, [
  41333. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  41334. key: 0,
  41335. class: vue.normalizeClass(vue.unref(ns).e("line"))
  41336. }, [
  41337. vue.createElementVNode("i", {
  41338. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  41339. style: vue.normalizeStyle(lineStyle.value)
  41340. }, null, 6)
  41341. ], 2)) : vue.createCommentVNode("v-if", true),
  41342. vue.createElementVNode("div", {
  41343. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  41344. }, [
  41345. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  41346. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  41347. key: 0,
  41348. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  41349. }, {
  41350. default: vue.withCtx(() => [
  41351. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  41352. ]),
  41353. _: 1
  41354. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  41355. key: 1,
  41356. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  41357. }, {
  41358. default: vue.withCtx(() => [
  41359. vue.createVNode(vue.unref(check_default))
  41360. ]),
  41361. _: 1
  41362. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  41363. key: 2,
  41364. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  41365. }, {
  41366. default: vue.withCtx(() => [
  41367. vue.createVNode(vue.unref(close_default))
  41368. ]),
  41369. _: 1
  41370. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  41371. key: 3,
  41372. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  41373. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  41374. ])
  41375. ], 2)
  41376. ], 2),
  41377. vue.createCommentVNode(" title & description "),
  41378. vue.createElementVNode("div", {
  41379. class: vue.normalizeClass(vue.unref(ns).e("main"))
  41380. }, [
  41381. vue.createElementVNode("div", {
  41382. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  41383. }, [
  41384. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  41385. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  41386. ])
  41387. ], 2),
  41388. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  41389. key: 0,
  41390. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  41391. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  41392. key: 1,
  41393. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  41394. }, [
  41395. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  41396. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  41397. ])
  41398. ], 2))
  41399. ], 2)
  41400. ], 6);
  41401. };
  41402. }
  41403. });
  41404. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "item.vue"]]);
  41405. const ElSteps = withInstall(Steps, {
  41406. Step
  41407. });
  41408. const ElStep = withNoopInstall(Step);
  41409. const switchProps = buildProps({
  41410. modelValue: {
  41411. type: [Boolean, String, Number],
  41412. default: false
  41413. },
  41414. disabled: Boolean,
  41415. loading: Boolean,
  41416. size: {
  41417. type: String,
  41418. validator: isValidComponentSize
  41419. },
  41420. width: {
  41421. type: [String, Number],
  41422. default: ""
  41423. },
  41424. inlinePrompt: Boolean,
  41425. inactiveActionIcon: {
  41426. type: iconPropType
  41427. },
  41428. activeActionIcon: {
  41429. type: iconPropType
  41430. },
  41431. activeIcon: {
  41432. type: iconPropType
  41433. },
  41434. inactiveIcon: {
  41435. type: iconPropType
  41436. },
  41437. activeText: {
  41438. type: String,
  41439. default: ""
  41440. },
  41441. inactiveText: {
  41442. type: String,
  41443. default: ""
  41444. },
  41445. activeValue: {
  41446. type: [Boolean, String, Number],
  41447. default: true
  41448. },
  41449. inactiveValue: {
  41450. type: [Boolean, String, Number],
  41451. default: false
  41452. },
  41453. name: {
  41454. type: String,
  41455. default: ""
  41456. },
  41457. validateEvent: {
  41458. type: Boolean,
  41459. default: true
  41460. },
  41461. beforeChange: {
  41462. type: definePropType(Function)
  41463. },
  41464. id: String,
  41465. tabindex: {
  41466. type: [String, Number]
  41467. },
  41468. ...useAriaProps(["ariaLabel"])
  41469. });
  41470. const switchEmits = {
  41471. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  41472. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  41473. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  41474. };
  41475. const COMPONENT_NAME$8 = "ElSwitch";
  41476. const __default__$v = vue.defineComponent({
  41477. name: COMPONENT_NAME$8
  41478. });
  41479. const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
  41480. ...__default__$v,
  41481. props: switchProps,
  41482. emits: switchEmits,
  41483. setup(__props, { expose, emit }) {
  41484. const props = __props;
  41485. const { formItem } = useFormItem();
  41486. const switchSize = useFormSize();
  41487. const ns = useNamespace("switch");
  41488. const { inputId } = useFormItemInputId(props, {
  41489. formItemContext: formItem
  41490. });
  41491. const switchDisabled = useFormDisabled(vue.computed(() => props.loading));
  41492. const isControlled = vue.ref(props.modelValue !== false);
  41493. const input = vue.ref();
  41494. const core = vue.ref();
  41495. const switchKls = vue.computed(() => [
  41496. ns.b(),
  41497. ns.m(switchSize.value),
  41498. ns.is("disabled", switchDisabled.value),
  41499. ns.is("checked", checked.value)
  41500. ]);
  41501. const labelLeftKls = vue.computed(() => [
  41502. ns.e("label"),
  41503. ns.em("label", "left"),
  41504. ns.is("active", !checked.value)
  41505. ]);
  41506. const labelRightKls = vue.computed(() => [
  41507. ns.e("label"),
  41508. ns.em("label", "right"),
  41509. ns.is("active", checked.value)
  41510. ]);
  41511. const coreStyle = vue.computed(() => ({
  41512. width: addUnit(props.width)
  41513. }));
  41514. vue.watch(() => props.modelValue, () => {
  41515. isControlled.value = true;
  41516. });
  41517. const actualValue = vue.computed(() => {
  41518. return isControlled.value ? props.modelValue : false;
  41519. });
  41520. const checked = vue.computed(() => actualValue.value === props.activeValue);
  41521. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  41522. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  41523. emit(CHANGE_EVENT, props.inactiveValue);
  41524. emit(INPUT_EVENT, props.inactiveValue);
  41525. }
  41526. vue.watch(checked, (val) => {
  41527. var _a;
  41528. input.value.checked = val;
  41529. if (props.validateEvent) {
  41530. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  41531. }
  41532. });
  41533. const handleChange = () => {
  41534. const val = checked.value ? props.inactiveValue : props.activeValue;
  41535. emit(UPDATE_MODEL_EVENT, val);
  41536. emit(CHANGE_EVENT, val);
  41537. emit(INPUT_EVENT, val);
  41538. vue.nextTick(() => {
  41539. input.value.checked = checked.value;
  41540. });
  41541. };
  41542. const switchValue = () => {
  41543. if (switchDisabled.value)
  41544. return;
  41545. const { beforeChange } = props;
  41546. if (!beforeChange) {
  41547. handleChange();
  41548. return;
  41549. }
  41550. const shouldChange = beforeChange();
  41551. const isPromiseOrBool = [
  41552. isPromise(shouldChange),
  41553. isBoolean(shouldChange)
  41554. ].includes(true);
  41555. if (!isPromiseOrBool) {
  41556. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  41557. }
  41558. if (isPromise(shouldChange)) {
  41559. shouldChange.then((result) => {
  41560. if (result) {
  41561. handleChange();
  41562. }
  41563. }).catch((e) => {
  41564. });
  41565. } else if (shouldChange) {
  41566. handleChange();
  41567. }
  41568. };
  41569. const focus = () => {
  41570. var _a, _b;
  41571. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  41572. };
  41573. vue.onMounted(() => {
  41574. input.value.checked = checked.value;
  41575. });
  41576. expose({
  41577. focus,
  41578. checked
  41579. });
  41580. return (_ctx, _cache) => {
  41581. return vue.openBlock(), vue.createElementBlock("div", {
  41582. class: vue.normalizeClass(vue.unref(switchKls)),
  41583. onClick: vue.withModifiers(switchValue, ["prevent"])
  41584. }, [
  41585. vue.createElementVNode("input", {
  41586. id: vue.unref(inputId),
  41587. ref_key: "input",
  41588. ref: input,
  41589. class: vue.normalizeClass(vue.unref(ns).e("input")),
  41590. type: "checkbox",
  41591. role: "switch",
  41592. "aria-checked": vue.unref(checked),
  41593. "aria-disabled": vue.unref(switchDisabled),
  41594. "aria-label": _ctx.ariaLabel,
  41595. name: _ctx.name,
  41596. "true-value": _ctx.activeValue,
  41597. "false-value": _ctx.inactiveValue,
  41598. disabled: vue.unref(switchDisabled),
  41599. tabindex: _ctx.tabindex,
  41600. onChange: handleChange,
  41601. onKeydown: vue.withKeys(switchValue, ["enter"])
  41602. }, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
  41603. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  41604. key: 0,
  41605. class: vue.normalizeClass(vue.unref(labelLeftKls))
  41606. }, [
  41607. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41608. default: vue.withCtx(() => [
  41609. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  41610. ]),
  41611. _: 1
  41612. })) : vue.createCommentVNode("v-if", true),
  41613. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  41614. key: 1,
  41615. "aria-hidden": vue.unref(checked)
  41616. }, vue.toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  41617. ], 2)) : vue.createCommentVNode("v-if", true),
  41618. vue.createElementVNode("span", {
  41619. ref_key: "core",
  41620. ref: core,
  41621. class: vue.normalizeClass(vue.unref(ns).e("core")),
  41622. style: vue.normalizeStyle(vue.unref(coreStyle))
  41623. }, [
  41624. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  41625. key: 0,
  41626. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  41627. }, [
  41628. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  41629. key: 0,
  41630. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  41631. }, {
  41632. default: vue.withCtx(() => [
  41633. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  41634. ]),
  41635. _: 1
  41636. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  41637. key: 1,
  41638. class: vue.normalizeClass(vue.unref(ns).is("text")),
  41639. "aria-hidden": !vue.unref(checked)
  41640. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  41641. ], 2)) : vue.createCommentVNode("v-if", true),
  41642. vue.createElementVNode("div", {
  41643. class: vue.normalizeClass(vue.unref(ns).e("action"))
  41644. }, [
  41645. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  41646. key: 0,
  41647. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  41648. }, {
  41649. default: vue.withCtx(() => [
  41650. vue.createVNode(vue.unref(loading_default))
  41651. ]),
  41652. _: 1
  41653. }, 8, ["class"])) : vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  41654. _ctx.activeActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41655. default: vue.withCtx(() => [
  41656. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeActionIcon)))
  41657. ]),
  41658. _: 1
  41659. })) : vue.createCommentVNode("v-if", true)
  41660. ]) : !vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  41661. _ctx.inactiveActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41662. default: vue.withCtx(() => [
  41663. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveActionIcon)))
  41664. ]),
  41665. _: 1
  41666. })) : vue.createCommentVNode("v-if", true)
  41667. ]) : vue.createCommentVNode("v-if", true)
  41668. ], 2)
  41669. ], 6),
  41670. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  41671. key: 1,
  41672. class: vue.normalizeClass(vue.unref(labelRightKls))
  41673. }, [
  41674. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41675. default: vue.withCtx(() => [
  41676. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  41677. ]),
  41678. _: 1
  41679. })) : vue.createCommentVNode("v-if", true),
  41680. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  41681. key: 1,
  41682. "aria-hidden": !vue.unref(checked)
  41683. }, vue.toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  41684. ], 2)) : vue.createCommentVNode("v-if", true)
  41685. ], 10, ["onClick"]);
  41686. };
  41687. }
  41688. });
  41689. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__file", "switch.vue"]]);
  41690. const ElSwitch = withInstall(Switch);
  41691. const getCell = function(event) {
  41692. var _a;
  41693. return (_a = event.target) == null ? void 0 : _a.closest("td");
  41694. };
  41695. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  41696. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  41697. return array;
  41698. }
  41699. if (typeof reverse === "string") {
  41700. reverse = reverse === "descending" ? -1 : 1;
  41701. } else {
  41702. reverse = reverse && reverse < 0 ? -1 : 1;
  41703. }
  41704. const getKey = sortMethod ? null : function(value, index) {
  41705. if (sortBy) {
  41706. if (!Array.isArray(sortBy)) {
  41707. sortBy = [sortBy];
  41708. }
  41709. return sortBy.map((by) => {
  41710. if (typeof by === "string") {
  41711. return get(value, by);
  41712. } else {
  41713. return by(value, index, array);
  41714. }
  41715. });
  41716. }
  41717. if (sortKey !== "$key") {
  41718. if (isObject$1(value) && "$value" in value)
  41719. value = value.$value;
  41720. }
  41721. return [isObject$1(value) ? get(value, sortKey) : value];
  41722. };
  41723. const compare = function(a, b) {
  41724. if (sortMethod) {
  41725. return sortMethod(a.value, b.value);
  41726. }
  41727. for (let i = 0, len = a.key.length; i < len; i++) {
  41728. if (a.key[i] < b.key[i]) {
  41729. return -1;
  41730. }
  41731. if (a.key[i] > b.key[i]) {
  41732. return 1;
  41733. }
  41734. }
  41735. return 0;
  41736. };
  41737. return array.map((value, index) => {
  41738. return {
  41739. value,
  41740. index,
  41741. key: getKey ? getKey(value, index) : null
  41742. };
  41743. }).sort((a, b) => {
  41744. let order = compare(a, b);
  41745. if (!order) {
  41746. order = a.index - b.index;
  41747. }
  41748. return order * +reverse;
  41749. }).map((item) => item.value);
  41750. };
  41751. const getColumnById = function(table, columnId) {
  41752. let column = null;
  41753. table.columns.forEach((item) => {
  41754. if (item.id === columnId) {
  41755. column = item;
  41756. }
  41757. });
  41758. return column;
  41759. };
  41760. const getColumnByKey = function(table, columnKey) {
  41761. let column = null;
  41762. for (let i = 0; i < table.columns.length; i++) {
  41763. const item = table.columns[i];
  41764. if (item.columnKey === columnKey) {
  41765. column = item;
  41766. break;
  41767. }
  41768. }
  41769. if (!column)
  41770. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  41771. return column;
  41772. };
  41773. const getColumnByCell = function(table, cell, namespace) {
  41774. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  41775. if (matches) {
  41776. return getColumnById(table, matches[0]);
  41777. }
  41778. return null;
  41779. };
  41780. const getRowIdentity = (row, rowKey) => {
  41781. if (!row)
  41782. throw new Error("Row is required when get row identity");
  41783. if (typeof rowKey === "string") {
  41784. if (!rowKey.includes(".")) {
  41785. return `${row[rowKey]}`;
  41786. }
  41787. const key = rowKey.split(".");
  41788. let current = row;
  41789. for (const element of key) {
  41790. current = current[element];
  41791. }
  41792. return `${current}`;
  41793. } else if (typeof rowKey === "function") {
  41794. return rowKey.call(null, row);
  41795. }
  41796. };
  41797. const getKeysMap = function(array, rowKey) {
  41798. const arrayMap = {};
  41799. (array || []).forEach((row, index) => {
  41800. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  41801. });
  41802. return arrayMap;
  41803. };
  41804. function mergeOptions(defaults, config) {
  41805. const options = {};
  41806. let key;
  41807. for (key in defaults) {
  41808. options[key] = defaults[key];
  41809. }
  41810. for (key in config) {
  41811. if (hasOwn(config, key)) {
  41812. const value = config[key];
  41813. if (typeof value !== "undefined") {
  41814. options[key] = value;
  41815. }
  41816. }
  41817. }
  41818. return options;
  41819. }
  41820. function parseWidth(width) {
  41821. if (width === "")
  41822. return width;
  41823. if (width !== void 0) {
  41824. width = Number.parseInt(width, 10);
  41825. if (Number.isNaN(width)) {
  41826. width = "";
  41827. }
  41828. }
  41829. return width;
  41830. }
  41831. function parseMinWidth(minWidth) {
  41832. if (minWidth === "")
  41833. return minWidth;
  41834. if (minWidth !== void 0) {
  41835. minWidth = parseWidth(minWidth);
  41836. if (Number.isNaN(minWidth)) {
  41837. minWidth = 80;
  41838. }
  41839. }
  41840. return minWidth;
  41841. }
  41842. function parseHeight(height) {
  41843. if (typeof height === "number") {
  41844. return height;
  41845. }
  41846. if (typeof height === "string") {
  41847. if (/^\d+(?:px)?$/.test(height)) {
  41848. return Number.parseInt(height, 10);
  41849. } else {
  41850. return height;
  41851. }
  41852. }
  41853. return null;
  41854. }
  41855. function compose(...funcs) {
  41856. if (funcs.length === 0) {
  41857. return (arg) => arg;
  41858. }
  41859. if (funcs.length === 1) {
  41860. return funcs[0];
  41861. }
  41862. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  41863. }
  41864. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex) {
  41865. let _rowIndex = rowIndex != null ? rowIndex : 0;
  41866. let changed = false;
  41867. const index = statusArr.indexOf(row);
  41868. const included = index !== -1;
  41869. const isRowSelectable = selectable == null ? void 0 : selectable.call(null, row, rowIndex);
  41870. const toggleStatus = (type) => {
  41871. if (type === "add") {
  41872. statusArr.push(row);
  41873. } else {
  41874. statusArr.splice(index, 1);
  41875. }
  41876. changed = true;
  41877. };
  41878. const getChildrenCount = (row2) => {
  41879. let count = 0;
  41880. const children = (tableTreeProps == null ? void 0 : tableTreeProps.children) && row2[tableTreeProps.children];
  41881. if (children && isArray$1(children)) {
  41882. count += children.length;
  41883. children.forEach((item) => {
  41884. count += getChildrenCount(item);
  41885. });
  41886. }
  41887. return count;
  41888. };
  41889. if (!selectable || isRowSelectable) {
  41890. if (isBoolean(newVal)) {
  41891. if (newVal && !included) {
  41892. toggleStatus("add");
  41893. } else if (!newVal && included) {
  41894. toggleStatus("remove");
  41895. }
  41896. } else {
  41897. included ? toggleStatus("remove") : toggleStatus("add");
  41898. }
  41899. }
  41900. if (!(tableTreeProps == null ? void 0 : tableTreeProps.checkStrictly) && (tableTreeProps == null ? void 0 : tableTreeProps.children) && isArray$1(row[tableTreeProps.children])) {
  41901. row[tableTreeProps.children].forEach((item) => {
  41902. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included, tableTreeProps, selectable, _rowIndex + 1);
  41903. _rowIndex += getChildrenCount(item) + 1;
  41904. });
  41905. }
  41906. return changed;
  41907. }
  41908. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  41909. const isNil = (array) => !(Array.isArray(array) && array.length);
  41910. function _walker(parent, children, level) {
  41911. cb(parent, children, level);
  41912. children.forEach((item) => {
  41913. if (item[lazyKey]) {
  41914. cb(item, null, level + 1);
  41915. return;
  41916. }
  41917. const children2 = item[childrenKey];
  41918. if (!isNil(children2)) {
  41919. _walker(item, children2, level + 1);
  41920. }
  41921. });
  41922. }
  41923. root.forEach((item) => {
  41924. if (item[lazyKey]) {
  41925. cb(item, null, 0);
  41926. return;
  41927. }
  41928. const children = item[childrenKey];
  41929. if (!isNil(children)) {
  41930. _walker(item, children, 0);
  41931. }
  41932. });
  41933. }
  41934. let removePopper = null;
  41935. function createTablePopper(props, popperContent, trigger, table) {
  41936. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  41937. return;
  41938. }
  41939. removePopper == null ? void 0 : removePopper();
  41940. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  41941. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  41942. const popperOptions = {
  41943. strategy: "fixed",
  41944. ...props.popperOptions
  41945. };
  41946. const vm = vue.createVNode(ElTooltip, {
  41947. content: popperContent,
  41948. virtualTriggering: true,
  41949. virtualRef: trigger,
  41950. appendTo: parentNode,
  41951. placement: "top",
  41952. transition: "none",
  41953. offset: 0,
  41954. hideAfter: 0,
  41955. ...props,
  41956. popperOptions,
  41957. onHide: () => {
  41958. removePopper == null ? void 0 : removePopper();
  41959. }
  41960. });
  41961. vm.appContext = { ...table.appContext, ...table };
  41962. const container = document.createElement("div");
  41963. vue.render(vm, container);
  41964. vm.component.exposed.onOpen();
  41965. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  41966. removePopper = () => {
  41967. vue.render(null, container);
  41968. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  41969. removePopper = null;
  41970. };
  41971. removePopper.trigger = trigger;
  41972. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  41973. }
  41974. function getCurrentColumns(column) {
  41975. if (column.children) {
  41976. return flatMap(column.children, getCurrentColumns);
  41977. } else {
  41978. return [column];
  41979. }
  41980. }
  41981. function getColSpan(colSpan, column) {
  41982. return colSpan + column.colSpan;
  41983. }
  41984. const isFixedColumn = (index, fixed, store, realColumns) => {
  41985. let start = 0;
  41986. let after = index;
  41987. const columns = store.states.columns.value;
  41988. if (realColumns) {
  41989. const curColumns = getCurrentColumns(realColumns[index]);
  41990. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  41991. start = preColumns.reduce(getColSpan, 0);
  41992. after = start + curColumns.reduce(getColSpan, 0) - 1;
  41993. } else {
  41994. start = index;
  41995. }
  41996. let fixedLayout;
  41997. switch (fixed) {
  41998. case "left":
  41999. if (after < store.states.fixedLeafColumnsLength.value) {
  42000. fixedLayout = "left";
  42001. }
  42002. break;
  42003. case "right":
  42004. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  42005. fixedLayout = "right";
  42006. }
  42007. break;
  42008. default:
  42009. if (after < store.states.fixedLeafColumnsLength.value) {
  42010. fixedLayout = "left";
  42011. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  42012. fixedLayout = "right";
  42013. }
  42014. }
  42015. return fixedLayout ? {
  42016. direction: fixedLayout,
  42017. start,
  42018. after
  42019. } : {};
  42020. };
  42021. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  42022. const classes = [];
  42023. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  42024. if (direction) {
  42025. const isLeft = direction === "left";
  42026. classes.push(`${namespace}-fixed-column--${direction}`);
  42027. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  42028. classes.push("is-last-column");
  42029. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  42030. classes.push("is-first-column");
  42031. }
  42032. }
  42033. return classes;
  42034. };
  42035. function getOffset(offset, column) {
  42036. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  42037. }
  42038. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  42039. const {
  42040. direction,
  42041. start = 0,
  42042. after = 0
  42043. } = isFixedColumn(index, fixed, store, realColumns);
  42044. if (!direction) {
  42045. return;
  42046. }
  42047. const styles = {};
  42048. const isLeft = direction === "left";
  42049. const columns = store.states.columns.value;
  42050. if (isLeft) {
  42051. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  42052. } else {
  42053. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  42054. }
  42055. return styles;
  42056. };
  42057. const ensurePosition = (style, key) => {
  42058. if (!style)
  42059. return;
  42060. if (!Number.isNaN(style[key])) {
  42061. style[key] = `${style[key]}px`;
  42062. }
  42063. };
  42064. function useExpand(watcherData) {
  42065. const instance = vue.getCurrentInstance();
  42066. const defaultExpandAll = vue.ref(false);
  42067. const expandRows = vue.ref([]);
  42068. const updateExpandRows = () => {
  42069. const data = watcherData.data.value || [];
  42070. const rowKey = watcherData.rowKey.value;
  42071. if (defaultExpandAll.value) {
  42072. expandRows.value = data.slice();
  42073. } else if (rowKey) {
  42074. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  42075. expandRows.value = data.reduce((prev, row) => {
  42076. const rowId = getRowIdentity(row, rowKey);
  42077. const rowInfo = expandRowsMap[rowId];
  42078. if (rowInfo) {
  42079. prev.push(row);
  42080. }
  42081. return prev;
  42082. }, []);
  42083. } else {
  42084. expandRows.value = [];
  42085. }
  42086. };
  42087. const toggleRowExpansion = (row, expanded) => {
  42088. const changed = toggleRowStatus(expandRows.value, row, expanded);
  42089. if (changed) {
  42090. instance.emit("expand-change", row, expandRows.value.slice());
  42091. }
  42092. };
  42093. const setExpandRowKeys = (rowKeys) => {
  42094. instance.store.assertRowKey();
  42095. const data = watcherData.data.value || [];
  42096. const rowKey = watcherData.rowKey.value;
  42097. const keysMap = getKeysMap(data, rowKey);
  42098. expandRows.value = rowKeys.reduce((prev, cur) => {
  42099. const info = keysMap[cur];
  42100. if (info) {
  42101. prev.push(info.row);
  42102. }
  42103. return prev;
  42104. }, []);
  42105. };
  42106. const isRowExpanded = (row) => {
  42107. const rowKey = watcherData.rowKey.value;
  42108. if (rowKey) {
  42109. const expandMap = getKeysMap(expandRows.value, rowKey);
  42110. return !!expandMap[getRowIdentity(row, rowKey)];
  42111. }
  42112. return expandRows.value.includes(row);
  42113. };
  42114. return {
  42115. updateExpandRows,
  42116. toggleRowExpansion,
  42117. setExpandRowKeys,
  42118. isRowExpanded,
  42119. states: {
  42120. expandRows,
  42121. defaultExpandAll
  42122. }
  42123. };
  42124. }
  42125. function useCurrent(watcherData) {
  42126. const instance = vue.getCurrentInstance();
  42127. const _currentRowKey = vue.ref(null);
  42128. const currentRow = vue.ref(null);
  42129. const setCurrentRowKey = (key) => {
  42130. instance.store.assertRowKey();
  42131. _currentRowKey.value = key;
  42132. setCurrentRowByKey(key);
  42133. };
  42134. const restoreCurrentRowKey = () => {
  42135. _currentRowKey.value = null;
  42136. };
  42137. const setCurrentRowByKey = (key) => {
  42138. const { data, rowKey } = watcherData;
  42139. let _currentRow = null;
  42140. if (rowKey.value) {
  42141. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  42142. }
  42143. currentRow.value = _currentRow;
  42144. instance.emit("current-change", currentRow.value, null);
  42145. };
  42146. const updateCurrentRow = (_currentRow) => {
  42147. const oldCurrentRow = currentRow.value;
  42148. if (_currentRow && _currentRow !== oldCurrentRow) {
  42149. currentRow.value = _currentRow;
  42150. instance.emit("current-change", currentRow.value, oldCurrentRow);
  42151. return;
  42152. }
  42153. if (!_currentRow && oldCurrentRow) {
  42154. currentRow.value = null;
  42155. instance.emit("current-change", null, oldCurrentRow);
  42156. }
  42157. };
  42158. const updateCurrentRowData = () => {
  42159. const rowKey = watcherData.rowKey.value;
  42160. const data = watcherData.data.value || [];
  42161. const oldCurrentRow = currentRow.value;
  42162. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  42163. if (rowKey) {
  42164. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  42165. setCurrentRowByKey(currentRowKey);
  42166. } else {
  42167. currentRow.value = null;
  42168. }
  42169. if (currentRow.value === null) {
  42170. instance.emit("current-change", null, oldCurrentRow);
  42171. }
  42172. } else if (_currentRowKey.value) {
  42173. setCurrentRowByKey(_currentRowKey.value);
  42174. restoreCurrentRowKey();
  42175. }
  42176. };
  42177. return {
  42178. setCurrentRowKey,
  42179. restoreCurrentRowKey,
  42180. setCurrentRowByKey,
  42181. updateCurrentRow,
  42182. updateCurrentRowData,
  42183. states: {
  42184. _currentRowKey,
  42185. currentRow
  42186. }
  42187. };
  42188. }
  42189. function useTree$2(watcherData) {
  42190. const expandRowKeys = vue.ref([]);
  42191. const treeData = vue.ref({});
  42192. const indent = vue.ref(16);
  42193. const lazy = vue.ref(false);
  42194. const lazyTreeNodeMap = vue.ref({});
  42195. const lazyColumnIdentifier = vue.ref("hasChildren");
  42196. const childrenColumnName = vue.ref("children");
  42197. const checkStrictly = vue.ref(false);
  42198. const instance = vue.getCurrentInstance();
  42199. const normalizedData = vue.computed(() => {
  42200. if (!watcherData.rowKey.value)
  42201. return {};
  42202. const data = watcherData.data.value || [];
  42203. return normalize(data);
  42204. });
  42205. const normalizedLazyNode = vue.computed(() => {
  42206. const rowKey = watcherData.rowKey.value;
  42207. const keys = Object.keys(lazyTreeNodeMap.value);
  42208. const res = {};
  42209. if (!keys.length)
  42210. return res;
  42211. keys.forEach((key) => {
  42212. if (lazyTreeNodeMap.value[key].length) {
  42213. const item = { children: [] };
  42214. lazyTreeNodeMap.value[key].forEach((row) => {
  42215. const currentRowKey = getRowIdentity(row, rowKey);
  42216. item.children.push(currentRowKey);
  42217. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  42218. res[currentRowKey] = { children: [] };
  42219. }
  42220. });
  42221. res[key] = item;
  42222. }
  42223. });
  42224. return res;
  42225. });
  42226. const normalize = (data) => {
  42227. const rowKey = watcherData.rowKey.value;
  42228. const res = {};
  42229. walkTreeNode(data, (parent, children, level) => {
  42230. const parentId = getRowIdentity(parent, rowKey);
  42231. if (Array.isArray(children)) {
  42232. res[parentId] = {
  42233. children: children.map((row) => getRowIdentity(row, rowKey)),
  42234. level
  42235. };
  42236. } else if (lazy.value) {
  42237. res[parentId] = {
  42238. children: [],
  42239. lazy: true,
  42240. level
  42241. };
  42242. }
  42243. }, childrenColumnName.value, lazyColumnIdentifier.value);
  42244. return res;
  42245. };
  42246. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  42247. var _a2;
  42248. const nested = normalizedData.value;
  42249. const normalizedLazyNode_ = normalizedLazyNode.value;
  42250. const keys = Object.keys(nested);
  42251. const newTreeData = {};
  42252. if (keys.length) {
  42253. const oldTreeData = vue.unref(treeData);
  42254. const rootLazyRowKeys = [];
  42255. const getExpanded = (oldValue, key) => {
  42256. if (ifChangeExpandRowKeys) {
  42257. if (expandRowKeys.value) {
  42258. return ifExpandAll || expandRowKeys.value.includes(key);
  42259. } else {
  42260. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  42261. }
  42262. } else {
  42263. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  42264. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  42265. }
  42266. };
  42267. keys.forEach((key) => {
  42268. const oldValue = oldTreeData[key];
  42269. const newValue = { ...nested[key] };
  42270. newValue.expanded = getExpanded(oldValue, key);
  42271. if (newValue.lazy) {
  42272. const { loaded = false, loading = false } = oldValue || {};
  42273. newValue.loaded = !!loaded;
  42274. newValue.loading = !!loading;
  42275. rootLazyRowKeys.push(key);
  42276. }
  42277. newTreeData[key] = newValue;
  42278. });
  42279. const lazyKeys = Object.keys(normalizedLazyNode_);
  42280. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  42281. lazyKeys.forEach((key) => {
  42282. const oldValue = oldTreeData[key];
  42283. const lazyNodeChildren = normalizedLazyNode_[key].children;
  42284. if (rootLazyRowKeys.includes(key)) {
  42285. if (newTreeData[key].children.length !== 0) {
  42286. throw new Error("[ElTable]children must be an empty array.");
  42287. }
  42288. newTreeData[key].children = lazyNodeChildren;
  42289. } else {
  42290. const { loaded = false, loading = false } = oldValue || {};
  42291. newTreeData[key] = {
  42292. lazy: true,
  42293. loaded: !!loaded,
  42294. loading: !!loading,
  42295. expanded: getExpanded(oldValue, key),
  42296. children: lazyNodeChildren,
  42297. level: ""
  42298. };
  42299. }
  42300. });
  42301. }
  42302. }
  42303. treeData.value = newTreeData;
  42304. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  42305. };
  42306. vue.watch(() => expandRowKeys.value, () => {
  42307. updateTreeData(true);
  42308. });
  42309. vue.watch(() => normalizedData.value, () => {
  42310. updateTreeData();
  42311. });
  42312. vue.watch(() => normalizedLazyNode.value, () => {
  42313. updateTreeData();
  42314. });
  42315. const updateTreeExpandKeys = (value) => {
  42316. expandRowKeys.value = value;
  42317. updateTreeData();
  42318. };
  42319. const toggleTreeExpansion = (row, expanded) => {
  42320. instance.store.assertRowKey();
  42321. const rowKey = watcherData.rowKey.value;
  42322. const id = getRowIdentity(row, rowKey);
  42323. const data = id && treeData.value[id];
  42324. if (id && data && "expanded" in data) {
  42325. const oldExpanded = data.expanded;
  42326. expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
  42327. treeData.value[id].expanded = expanded;
  42328. if (oldExpanded !== expanded) {
  42329. instance.emit("expand-change", row, expanded);
  42330. }
  42331. instance.store.updateTableScrollY();
  42332. }
  42333. };
  42334. const loadOrToggle = (row) => {
  42335. instance.store.assertRowKey();
  42336. const rowKey = watcherData.rowKey.value;
  42337. const id = getRowIdentity(row, rowKey);
  42338. const data = treeData.value[id];
  42339. if (lazy.value && data && "loaded" in data && !data.loaded) {
  42340. loadData(row, id, data);
  42341. } else {
  42342. toggleTreeExpansion(row, void 0);
  42343. }
  42344. };
  42345. const loadData = (row, key, treeNode) => {
  42346. const { load } = instance.props;
  42347. if (load && !treeData.value[key].loaded) {
  42348. treeData.value[key].loading = true;
  42349. load(row, treeNode, (data) => {
  42350. if (!Array.isArray(data)) {
  42351. throw new TypeError("[ElTable] data must be an array");
  42352. }
  42353. treeData.value[key].loading = false;
  42354. treeData.value[key].loaded = true;
  42355. treeData.value[key].expanded = true;
  42356. if (data.length) {
  42357. lazyTreeNodeMap.value[key] = data;
  42358. }
  42359. instance.emit("expand-change", row, true);
  42360. });
  42361. }
  42362. };
  42363. return {
  42364. loadData,
  42365. loadOrToggle,
  42366. toggleTreeExpansion,
  42367. updateTreeExpandKeys,
  42368. updateTreeData,
  42369. normalize,
  42370. states: {
  42371. expandRowKeys,
  42372. treeData,
  42373. indent,
  42374. lazy,
  42375. lazyTreeNodeMap,
  42376. lazyColumnIdentifier,
  42377. childrenColumnName,
  42378. checkStrictly
  42379. }
  42380. };
  42381. }
  42382. const sortData = (data, states) => {
  42383. const sortingColumn = states.sortingColumn;
  42384. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  42385. return data;
  42386. }
  42387. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  42388. };
  42389. const doFlattenColumns = (columns) => {
  42390. const result = [];
  42391. columns.forEach((column) => {
  42392. if (column.children && column.children.length > 0) {
  42393. result.push.apply(result, doFlattenColumns(column.children));
  42394. } else {
  42395. result.push(column);
  42396. }
  42397. });
  42398. return result;
  42399. };
  42400. function useWatcher$1() {
  42401. var _a;
  42402. const instance = vue.getCurrentInstance();
  42403. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  42404. const rowKey = vue.ref(null);
  42405. const data = vue.ref([]);
  42406. const _data = vue.ref([]);
  42407. const isComplex = vue.ref(false);
  42408. const _columns = vue.ref([]);
  42409. const originColumns = vue.ref([]);
  42410. const columns = vue.ref([]);
  42411. const fixedColumns = vue.ref([]);
  42412. const rightFixedColumns = vue.ref([]);
  42413. const leafColumns = vue.ref([]);
  42414. const fixedLeafColumns = vue.ref([]);
  42415. const rightFixedLeafColumns = vue.ref([]);
  42416. const updateOrderFns = [];
  42417. const leafColumnsLength = vue.ref(0);
  42418. const fixedLeafColumnsLength = vue.ref(0);
  42419. const rightFixedLeafColumnsLength = vue.ref(0);
  42420. const isAllSelected = vue.ref(false);
  42421. const selection = vue.ref([]);
  42422. const reserveSelection = vue.ref(false);
  42423. const selectOnIndeterminate = vue.ref(false);
  42424. const selectable = vue.ref(null);
  42425. const filters = vue.ref({});
  42426. const filteredData = vue.ref(null);
  42427. const sortingColumn = vue.ref(null);
  42428. const sortProp = vue.ref(null);
  42429. const sortOrder = vue.ref(null);
  42430. const hoverRow = vue.ref(null);
  42431. vue.watch(data, () => instance.state && scheduleLayout(false), {
  42432. deep: true
  42433. });
  42434. const assertRowKey = () => {
  42435. if (!rowKey.value)
  42436. throw new Error("[ElTable] prop row-key is required");
  42437. };
  42438. const updateChildFixed = (column) => {
  42439. var _a2;
  42440. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  42441. childColumn.fixed = column.fixed;
  42442. updateChildFixed(childColumn);
  42443. });
  42444. };
  42445. const updateColumns = () => {
  42446. _columns.value.forEach((column) => {
  42447. updateChildFixed(column);
  42448. });
  42449. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  42450. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  42451. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  42452. _columns.value[0].fixed = true;
  42453. fixedColumns.value.unshift(_columns.value[0]);
  42454. }
  42455. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  42456. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  42457. const leafColumns2 = doFlattenColumns(notFixedColumns);
  42458. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  42459. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  42460. leafColumnsLength.value = leafColumns2.length;
  42461. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  42462. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  42463. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  42464. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  42465. };
  42466. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  42467. if (needUpdateColumns) {
  42468. updateColumns();
  42469. }
  42470. if (immediate) {
  42471. instance.state.doLayout();
  42472. } else {
  42473. instance.state.debouncedUpdateLayout();
  42474. }
  42475. };
  42476. const isSelected = (row) => {
  42477. return selection.value.some((item) => isEqual$1(item, row));
  42478. };
  42479. const clearSelection = () => {
  42480. isAllSelected.value = false;
  42481. const oldSelection = selection.value;
  42482. selection.value = [];
  42483. if (oldSelection.length) {
  42484. instance.emit("selection-change", []);
  42485. }
  42486. };
  42487. const cleanSelection = () => {
  42488. let deleted;
  42489. if (rowKey.value) {
  42490. deleted = [];
  42491. const selectedMap = getKeysMap(selection.value, rowKey.value);
  42492. const dataMap = getKeysMap(data.value, rowKey.value);
  42493. for (const key in selectedMap) {
  42494. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  42495. deleted.push(selectedMap[key].row);
  42496. }
  42497. }
  42498. } else {
  42499. deleted = selection.value.filter((item) => !data.value.includes(item));
  42500. }
  42501. if (deleted.length) {
  42502. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  42503. selection.value = newSelection;
  42504. instance.emit("selection-change", newSelection.slice());
  42505. }
  42506. };
  42507. const getSelectionRows = () => {
  42508. return (selection.value || []).slice();
  42509. };
  42510. const toggleRowSelection = (row, selected, emitChange = true) => {
  42511. var _a2, _b, _c, _d;
  42512. const treeProps = {
  42513. children: (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value,
  42514. checkStrictly: (_d = (_c = instance == null ? void 0 : instance.store) == null ? void 0 : _c.states) == null ? void 0 : _d.checkStrictly.value
  42515. };
  42516. const changed = toggleRowStatus(selection.value, row, selected, treeProps);
  42517. if (changed) {
  42518. const newSelection = (selection.value || []).slice();
  42519. if (emitChange) {
  42520. instance.emit("select", newSelection, row);
  42521. }
  42522. instance.emit("selection-change", newSelection);
  42523. }
  42524. };
  42525. const _toggleAllSelection = () => {
  42526. var _a2, _b;
  42527. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  42528. isAllSelected.value = value;
  42529. let selectionChanged = false;
  42530. let childrenCount = 0;
  42531. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  42532. const { childrenColumnName } = instance.store.states;
  42533. const treeProps = {
  42534. children: childrenColumnName.value,
  42535. checkStrictly: false
  42536. };
  42537. data.value.forEach((row, index) => {
  42538. const rowIndex = index + childrenCount;
  42539. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex)) {
  42540. selectionChanged = true;
  42541. }
  42542. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  42543. });
  42544. if (selectionChanged) {
  42545. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  42546. }
  42547. instance.emit("select-all", (selection.value || []).slice());
  42548. };
  42549. const updateSelectionByRowKey = () => {
  42550. const selectedMap = getKeysMap(selection.value, rowKey.value);
  42551. data.value.forEach((row) => {
  42552. const rowId = getRowIdentity(row, rowKey.value);
  42553. const rowInfo = selectedMap[rowId];
  42554. if (rowInfo) {
  42555. selection.value[rowInfo.index] = row;
  42556. }
  42557. });
  42558. };
  42559. const updateAllSelected = () => {
  42560. var _a2;
  42561. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  42562. isAllSelected.value = false;
  42563. return;
  42564. }
  42565. const { childrenColumnName } = instance.store.states;
  42566. const selectedMap = rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  42567. let rowIndex = 0;
  42568. let selectedCount = 0;
  42569. const isSelected2 = (row) => {
  42570. if (selectedMap) {
  42571. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  42572. } else {
  42573. return selection.value.includes(row);
  42574. }
  42575. };
  42576. const checkSelectedStatus = (data2) => {
  42577. var _a3;
  42578. for (const row of data2) {
  42579. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  42580. if (!isSelected2(row)) {
  42581. if (!selectable.value || isRowSelectable) {
  42582. return false;
  42583. }
  42584. } else {
  42585. selectedCount++;
  42586. }
  42587. rowIndex++;
  42588. if (((_a3 = row[childrenColumnName.value]) == null ? void 0 : _a3.length) && !checkSelectedStatus(row[childrenColumnName.value])) {
  42589. return false;
  42590. }
  42591. }
  42592. return true;
  42593. };
  42594. const isAllSelected_ = checkSelectedStatus(data.value || []);
  42595. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  42596. };
  42597. const getChildrenCount = (rowKey2) => {
  42598. var _a2;
  42599. if (!instance || !instance.store)
  42600. return 0;
  42601. const { treeData } = instance.store.states;
  42602. let count = 0;
  42603. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  42604. if (children) {
  42605. count += children.length;
  42606. children.forEach((childKey) => {
  42607. count += getChildrenCount(childKey);
  42608. });
  42609. }
  42610. return count;
  42611. };
  42612. const updateFilters = (columns2, values) => {
  42613. if (!Array.isArray(columns2)) {
  42614. columns2 = [columns2];
  42615. }
  42616. const filters_ = {};
  42617. columns2.forEach((col) => {
  42618. filters.value[col.id] = values;
  42619. filters_[col.columnKey || col.id] = values;
  42620. });
  42621. return filters_;
  42622. };
  42623. const updateSort = (column, prop, order) => {
  42624. if (sortingColumn.value && sortingColumn.value !== column) {
  42625. sortingColumn.value.order = null;
  42626. }
  42627. sortingColumn.value = column;
  42628. sortProp.value = prop;
  42629. sortOrder.value = order;
  42630. };
  42631. const execFilter = () => {
  42632. let sourceData = vue.unref(_data);
  42633. Object.keys(filters.value).forEach((columnId) => {
  42634. const values = filters.value[columnId];
  42635. if (!values || values.length === 0)
  42636. return;
  42637. const column = getColumnById({
  42638. columns: columns.value
  42639. }, columnId);
  42640. if (column && column.filterMethod) {
  42641. sourceData = sourceData.filter((row) => {
  42642. return values.some((value) => column.filterMethod.call(null, value, row, column));
  42643. });
  42644. }
  42645. });
  42646. filteredData.value = sourceData;
  42647. };
  42648. const execSort = () => {
  42649. data.value = sortData(filteredData.value, {
  42650. sortingColumn: sortingColumn.value,
  42651. sortProp: sortProp.value,
  42652. sortOrder: sortOrder.value
  42653. });
  42654. };
  42655. const execQuery = (ignore = void 0) => {
  42656. if (!(ignore && ignore.filter)) {
  42657. execFilter();
  42658. }
  42659. execSort();
  42660. };
  42661. const clearFilter = (columnKeys) => {
  42662. const { tableHeaderRef } = instance.refs;
  42663. if (!tableHeaderRef)
  42664. return;
  42665. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  42666. const keys = Object.keys(panels);
  42667. if (!keys.length)
  42668. return;
  42669. if (typeof columnKeys === "string") {
  42670. columnKeys = [columnKeys];
  42671. }
  42672. if (Array.isArray(columnKeys)) {
  42673. const columns_ = columnKeys.map((key) => getColumnByKey({
  42674. columns: columns.value
  42675. }, key));
  42676. keys.forEach((key) => {
  42677. const column = columns_.find((col) => col.id === key);
  42678. if (column) {
  42679. column.filteredValue = [];
  42680. }
  42681. });
  42682. instance.store.commit("filterChange", {
  42683. column: columns_,
  42684. values: [],
  42685. silent: true,
  42686. multi: true
  42687. });
  42688. } else {
  42689. keys.forEach((key) => {
  42690. const column = columns.value.find((col) => col.id === key);
  42691. if (column) {
  42692. column.filteredValue = [];
  42693. }
  42694. });
  42695. filters.value = {};
  42696. instance.store.commit("filterChange", {
  42697. column: {},
  42698. values: [],
  42699. silent: true
  42700. });
  42701. }
  42702. };
  42703. const clearSort = () => {
  42704. if (!sortingColumn.value)
  42705. return;
  42706. updateSort(null, null, null);
  42707. instance.store.commit("changeSortCondition", {
  42708. silent: true
  42709. });
  42710. };
  42711. const {
  42712. setExpandRowKeys,
  42713. toggleRowExpansion,
  42714. updateExpandRows,
  42715. states: expandStates,
  42716. isRowExpanded
  42717. } = useExpand({
  42718. data,
  42719. rowKey
  42720. });
  42721. const {
  42722. updateTreeExpandKeys,
  42723. toggleTreeExpansion,
  42724. updateTreeData,
  42725. loadOrToggle,
  42726. states: treeStates
  42727. } = useTree$2({
  42728. data,
  42729. rowKey
  42730. });
  42731. const {
  42732. updateCurrentRowData,
  42733. updateCurrentRow,
  42734. setCurrentRowKey,
  42735. states: currentData
  42736. } = useCurrent({
  42737. data,
  42738. rowKey
  42739. });
  42740. const setExpandRowKeysAdapter = (val) => {
  42741. setExpandRowKeys(val);
  42742. updateTreeExpandKeys(val);
  42743. };
  42744. const toggleRowExpansionAdapter = (row, expanded) => {
  42745. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  42746. if (hasExpandColumn) {
  42747. toggleRowExpansion(row, expanded);
  42748. } else {
  42749. toggleTreeExpansion(row, expanded);
  42750. }
  42751. };
  42752. return {
  42753. assertRowKey,
  42754. updateColumns,
  42755. scheduleLayout,
  42756. isSelected,
  42757. clearSelection,
  42758. cleanSelection,
  42759. getSelectionRows,
  42760. toggleRowSelection,
  42761. _toggleAllSelection,
  42762. toggleAllSelection: null,
  42763. updateSelectionByRowKey,
  42764. updateAllSelected,
  42765. updateFilters,
  42766. updateCurrentRow,
  42767. updateSort,
  42768. execFilter,
  42769. execSort,
  42770. execQuery,
  42771. clearFilter,
  42772. clearSort,
  42773. toggleRowExpansion,
  42774. setExpandRowKeysAdapter,
  42775. setCurrentRowKey,
  42776. toggleRowExpansionAdapter,
  42777. isRowExpanded,
  42778. updateExpandRows,
  42779. updateCurrentRowData,
  42780. loadOrToggle,
  42781. updateTreeData,
  42782. states: {
  42783. tableSize,
  42784. rowKey,
  42785. data,
  42786. _data,
  42787. isComplex,
  42788. _columns,
  42789. originColumns,
  42790. columns,
  42791. fixedColumns,
  42792. rightFixedColumns,
  42793. leafColumns,
  42794. fixedLeafColumns,
  42795. rightFixedLeafColumns,
  42796. updateOrderFns,
  42797. leafColumnsLength,
  42798. fixedLeafColumnsLength,
  42799. rightFixedLeafColumnsLength,
  42800. isAllSelected,
  42801. selection,
  42802. reserveSelection,
  42803. selectOnIndeterminate,
  42804. selectable,
  42805. filters,
  42806. filteredData,
  42807. sortingColumn,
  42808. sortProp,
  42809. sortOrder,
  42810. hoverRow,
  42811. ...expandStates,
  42812. ...treeStates,
  42813. ...currentData
  42814. }
  42815. };
  42816. }
  42817. function replaceColumn(array, column) {
  42818. return array.map((item) => {
  42819. var _a;
  42820. if (item.id === column.id) {
  42821. return column;
  42822. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  42823. item.children = replaceColumn(item.children, column);
  42824. }
  42825. return item;
  42826. });
  42827. }
  42828. function sortColumn(array) {
  42829. array.forEach((item) => {
  42830. var _a, _b;
  42831. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  42832. if ((_b = item.children) == null ? void 0 : _b.length) {
  42833. sortColumn(item.children);
  42834. }
  42835. });
  42836. array.sort((cur, pre) => cur.no - pre.no);
  42837. }
  42838. function useStore() {
  42839. const instance = vue.getCurrentInstance();
  42840. const watcher = useWatcher$1();
  42841. const ns = useNamespace("table");
  42842. const mutations = {
  42843. setData(states, data) {
  42844. const dataInstanceChanged = vue.unref(states._data) !== data;
  42845. states.data.value = data;
  42846. states._data.value = data;
  42847. instance.store.execQuery();
  42848. instance.store.updateCurrentRowData();
  42849. instance.store.updateExpandRows();
  42850. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  42851. if (vue.unref(states.reserveSelection)) {
  42852. instance.store.assertRowKey();
  42853. instance.store.updateSelectionByRowKey();
  42854. } else {
  42855. if (dataInstanceChanged) {
  42856. instance.store.clearSelection();
  42857. } else {
  42858. instance.store.cleanSelection();
  42859. }
  42860. }
  42861. instance.store.updateAllSelected();
  42862. if (instance.$ready) {
  42863. instance.store.scheduleLayout();
  42864. }
  42865. },
  42866. insertColumn(states, column, parent, updateColumnOrder) {
  42867. const array = vue.unref(states._columns);
  42868. let newColumns = [];
  42869. if (!parent) {
  42870. array.push(column);
  42871. newColumns = array;
  42872. } else {
  42873. if (parent && !parent.children) {
  42874. parent.children = [];
  42875. }
  42876. parent.children.push(column);
  42877. newColumns = replaceColumn(array, parent);
  42878. }
  42879. sortColumn(newColumns);
  42880. states._columns.value = newColumns;
  42881. states.updateOrderFns.push(updateColumnOrder);
  42882. if (column.type === "selection") {
  42883. states.selectable.value = column.selectable;
  42884. states.reserveSelection.value = column.reserveSelection;
  42885. }
  42886. if (instance.$ready) {
  42887. instance.store.updateColumns();
  42888. instance.store.scheduleLayout();
  42889. }
  42890. },
  42891. updateColumnOrder(states, column) {
  42892. var _a;
  42893. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  42894. if (newColumnIndex === column.no)
  42895. return;
  42896. sortColumn(states._columns.value);
  42897. if (instance.$ready) {
  42898. instance.store.updateColumns();
  42899. }
  42900. },
  42901. removeColumn(states, column, parent, updateColumnOrder) {
  42902. const array = vue.unref(states._columns) || [];
  42903. if (parent) {
  42904. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  42905. vue.nextTick(() => {
  42906. var _a;
  42907. if (((_a = parent.children) == null ? void 0 : _a.length) === 0) {
  42908. delete parent.children;
  42909. }
  42910. });
  42911. states._columns.value = replaceColumn(array, parent);
  42912. } else {
  42913. const index = array.indexOf(column);
  42914. if (index > -1) {
  42915. array.splice(index, 1);
  42916. states._columns.value = array;
  42917. }
  42918. }
  42919. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  42920. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  42921. if (instance.$ready) {
  42922. instance.store.updateColumns();
  42923. instance.store.scheduleLayout();
  42924. }
  42925. },
  42926. sort(states, options) {
  42927. const { prop, order, init } = options;
  42928. if (prop) {
  42929. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  42930. if (column) {
  42931. column.order = order;
  42932. instance.store.updateSort(column, prop, order);
  42933. instance.store.commit("changeSortCondition", { init });
  42934. }
  42935. }
  42936. },
  42937. changeSortCondition(states, options) {
  42938. const { sortingColumn, sortProp, sortOrder } = states;
  42939. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  42940. if (orderValue === null) {
  42941. states.sortingColumn.value = null;
  42942. states.sortProp.value = null;
  42943. }
  42944. const ignore = { filter: true };
  42945. instance.store.execQuery(ignore);
  42946. if (!options || !(options.silent || options.init)) {
  42947. instance.emit("sort-change", {
  42948. column: columnValue,
  42949. prop: propValue,
  42950. order: orderValue
  42951. });
  42952. }
  42953. instance.store.updateTableScrollY();
  42954. },
  42955. filterChange(_states, options) {
  42956. const { column, values, silent } = options;
  42957. const newFilters = instance.store.updateFilters(column, values);
  42958. instance.store.execQuery();
  42959. if (!silent) {
  42960. instance.emit("filter-change", newFilters);
  42961. }
  42962. instance.store.updateTableScrollY();
  42963. },
  42964. toggleAllSelection() {
  42965. instance.store.toggleAllSelection();
  42966. },
  42967. rowSelectedChanged(_states, row) {
  42968. instance.store.toggleRowSelection(row);
  42969. instance.store.updateAllSelected();
  42970. },
  42971. setHoverRow(states, row) {
  42972. states.hoverRow.value = row;
  42973. },
  42974. setCurrentRow(_states, row) {
  42975. instance.store.updateCurrentRow(row);
  42976. }
  42977. };
  42978. const commit = function(name, ...args) {
  42979. const mutations2 = instance.store.mutations;
  42980. if (mutations2[name]) {
  42981. mutations2[name].apply(instance, [instance.store.states].concat(args));
  42982. } else {
  42983. throw new Error(`Action not found: ${name}`);
  42984. }
  42985. };
  42986. const updateTableScrollY = function() {
  42987. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  42988. };
  42989. return {
  42990. ns,
  42991. ...watcher,
  42992. mutations,
  42993. commit,
  42994. updateTableScrollY
  42995. };
  42996. }
  42997. const InitialStateMap = {
  42998. rowKey: "rowKey",
  42999. defaultExpandAll: "defaultExpandAll",
  43000. selectOnIndeterminate: "selectOnIndeterminate",
  43001. indent: "indent",
  43002. lazy: "lazy",
  43003. data: "data",
  43004. ["treeProps.hasChildren"]: {
  43005. key: "lazyColumnIdentifier",
  43006. default: "hasChildren"
  43007. },
  43008. ["treeProps.children"]: {
  43009. key: "childrenColumnName",
  43010. default: "children"
  43011. },
  43012. ["treeProps.checkStrictly"]: {
  43013. key: "checkStrictly",
  43014. default: false
  43015. }
  43016. };
  43017. function createStore(table, props) {
  43018. if (!table) {
  43019. throw new Error("Table is required.");
  43020. }
  43021. const store = useStore();
  43022. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  43023. Object.keys(InitialStateMap).forEach((key) => {
  43024. handleValue(getArrKeysValue(props, key), key, store);
  43025. });
  43026. proxyTableProps(store, props);
  43027. return store;
  43028. }
  43029. function proxyTableProps(store, props) {
  43030. Object.keys(InitialStateMap).forEach((key) => {
  43031. vue.watch(() => getArrKeysValue(props, key), (value) => {
  43032. handleValue(value, key, store);
  43033. });
  43034. });
  43035. }
  43036. function handleValue(value, propsKey, store) {
  43037. let newVal = value;
  43038. let storeKey = InitialStateMap[propsKey];
  43039. if (typeof InitialStateMap[propsKey] === "object") {
  43040. storeKey = storeKey.key;
  43041. newVal = newVal || InitialStateMap[propsKey].default;
  43042. }
  43043. store.states[storeKey].value = newVal;
  43044. }
  43045. function getArrKeysValue(props, keys) {
  43046. if (keys.includes(".")) {
  43047. const keyList = keys.split(".");
  43048. let value = props;
  43049. keyList.forEach((key) => {
  43050. value = value[key];
  43051. });
  43052. return value;
  43053. } else {
  43054. return props[keys];
  43055. }
  43056. }
  43057. class TableLayout {
  43058. constructor(options) {
  43059. this.observers = [];
  43060. this.table = null;
  43061. this.store = null;
  43062. this.columns = [];
  43063. this.fit = true;
  43064. this.showHeader = true;
  43065. this.height = vue.ref(null);
  43066. this.scrollX = vue.ref(false);
  43067. this.scrollY = vue.ref(false);
  43068. this.bodyWidth = vue.ref(null);
  43069. this.fixedWidth = vue.ref(null);
  43070. this.rightFixedWidth = vue.ref(null);
  43071. this.gutterWidth = 0;
  43072. for (const name in options) {
  43073. if (hasOwn(options, name)) {
  43074. if (vue.isRef(this[name])) {
  43075. this[name].value = options[name];
  43076. } else {
  43077. this[name] = options[name];
  43078. }
  43079. }
  43080. }
  43081. if (!this.table) {
  43082. throw new Error("Table is required for Table Layout");
  43083. }
  43084. if (!this.store) {
  43085. throw new Error("Store is required for Table Layout");
  43086. }
  43087. }
  43088. updateScrollY() {
  43089. const height = this.height.value;
  43090. if (height === null)
  43091. return false;
  43092. const scrollBarRef = this.table.refs.scrollBarRef;
  43093. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  43094. let scrollY = true;
  43095. const prevScrollY = this.scrollY.value;
  43096. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  43097. this.scrollY.value = scrollY;
  43098. return prevScrollY !== scrollY;
  43099. }
  43100. return false;
  43101. }
  43102. setHeight(value, prop = "height") {
  43103. if (!isClient)
  43104. return;
  43105. const el = this.table.vnode.el;
  43106. value = parseHeight(value);
  43107. this.height.value = Number(value);
  43108. if (!el && (value || value === 0))
  43109. return vue.nextTick(() => this.setHeight(value, prop));
  43110. if (typeof value === "number") {
  43111. el.style[prop] = `${value}px`;
  43112. this.updateElsHeight();
  43113. } else if (typeof value === "string") {
  43114. el.style[prop] = value;
  43115. this.updateElsHeight();
  43116. }
  43117. }
  43118. setMaxHeight(value) {
  43119. this.setHeight(value, "max-height");
  43120. }
  43121. getFlattenColumns() {
  43122. const flattenColumns = [];
  43123. const columns = this.table.store.states.columns.value;
  43124. columns.forEach((column) => {
  43125. if (column.isColumnGroup) {
  43126. flattenColumns.push.apply(flattenColumns, column.columns);
  43127. } else {
  43128. flattenColumns.push(column);
  43129. }
  43130. });
  43131. return flattenColumns;
  43132. }
  43133. updateElsHeight() {
  43134. this.updateScrollY();
  43135. this.notifyObservers("scrollable");
  43136. }
  43137. headerDisplayNone(elm) {
  43138. if (!elm)
  43139. return true;
  43140. let headerChild = elm;
  43141. while (headerChild.tagName !== "DIV") {
  43142. if (getComputedStyle(headerChild).display === "none") {
  43143. return true;
  43144. }
  43145. headerChild = headerChild.parentElement;
  43146. }
  43147. return false;
  43148. }
  43149. updateColumnsWidth() {
  43150. if (!isClient)
  43151. return;
  43152. const fit = this.fit;
  43153. const bodyWidth = this.table.vnode.el.clientWidth;
  43154. let bodyMinWidth = 0;
  43155. const flattenColumns = this.getFlattenColumns();
  43156. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  43157. flattenColumns.forEach((column) => {
  43158. if (typeof column.width === "number" && column.realWidth)
  43159. column.realWidth = null;
  43160. });
  43161. if (flexColumns.length > 0 && fit) {
  43162. flattenColumns.forEach((column) => {
  43163. bodyMinWidth += Number(column.width || column.minWidth || 80);
  43164. });
  43165. if (bodyMinWidth <= bodyWidth) {
  43166. this.scrollX.value = false;
  43167. const totalFlexWidth = bodyWidth - bodyMinWidth;
  43168. if (flexColumns.length === 1) {
  43169. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  43170. } else {
  43171. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  43172. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  43173. let noneFirstWidth = 0;
  43174. flexColumns.forEach((column, index) => {
  43175. if (index === 0)
  43176. return;
  43177. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  43178. noneFirstWidth += flexWidth;
  43179. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  43180. });
  43181. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  43182. }
  43183. } else {
  43184. this.scrollX.value = true;
  43185. flexColumns.forEach((column) => {
  43186. column.realWidth = Number(column.minWidth);
  43187. });
  43188. }
  43189. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  43190. this.table.state.resizeState.value.width = this.bodyWidth.value;
  43191. } else {
  43192. flattenColumns.forEach((column) => {
  43193. if (!column.width && !column.minWidth) {
  43194. column.realWidth = 80;
  43195. } else {
  43196. column.realWidth = Number(column.width || column.minWidth);
  43197. }
  43198. bodyMinWidth += column.realWidth;
  43199. });
  43200. this.scrollX.value = bodyMinWidth > bodyWidth;
  43201. this.bodyWidth.value = bodyMinWidth;
  43202. }
  43203. const fixedColumns = this.store.states.fixedColumns.value;
  43204. if (fixedColumns.length > 0) {
  43205. let fixedWidth = 0;
  43206. fixedColumns.forEach((column) => {
  43207. fixedWidth += Number(column.realWidth || column.width);
  43208. });
  43209. this.fixedWidth.value = fixedWidth;
  43210. }
  43211. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  43212. if (rightFixedColumns.length > 0) {
  43213. let rightFixedWidth = 0;
  43214. rightFixedColumns.forEach((column) => {
  43215. rightFixedWidth += Number(column.realWidth || column.width);
  43216. });
  43217. this.rightFixedWidth.value = rightFixedWidth;
  43218. }
  43219. this.notifyObservers("columns");
  43220. }
  43221. addObserver(observer) {
  43222. this.observers.push(observer);
  43223. }
  43224. removeObserver(observer) {
  43225. const index = this.observers.indexOf(observer);
  43226. if (index !== -1) {
  43227. this.observers.splice(index, 1);
  43228. }
  43229. }
  43230. notifyObservers(event) {
  43231. const observers = this.observers;
  43232. observers.forEach((observer) => {
  43233. var _a, _b;
  43234. switch (event) {
  43235. case "columns":
  43236. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  43237. break;
  43238. case "scrollable":
  43239. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  43240. break;
  43241. default:
  43242. throw new Error(`Table Layout don't have event ${event}.`);
  43243. }
  43244. });
  43245. }
  43246. }
  43247. var TableLayout$1 = TableLayout;
  43248. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  43249. const _sfc_main$B = vue.defineComponent({
  43250. name: "ElTableFilterPanel",
  43251. components: {
  43252. ElCheckbox,
  43253. ElCheckboxGroup,
  43254. ElScrollbar,
  43255. ElTooltip,
  43256. ElIcon,
  43257. ArrowDown: arrow_down_default,
  43258. ArrowUp: arrow_up_default
  43259. },
  43260. directives: { ClickOutside },
  43261. props: {
  43262. placement: {
  43263. type: String,
  43264. default: "bottom-start"
  43265. },
  43266. store: {
  43267. type: Object
  43268. },
  43269. column: {
  43270. type: Object
  43271. },
  43272. upDataColumn: {
  43273. type: Function
  43274. }
  43275. },
  43276. setup(props) {
  43277. const instance = vue.getCurrentInstance();
  43278. const { t } = useLocale();
  43279. const ns = useNamespace("table-filter");
  43280. const parent = instance == null ? void 0 : instance.parent;
  43281. if (!parent.filterPanels.value[props.column.id]) {
  43282. parent.filterPanels.value[props.column.id] = instance;
  43283. }
  43284. const tooltipVisible = vue.ref(false);
  43285. const tooltip = vue.ref(null);
  43286. const filters = vue.computed(() => {
  43287. return props.column && props.column.filters;
  43288. });
  43289. const filterClassName = vue.computed(() => {
  43290. if (props.column.filterClassName) {
  43291. return `${ns.b()} ${props.column.filterClassName}`;
  43292. }
  43293. return ns.b();
  43294. });
  43295. const filterValue = vue.computed({
  43296. get: () => {
  43297. var _a;
  43298. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  43299. },
  43300. set: (value) => {
  43301. if (filteredValue.value) {
  43302. if (typeof value !== "undefined" && value !== null) {
  43303. filteredValue.value.splice(0, 1, value);
  43304. } else {
  43305. filteredValue.value.splice(0, 1);
  43306. }
  43307. }
  43308. }
  43309. });
  43310. const filteredValue = vue.computed({
  43311. get() {
  43312. if (props.column) {
  43313. return props.column.filteredValue || [];
  43314. }
  43315. return [];
  43316. },
  43317. set(value) {
  43318. if (props.column) {
  43319. props.upDataColumn("filteredValue", value);
  43320. }
  43321. }
  43322. });
  43323. const multiple = vue.computed(() => {
  43324. if (props.column) {
  43325. return props.column.filterMultiple;
  43326. }
  43327. return true;
  43328. });
  43329. const isActive = (filter) => {
  43330. return filter.value === filterValue.value;
  43331. };
  43332. const hidden = () => {
  43333. tooltipVisible.value = false;
  43334. };
  43335. const showFilterPanel = (e) => {
  43336. e.stopPropagation();
  43337. tooltipVisible.value = !tooltipVisible.value;
  43338. };
  43339. const hideFilterPanel = () => {
  43340. tooltipVisible.value = false;
  43341. };
  43342. const handleConfirm = () => {
  43343. confirmFilter(filteredValue.value);
  43344. hidden();
  43345. };
  43346. const handleReset = () => {
  43347. filteredValue.value = [];
  43348. confirmFilter(filteredValue.value);
  43349. hidden();
  43350. };
  43351. const handleSelect = (_filterValue) => {
  43352. filterValue.value = _filterValue;
  43353. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  43354. confirmFilter(filteredValue.value);
  43355. } else {
  43356. confirmFilter([]);
  43357. }
  43358. hidden();
  43359. };
  43360. const confirmFilter = (filteredValue2) => {
  43361. props.store.commit("filterChange", {
  43362. column: props.column,
  43363. values: filteredValue2
  43364. });
  43365. props.store.updateAllSelected();
  43366. };
  43367. vue.watch(tooltipVisible, (value) => {
  43368. if (props.column) {
  43369. props.upDataColumn("filterOpened", value);
  43370. }
  43371. }, {
  43372. immediate: true
  43373. });
  43374. const popperPaneRef = vue.computed(() => {
  43375. var _a, _b;
  43376. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  43377. });
  43378. return {
  43379. tooltipVisible,
  43380. multiple,
  43381. filterClassName,
  43382. filteredValue,
  43383. filterValue,
  43384. filters,
  43385. handleConfirm,
  43386. handleReset,
  43387. handleSelect,
  43388. isActive,
  43389. t,
  43390. ns,
  43391. showFilterPanel,
  43392. hideFilterPanel,
  43393. popperPaneRef,
  43394. tooltip
  43395. };
  43396. }
  43397. });
  43398. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  43399. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  43400. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  43401. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  43402. const _component_arrow_up = vue.resolveComponent("arrow-up");
  43403. const _component_arrow_down = vue.resolveComponent("arrow-down");
  43404. const _component_el_icon = vue.resolveComponent("el-icon");
  43405. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  43406. const _directive_click_outside = vue.resolveDirective("click-outside");
  43407. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  43408. ref: "tooltip",
  43409. visible: _ctx.tooltipVisible,
  43410. offset: 0,
  43411. placement: _ctx.placement,
  43412. "show-arrow": false,
  43413. "stop-popper-mouse-event": false,
  43414. teleported: "",
  43415. effect: "light",
  43416. pure: "",
  43417. "popper-class": _ctx.filterClassName,
  43418. persistent: ""
  43419. }, {
  43420. content: vue.withCtx(() => [
  43421. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  43422. vue.createElementVNode("div", {
  43423. class: vue.normalizeClass(_ctx.ns.e("content"))
  43424. }, [
  43425. vue.createVNode(_component_el_scrollbar, {
  43426. "wrap-class": _ctx.ns.e("wrap")
  43427. }, {
  43428. default: vue.withCtx(() => [
  43429. vue.createVNode(_component_el_checkbox_group, {
  43430. modelValue: _ctx.filteredValue,
  43431. "onUpdate:modelValue": ($event) => _ctx.filteredValue = $event,
  43432. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  43433. }, {
  43434. default: vue.withCtx(() => [
  43435. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  43436. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  43437. key: filter.value,
  43438. value: filter.value
  43439. }, {
  43440. default: vue.withCtx(() => [
  43441. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  43442. ]),
  43443. _: 2
  43444. }, 1032, ["value"]);
  43445. }), 128))
  43446. ]),
  43447. _: 1
  43448. }, 8, ["modelValue", "onUpdate:modelValue", "class"])
  43449. ]),
  43450. _: 1
  43451. }, 8, ["wrap-class"])
  43452. ], 2),
  43453. vue.createElementVNode("div", {
  43454. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  43455. }, [
  43456. vue.createElementVNode("button", {
  43457. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  43458. disabled: _ctx.filteredValue.length === 0,
  43459. type: "button",
  43460. onClick: _ctx.handleConfirm
  43461. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, ["disabled", "onClick"]),
  43462. vue.createElementVNode("button", {
  43463. type: "button",
  43464. onClick: _ctx.handleReset
  43465. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 9, ["onClick"])
  43466. ], 2)
  43467. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  43468. key: 1,
  43469. class: vue.normalizeClass(_ctx.ns.e("list"))
  43470. }, [
  43471. vue.createElementVNode("li", {
  43472. class: vue.normalizeClass([
  43473. _ctx.ns.e("list-item"),
  43474. {
  43475. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  43476. }
  43477. ]),
  43478. onClick: ($event) => _ctx.handleSelect(null)
  43479. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 11, ["onClick"]),
  43480. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  43481. return vue.openBlock(), vue.createElementBlock("li", {
  43482. key: filter.value,
  43483. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  43484. label: filter.value,
  43485. onClick: ($event) => _ctx.handleSelect(filter.value)
  43486. }, vue.toDisplayString(filter.text), 11, ["label", "onClick"]);
  43487. }), 128))
  43488. ], 2))
  43489. ]),
  43490. default: vue.withCtx(() => [
  43491. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  43492. class: vue.normalizeClass([
  43493. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  43494. `${_ctx.ns.namespace.value}-none-outline`
  43495. ]),
  43496. onClick: _ctx.showFilterPanel
  43497. }, [
  43498. vue.createVNode(_component_el_icon, null, {
  43499. default: vue.withCtx(() => [
  43500. vue.renderSlot(_ctx.$slots, "filter-icon", {}, () => [
  43501. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  43502. ])
  43503. ]),
  43504. _: 3
  43505. })
  43506. ], 10, ["onClick"])), [
  43507. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  43508. ])
  43509. ]),
  43510. _: 3
  43511. }, 8, ["visible", "placement", "popper-class"]);
  43512. }
  43513. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  43514. function useLayoutObserver(root) {
  43515. const instance = vue.getCurrentInstance();
  43516. vue.onBeforeMount(() => {
  43517. tableLayout.value.addObserver(instance);
  43518. });
  43519. vue.onMounted(() => {
  43520. onColumnsChange(tableLayout.value);
  43521. onScrollableChange(tableLayout.value);
  43522. });
  43523. vue.onUpdated(() => {
  43524. onColumnsChange(tableLayout.value);
  43525. onScrollableChange(tableLayout.value);
  43526. });
  43527. vue.onUnmounted(() => {
  43528. tableLayout.value.removeObserver(instance);
  43529. });
  43530. const tableLayout = vue.computed(() => {
  43531. const layout = root.layout;
  43532. if (!layout) {
  43533. throw new Error("Can not find table layout.");
  43534. }
  43535. return layout;
  43536. });
  43537. const onColumnsChange = (layout) => {
  43538. var _a;
  43539. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  43540. if (!cols.length)
  43541. return;
  43542. const flattenColumns = layout.getFlattenColumns();
  43543. const columnsMap = {};
  43544. flattenColumns.forEach((column) => {
  43545. columnsMap[column.id] = column;
  43546. });
  43547. for (let i = 0, j = cols.length; i < j; i++) {
  43548. const col = cols[i];
  43549. const name = col.getAttribute("name");
  43550. const column = columnsMap[name];
  43551. if (column) {
  43552. col.setAttribute("width", column.realWidth || column.width);
  43553. }
  43554. }
  43555. };
  43556. const onScrollableChange = (layout) => {
  43557. var _a, _b;
  43558. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  43559. for (let i = 0, j = cols.length; i < j; i++) {
  43560. const col = cols[i];
  43561. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  43562. }
  43563. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  43564. for (let i = 0, j = ths.length; i < j; i++) {
  43565. const th = ths[i];
  43566. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  43567. th.style.display = layout.scrollY.value ? "" : "none";
  43568. }
  43569. };
  43570. return {
  43571. tableLayout: tableLayout.value,
  43572. onColumnsChange,
  43573. onScrollableChange
  43574. };
  43575. }
  43576. const TABLE_INJECTION_KEY = Symbol("ElTable");
  43577. function useEvent(props, emit) {
  43578. const instance = vue.getCurrentInstance();
  43579. const parent = vue.inject(TABLE_INJECTION_KEY);
  43580. const handleFilterClick = (event) => {
  43581. event.stopPropagation();
  43582. return;
  43583. };
  43584. const handleHeaderClick = (event, column) => {
  43585. if (!column.filters && column.sortable) {
  43586. handleSortClick(event, column, false);
  43587. } else if (column.filterable && !column.sortable) {
  43588. handleFilterClick(event);
  43589. }
  43590. parent == null ? void 0 : parent.emit("header-click", column, event);
  43591. };
  43592. const handleHeaderContextMenu = (event, column) => {
  43593. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  43594. };
  43595. const draggingColumn = vue.ref(null);
  43596. const dragging = vue.ref(false);
  43597. const dragState = vue.ref({});
  43598. const handleMouseDown = (event, column) => {
  43599. if (!isClient)
  43600. return;
  43601. if (column.children && column.children.length > 0)
  43602. return;
  43603. if (draggingColumn.value && props.border) {
  43604. dragging.value = true;
  43605. const table = parent;
  43606. emit("set-drag-visible", true);
  43607. const tableEl = table == null ? void 0 : table.vnode.el;
  43608. const tableLeft = tableEl.getBoundingClientRect().left;
  43609. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  43610. const columnRect = columnEl.getBoundingClientRect();
  43611. const minLeft = columnRect.left - tableLeft + 30;
  43612. addClass(columnEl, "noclick");
  43613. dragState.value = {
  43614. startMouseLeft: event.clientX,
  43615. startLeft: columnRect.right - tableLeft,
  43616. startColumnLeft: columnRect.left - tableLeft,
  43617. tableLeft
  43618. };
  43619. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  43620. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  43621. document.onselectstart = function() {
  43622. return false;
  43623. };
  43624. document.ondragstart = function() {
  43625. return false;
  43626. };
  43627. const handleMouseMove2 = (event2) => {
  43628. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  43629. const proxyLeft = dragState.value.startLeft + deltaLeft;
  43630. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  43631. };
  43632. const handleMouseUp = () => {
  43633. if (dragging.value) {
  43634. const { startColumnLeft, startLeft } = dragState.value;
  43635. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  43636. const columnWidth = finalLeft - startColumnLeft;
  43637. column.width = column.realWidth = columnWidth;
  43638. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  43639. requestAnimationFrame(() => {
  43640. props.store.scheduleLayout(false, true);
  43641. });
  43642. document.body.style.cursor = "";
  43643. dragging.value = false;
  43644. draggingColumn.value = null;
  43645. dragState.value = {};
  43646. emit("set-drag-visible", false);
  43647. }
  43648. document.removeEventListener("mousemove", handleMouseMove2);
  43649. document.removeEventListener("mouseup", handleMouseUp);
  43650. document.onselectstart = null;
  43651. document.ondragstart = null;
  43652. setTimeout(() => {
  43653. removeClass(columnEl, "noclick");
  43654. }, 0);
  43655. };
  43656. document.addEventListener("mousemove", handleMouseMove2);
  43657. document.addEventListener("mouseup", handleMouseUp);
  43658. }
  43659. };
  43660. const handleMouseMove = (event, column) => {
  43661. if (column.children && column.children.length > 0)
  43662. return;
  43663. const el = event.target;
  43664. if (!isElement$1(el)) {
  43665. return;
  43666. }
  43667. const target = el == null ? void 0 : el.closest("th");
  43668. if (!column || !column.resizable)
  43669. return;
  43670. if (!dragging.value && props.border) {
  43671. const rect = target.getBoundingClientRect();
  43672. const bodyStyle = document.body.style;
  43673. if (rect.width > 12 && rect.right - event.pageX < 8) {
  43674. bodyStyle.cursor = "col-resize";
  43675. if (hasClass(target, "is-sortable")) {
  43676. target.style.cursor = "col-resize";
  43677. }
  43678. draggingColumn.value = column;
  43679. } else if (!dragging.value) {
  43680. bodyStyle.cursor = "";
  43681. if (hasClass(target, "is-sortable")) {
  43682. target.style.cursor = "pointer";
  43683. }
  43684. draggingColumn.value = null;
  43685. }
  43686. }
  43687. };
  43688. const handleMouseOut = () => {
  43689. if (!isClient)
  43690. return;
  43691. document.body.style.cursor = "";
  43692. };
  43693. const toggleOrder = ({ order, sortOrders }) => {
  43694. if (order === "")
  43695. return sortOrders[0];
  43696. const index = sortOrders.indexOf(order || null);
  43697. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  43698. };
  43699. const handleSortClick = (event, column, givenOrder) => {
  43700. var _a;
  43701. event.stopPropagation();
  43702. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  43703. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  43704. if (target) {
  43705. if (hasClass(target, "noclick")) {
  43706. removeClass(target, "noclick");
  43707. return;
  43708. }
  43709. }
  43710. if (!column.sortable)
  43711. return;
  43712. const clickTarget = event.currentTarget;
  43713. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) {
  43714. return;
  43715. }
  43716. const states = props.store.states;
  43717. let sortProp = states.sortProp.value;
  43718. let sortOrder;
  43719. const sortingColumn = states.sortingColumn.value;
  43720. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  43721. if (sortingColumn) {
  43722. sortingColumn.order = null;
  43723. }
  43724. states.sortingColumn.value = column;
  43725. sortProp = column.property;
  43726. }
  43727. if (!order) {
  43728. sortOrder = column.order = null;
  43729. } else {
  43730. sortOrder = column.order = order;
  43731. }
  43732. states.sortProp.value = sortProp;
  43733. states.sortOrder.value = sortOrder;
  43734. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  43735. };
  43736. return {
  43737. handleHeaderClick,
  43738. handleHeaderContextMenu,
  43739. handleMouseDown,
  43740. handleMouseMove,
  43741. handleMouseOut,
  43742. handleSortClick,
  43743. handleFilterClick
  43744. };
  43745. }
  43746. function useStyle$2(props) {
  43747. const parent = vue.inject(TABLE_INJECTION_KEY);
  43748. const ns = useNamespace("table");
  43749. const getHeaderRowStyle = (rowIndex) => {
  43750. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  43751. if (typeof headerRowStyle === "function") {
  43752. return headerRowStyle.call(null, { rowIndex });
  43753. }
  43754. return headerRowStyle;
  43755. };
  43756. const getHeaderRowClass = (rowIndex) => {
  43757. const classes = [];
  43758. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  43759. if (typeof headerRowClassName === "string") {
  43760. classes.push(headerRowClassName);
  43761. } else if (typeof headerRowClassName === "function") {
  43762. classes.push(headerRowClassName.call(null, { rowIndex }));
  43763. }
  43764. return classes.join(" ");
  43765. };
  43766. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  43767. var _a;
  43768. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  43769. if (typeof headerCellStyles === "function") {
  43770. headerCellStyles = headerCellStyles.call(null, {
  43771. rowIndex,
  43772. columnIndex,
  43773. row,
  43774. column
  43775. });
  43776. }
  43777. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  43778. ensurePosition(fixedStyle, "left");
  43779. ensurePosition(fixedStyle, "right");
  43780. return Object.assign({}, headerCellStyles, fixedStyle);
  43781. };
  43782. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  43783. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  43784. const classes = [
  43785. column.id,
  43786. column.order,
  43787. column.headerAlign,
  43788. column.className,
  43789. column.labelClassName,
  43790. ...fixedClasses
  43791. ];
  43792. if (!column.children) {
  43793. classes.push("is-leaf");
  43794. }
  43795. if (column.sortable) {
  43796. classes.push("is-sortable");
  43797. }
  43798. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  43799. if (typeof headerCellClassName === "string") {
  43800. classes.push(headerCellClassName);
  43801. } else if (typeof headerCellClassName === "function") {
  43802. classes.push(headerCellClassName.call(null, {
  43803. rowIndex,
  43804. columnIndex,
  43805. row,
  43806. column
  43807. }));
  43808. }
  43809. classes.push(ns.e("cell"));
  43810. return classes.filter((className) => Boolean(className)).join(" ");
  43811. };
  43812. return {
  43813. getHeaderRowStyle,
  43814. getHeaderRowClass,
  43815. getHeaderCellStyle,
  43816. getHeaderCellClass
  43817. };
  43818. }
  43819. const getAllColumns = (columns) => {
  43820. const result = [];
  43821. columns.forEach((column) => {
  43822. if (column.children) {
  43823. result.push(column);
  43824. result.push.apply(result, getAllColumns(column.children));
  43825. } else {
  43826. result.push(column);
  43827. }
  43828. });
  43829. return result;
  43830. };
  43831. const convertToRows = (originColumns) => {
  43832. let maxLevel = 1;
  43833. const traverse = (column, parent) => {
  43834. if (parent) {
  43835. column.level = parent.level + 1;
  43836. if (maxLevel < column.level) {
  43837. maxLevel = column.level;
  43838. }
  43839. }
  43840. if (column.children) {
  43841. let colSpan = 0;
  43842. column.children.forEach((subColumn) => {
  43843. traverse(subColumn, column);
  43844. colSpan += subColumn.colSpan;
  43845. });
  43846. column.colSpan = colSpan;
  43847. } else {
  43848. column.colSpan = 1;
  43849. }
  43850. };
  43851. originColumns.forEach((column) => {
  43852. column.level = 1;
  43853. traverse(column, void 0);
  43854. });
  43855. const rows = [];
  43856. for (let i = 0; i < maxLevel; i++) {
  43857. rows.push([]);
  43858. }
  43859. const allColumns = getAllColumns(originColumns);
  43860. allColumns.forEach((column) => {
  43861. if (!column.children) {
  43862. column.rowSpan = maxLevel - column.level + 1;
  43863. } else {
  43864. column.rowSpan = 1;
  43865. column.children.forEach((col) => col.isSubColumn = true);
  43866. }
  43867. rows[column.level - 1].push(column);
  43868. });
  43869. return rows;
  43870. };
  43871. function useUtils$1(props) {
  43872. const parent = vue.inject(TABLE_INJECTION_KEY);
  43873. const columnRows = vue.computed(() => {
  43874. return convertToRows(props.store.states.originColumns.value);
  43875. });
  43876. const isGroup = vue.computed(() => {
  43877. const result = columnRows.value.length > 1;
  43878. if (result && parent) {
  43879. parent.state.isGroup.value = true;
  43880. }
  43881. return result;
  43882. });
  43883. const toggleAllSelection = (event) => {
  43884. event.stopPropagation();
  43885. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  43886. };
  43887. return {
  43888. isGroup,
  43889. toggleAllSelection,
  43890. columnRows
  43891. };
  43892. }
  43893. var TableHeader = vue.defineComponent({
  43894. name: "ElTableHeader",
  43895. components: {
  43896. ElCheckbox
  43897. },
  43898. props: {
  43899. fixed: {
  43900. type: String,
  43901. default: ""
  43902. },
  43903. store: {
  43904. required: true,
  43905. type: Object
  43906. },
  43907. border: Boolean,
  43908. defaultSort: {
  43909. type: Object,
  43910. default: () => {
  43911. return {
  43912. prop: "",
  43913. order: ""
  43914. };
  43915. }
  43916. }
  43917. },
  43918. setup(props, { emit }) {
  43919. const instance = vue.getCurrentInstance();
  43920. const parent = vue.inject(TABLE_INJECTION_KEY);
  43921. const ns = useNamespace("table");
  43922. const filterPanels = vue.ref({});
  43923. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  43924. vue.onMounted(async () => {
  43925. await vue.nextTick();
  43926. await vue.nextTick();
  43927. const { prop, order } = props.defaultSort;
  43928. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  43929. });
  43930. const {
  43931. handleHeaderClick,
  43932. handleHeaderContextMenu,
  43933. handleMouseDown,
  43934. handleMouseMove,
  43935. handleMouseOut,
  43936. handleSortClick,
  43937. handleFilterClick
  43938. } = useEvent(props, emit);
  43939. const {
  43940. getHeaderRowStyle,
  43941. getHeaderRowClass,
  43942. getHeaderCellStyle,
  43943. getHeaderCellClass
  43944. } = useStyle$2(props);
  43945. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  43946. instance.state = {
  43947. onColumnsChange,
  43948. onScrollableChange
  43949. };
  43950. instance.filterPanels = filterPanels;
  43951. return {
  43952. ns,
  43953. filterPanels,
  43954. onColumnsChange,
  43955. onScrollableChange,
  43956. columnRows,
  43957. getHeaderRowClass,
  43958. getHeaderRowStyle,
  43959. getHeaderCellClass,
  43960. getHeaderCellStyle,
  43961. handleHeaderClick,
  43962. handleHeaderContextMenu,
  43963. handleMouseDown,
  43964. handleMouseMove,
  43965. handleMouseOut,
  43966. handleSortClick,
  43967. handleFilterClick,
  43968. isGroup,
  43969. toggleAllSelection
  43970. };
  43971. },
  43972. render() {
  43973. const {
  43974. ns,
  43975. isGroup,
  43976. columnRows,
  43977. getHeaderCellStyle,
  43978. getHeaderCellClass,
  43979. getHeaderRowClass,
  43980. getHeaderRowStyle,
  43981. handleHeaderClick,
  43982. handleHeaderContextMenu,
  43983. handleMouseDown,
  43984. handleMouseMove,
  43985. handleSortClick,
  43986. handleMouseOut,
  43987. store,
  43988. $parent
  43989. } = this;
  43990. let rowSpan = 1;
  43991. return vue.h("thead", {
  43992. class: { [ns.is("group")]: isGroup }
  43993. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  43994. class: getHeaderRowClass(rowIndex),
  43995. key: rowIndex,
  43996. style: getHeaderRowStyle(rowIndex)
  43997. }, subColumns.map((column, cellIndex) => {
  43998. if (column.rowSpan > rowSpan) {
  43999. rowSpan = column.rowSpan;
  44000. }
  44001. return vue.h("th", {
  44002. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  44003. colspan: column.colSpan,
  44004. key: `${column.id}-thead`,
  44005. rowspan: column.rowSpan,
  44006. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  44007. onClick: ($event) => {
  44008. if ($event.currentTarget.classList.contains("noclick")) {
  44009. return;
  44010. }
  44011. handleHeaderClick($event, column);
  44012. },
  44013. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  44014. onMousedown: ($event) => handleMouseDown($event, column),
  44015. onMousemove: ($event) => handleMouseMove($event, column),
  44016. onMouseout: handleMouseOut
  44017. }, [
  44018. vue.h("div", {
  44019. class: [
  44020. "cell",
  44021. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  44022. ]
  44023. }, [
  44024. column.renderHeader ? column.renderHeader({
  44025. column,
  44026. $index: cellIndex,
  44027. store,
  44028. _self: $parent
  44029. }) : column.label,
  44030. column.sortable && vue.h("span", {
  44031. onClick: ($event) => handleSortClick($event, column),
  44032. class: "caret-wrapper"
  44033. }, [
  44034. vue.h("i", {
  44035. onClick: ($event) => handleSortClick($event, column, "ascending"),
  44036. class: "sort-caret ascending"
  44037. }),
  44038. vue.h("i", {
  44039. onClick: ($event) => handleSortClick($event, column, "descending"),
  44040. class: "sort-caret descending"
  44041. })
  44042. ]),
  44043. column.filterable && vue.h(FilterPanel, {
  44044. store,
  44045. placement: column.filterPlacement || "bottom-start",
  44046. column,
  44047. upDataColumn: (key, value) => {
  44048. column[key] = value;
  44049. }
  44050. }, {
  44051. "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({
  44052. filterOpened: column.filterOpened
  44053. }) : null
  44054. })
  44055. ])
  44056. ]);
  44057. }))));
  44058. }
  44059. });
  44060. function isGreaterThan(a, b, epsilon = 0.03) {
  44061. return a - b > epsilon;
  44062. }
  44063. function useEvents(props) {
  44064. const parent = vue.inject(TABLE_INJECTION_KEY);
  44065. const tooltipContent = vue.ref("");
  44066. const tooltipTrigger = vue.ref(vue.h("div"));
  44067. const handleEvent = (event, row, name) => {
  44068. var _a;
  44069. const table = parent;
  44070. const cell = getCell(event);
  44071. let column;
  44072. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  44073. if (cell) {
  44074. column = getColumnByCell({
  44075. columns: props.store.states.columns.value
  44076. }, cell, namespace);
  44077. if (column) {
  44078. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  44079. }
  44080. }
  44081. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  44082. };
  44083. const handleDoubleClick = (event, row) => {
  44084. handleEvent(event, row, "dblclick");
  44085. };
  44086. const handleClick = (event, row) => {
  44087. props.store.commit("setCurrentRow", row);
  44088. handleEvent(event, row, "click");
  44089. };
  44090. const handleContextMenu = (event, row) => {
  44091. handleEvent(event, row, "contextmenu");
  44092. };
  44093. const handleMouseEnter = debounce((index) => {
  44094. props.store.commit("setHoverRow", index);
  44095. }, 30);
  44096. const handleMouseLeave = debounce(() => {
  44097. props.store.commit("setHoverRow", null);
  44098. }, 30);
  44099. const getPadding = (el) => {
  44100. const style = window.getComputedStyle(el, null);
  44101. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  44102. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  44103. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  44104. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  44105. return {
  44106. left: paddingLeft,
  44107. right: paddingRight,
  44108. top: paddingTop,
  44109. bottom: paddingBottom
  44110. };
  44111. };
  44112. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  44113. let node = event.target.parentNode;
  44114. while (rowSpan > 1) {
  44115. node = node == null ? void 0 : node.nextSibling;
  44116. if (!node || node.nodeName !== "TR")
  44117. break;
  44118. toggle(node, "hover-row hover-fixed-row");
  44119. rowSpan--;
  44120. }
  44121. };
  44122. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  44123. var _a;
  44124. const table = parent;
  44125. const cell = getCell(event);
  44126. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  44127. if (cell) {
  44128. const column = getColumnByCell({
  44129. columns: props.store.states.columns.value
  44130. }, cell, namespace);
  44131. if (cell.rowSpan > 1) {
  44132. toggleRowClassByCell(cell.rowSpan, event, addClass);
  44133. }
  44134. const hoverState = table.hoverState = { cell, column, row };
  44135. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  44136. }
  44137. if (!tooltipOptions) {
  44138. return;
  44139. }
  44140. const cellChild = event.target.querySelector(".cell");
  44141. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  44142. return;
  44143. }
  44144. const range = document.createRange();
  44145. range.setStart(cellChild, 0);
  44146. range.setEnd(cellChild, cellChild.childNodes.length);
  44147. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  44148. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  44149. const { top, left, right, bottom } = getPadding(cellChild);
  44150. const horizontalPadding = left + right;
  44151. const verticalPadding = top + bottom;
  44152. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  44153. createTablePopper(tooltipOptions, cell.innerText || cell.textContent, cell, table);
  44154. }
  44155. };
  44156. const handleCellMouseLeave = (event) => {
  44157. const cell = getCell(event);
  44158. if (!cell)
  44159. return;
  44160. if (cell.rowSpan > 1) {
  44161. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  44162. }
  44163. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  44164. 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);
  44165. };
  44166. return {
  44167. handleDoubleClick,
  44168. handleClick,
  44169. handleContextMenu,
  44170. handleMouseEnter,
  44171. handleMouseLeave,
  44172. handleCellMouseEnter,
  44173. handleCellMouseLeave,
  44174. tooltipContent,
  44175. tooltipTrigger
  44176. };
  44177. }
  44178. function useStyles$1(props) {
  44179. const parent = vue.inject(TABLE_INJECTION_KEY);
  44180. const ns = useNamespace("table");
  44181. const getRowStyle = (row, rowIndex) => {
  44182. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  44183. if (typeof rowStyle === "function") {
  44184. return rowStyle.call(null, {
  44185. row,
  44186. rowIndex
  44187. });
  44188. }
  44189. return rowStyle || null;
  44190. };
  44191. const getRowClass = (row, rowIndex) => {
  44192. const classes = [ns.e("row")];
  44193. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  44194. classes.push("current-row");
  44195. }
  44196. if (props.stripe && rowIndex % 2 === 1) {
  44197. classes.push(ns.em("row", "striped"));
  44198. }
  44199. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  44200. if (typeof rowClassName === "string") {
  44201. classes.push(rowClassName);
  44202. } else if (typeof rowClassName === "function") {
  44203. classes.push(rowClassName.call(null, {
  44204. row,
  44205. rowIndex
  44206. }));
  44207. }
  44208. return classes;
  44209. };
  44210. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  44211. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  44212. let cellStyles = cellStyle != null ? cellStyle : {};
  44213. if (typeof cellStyle === "function") {
  44214. cellStyles = cellStyle.call(null, {
  44215. rowIndex,
  44216. columnIndex,
  44217. row,
  44218. column
  44219. });
  44220. }
  44221. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  44222. ensurePosition(fixedStyle, "left");
  44223. ensurePosition(fixedStyle, "right");
  44224. return Object.assign({}, cellStyles, fixedStyle);
  44225. };
  44226. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  44227. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  44228. const classes = [column.id, column.align, column.className, ...fixedClasses];
  44229. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  44230. if (typeof cellClassName === "string") {
  44231. classes.push(cellClassName);
  44232. } else if (typeof cellClassName === "function") {
  44233. classes.push(cellClassName.call(null, {
  44234. rowIndex,
  44235. columnIndex,
  44236. row,
  44237. column
  44238. }));
  44239. }
  44240. classes.push(ns.e("cell"));
  44241. return classes.filter((className) => Boolean(className)).join(" ");
  44242. };
  44243. const getSpan = (row, column, rowIndex, columnIndex) => {
  44244. let rowspan = 1;
  44245. let colspan = 1;
  44246. const fn = parent == null ? void 0 : parent.props.spanMethod;
  44247. if (typeof fn === "function") {
  44248. const result = fn({
  44249. row,
  44250. column,
  44251. rowIndex,
  44252. columnIndex
  44253. });
  44254. if (Array.isArray(result)) {
  44255. rowspan = result[0];
  44256. colspan = result[1];
  44257. } else if (typeof result === "object") {
  44258. rowspan = result.rowspan;
  44259. colspan = result.colspan;
  44260. }
  44261. }
  44262. return { rowspan, colspan };
  44263. };
  44264. const getColspanRealWidth = (columns, colspan, index) => {
  44265. if (colspan < 1) {
  44266. return columns[index].realWidth;
  44267. }
  44268. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  44269. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  44270. };
  44271. return {
  44272. getRowStyle,
  44273. getRowClass,
  44274. getCellStyle,
  44275. getCellClass,
  44276. getSpan,
  44277. getColspanRealWidth
  44278. };
  44279. }
  44280. function useRender$1(props) {
  44281. const parent = vue.inject(TABLE_INJECTION_KEY);
  44282. const ns = useNamespace("table");
  44283. const {
  44284. handleDoubleClick,
  44285. handleClick,
  44286. handleContextMenu,
  44287. handleMouseEnter,
  44288. handleMouseLeave,
  44289. handleCellMouseEnter,
  44290. handleCellMouseLeave,
  44291. tooltipContent,
  44292. tooltipTrigger
  44293. } = useEvents(props);
  44294. const {
  44295. getRowStyle,
  44296. getRowClass,
  44297. getCellStyle,
  44298. getCellClass,
  44299. getSpan,
  44300. getColspanRealWidth
  44301. } = useStyles$1(props);
  44302. const firstDefaultColumnIndex = vue.computed(() => {
  44303. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  44304. });
  44305. const getKeyOfRow = (row, index) => {
  44306. const rowKey = parent.props.rowKey;
  44307. if (rowKey) {
  44308. return getRowIdentity(row, rowKey);
  44309. }
  44310. return index;
  44311. };
  44312. const rowRender = (row, $index, treeRowData, expanded = false) => {
  44313. const { tooltipEffect, tooltipOptions, store } = props;
  44314. const { indent, columns } = store.states;
  44315. const rowClasses = getRowClass(row, $index);
  44316. let display = true;
  44317. if (treeRowData) {
  44318. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  44319. display = treeRowData.display;
  44320. }
  44321. const displayStyle = display ? null : {
  44322. display: "none"
  44323. };
  44324. return vue.h("tr", {
  44325. style: [displayStyle, getRowStyle(row, $index)],
  44326. class: rowClasses,
  44327. key: getKeyOfRow(row, $index),
  44328. onDblclick: ($event) => handleDoubleClick($event, row),
  44329. onClick: ($event) => handleClick($event, row),
  44330. onContextmenu: ($event) => handleContextMenu($event, row),
  44331. onMouseenter: () => handleMouseEnter($index),
  44332. onMouseleave: handleMouseLeave
  44333. }, columns.value.map((column, cellIndex) => {
  44334. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  44335. if (!rowspan || !colspan) {
  44336. return null;
  44337. }
  44338. const columnData = Object.assign({}, column);
  44339. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  44340. const data = {
  44341. store: props.store,
  44342. _self: props.context || parent,
  44343. column: columnData,
  44344. row,
  44345. $index,
  44346. cellIndex,
  44347. expanded
  44348. };
  44349. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  44350. data.treeNode = {
  44351. indent: treeRowData.level * indent.value,
  44352. level: treeRowData.level
  44353. };
  44354. if (typeof treeRowData.expanded === "boolean") {
  44355. data.treeNode.expanded = treeRowData.expanded;
  44356. if ("loading" in treeRowData) {
  44357. data.treeNode.loading = treeRowData.loading;
  44358. }
  44359. if ("noLazyChildren" in treeRowData) {
  44360. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  44361. }
  44362. }
  44363. }
  44364. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  44365. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  44366. const tdChildren = cellChildren(cellIndex, column, data);
  44367. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  44368. effect: tooltipEffect
  44369. }, tooltipOptions, column.showOverflowTooltip);
  44370. return vue.h("td", {
  44371. style: getCellStyle($index, cellIndex, row, column),
  44372. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  44373. key: `${patchKey}${baseKey}`,
  44374. rowspan,
  44375. colspan,
  44376. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  44377. onMouseleave: handleCellMouseLeave
  44378. }, [tdChildren]);
  44379. }));
  44380. };
  44381. const cellChildren = (cellIndex, column, data) => {
  44382. return column.renderCell(data);
  44383. };
  44384. const wrappedRowRender = (row, $index) => {
  44385. const store = props.store;
  44386. const { isRowExpanded, assertRowKey } = store;
  44387. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  44388. const columns = store.states.columns.value;
  44389. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  44390. if (hasExpandColumn) {
  44391. const expanded = isRowExpanded(row);
  44392. const tr = rowRender(row, $index, void 0, expanded);
  44393. const renderExpanded = parent.renderExpanded;
  44394. if (expanded) {
  44395. if (!renderExpanded) {
  44396. console.error("[Element Error]renderExpanded is required.");
  44397. return tr;
  44398. }
  44399. return [
  44400. [
  44401. tr,
  44402. vue.h("tr", {
  44403. key: `expanded-row__${tr.key}`
  44404. }, [
  44405. vue.h("td", {
  44406. colspan: columns.length,
  44407. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  44408. }, [renderExpanded({ row, $index, store, expanded })])
  44409. ])
  44410. ]
  44411. ];
  44412. } else {
  44413. return [[tr]];
  44414. }
  44415. } else if (Object.keys(treeData.value).length) {
  44416. assertRowKey();
  44417. const key = getRowIdentity(row, rowKey.value);
  44418. let cur = treeData.value[key];
  44419. let treeRowData = null;
  44420. if (cur) {
  44421. treeRowData = {
  44422. expanded: cur.expanded,
  44423. level: cur.level,
  44424. display: true
  44425. };
  44426. if (typeof cur.lazy === "boolean") {
  44427. if (typeof cur.loaded === "boolean" && cur.loaded) {
  44428. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  44429. }
  44430. treeRowData.loading = cur.loading;
  44431. }
  44432. }
  44433. const tmp = [rowRender(row, $index, treeRowData)];
  44434. if (cur) {
  44435. let i = 0;
  44436. const traverse = (children, parent2) => {
  44437. if (!(children && children.length && parent2))
  44438. return;
  44439. children.forEach((node) => {
  44440. const innerTreeRowData = {
  44441. display: parent2.display && parent2.expanded,
  44442. level: parent2.level + 1,
  44443. expanded: false,
  44444. noLazyChildren: false,
  44445. loading: false
  44446. };
  44447. const childKey = getRowIdentity(node, rowKey.value);
  44448. if (childKey === void 0 || childKey === null) {
  44449. throw new Error("For nested data item, row-key is required.");
  44450. }
  44451. cur = { ...treeData.value[childKey] };
  44452. if (cur) {
  44453. innerTreeRowData.expanded = cur.expanded;
  44454. cur.level = cur.level || innerTreeRowData.level;
  44455. cur.display = !!(cur.expanded && innerTreeRowData.display);
  44456. if (typeof cur.lazy === "boolean") {
  44457. if (typeof cur.loaded === "boolean" && cur.loaded) {
  44458. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  44459. }
  44460. innerTreeRowData.loading = cur.loading;
  44461. }
  44462. }
  44463. i++;
  44464. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  44465. if (cur) {
  44466. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  44467. traverse(nodes2, cur);
  44468. }
  44469. });
  44470. };
  44471. cur.display = true;
  44472. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  44473. traverse(nodes, cur);
  44474. }
  44475. return tmp;
  44476. } else {
  44477. return rowRender(row, $index, void 0);
  44478. }
  44479. };
  44480. return {
  44481. wrappedRowRender,
  44482. tooltipContent,
  44483. tooltipTrigger
  44484. };
  44485. }
  44486. const defaultProps$2 = {
  44487. store: {
  44488. required: true,
  44489. type: Object
  44490. },
  44491. stripe: Boolean,
  44492. tooltipEffect: String,
  44493. tooltipOptions: {
  44494. type: Object
  44495. },
  44496. context: {
  44497. default: () => ({}),
  44498. type: Object
  44499. },
  44500. rowClassName: [String, Function],
  44501. rowStyle: [Object, Function],
  44502. fixed: {
  44503. type: String,
  44504. default: ""
  44505. },
  44506. highlight: Boolean
  44507. };
  44508. var defaultProps$3 = defaultProps$2;
  44509. var TableBody = vue.defineComponent({
  44510. name: "ElTableBody",
  44511. props: defaultProps$3,
  44512. setup(props) {
  44513. const instance = vue.getCurrentInstance();
  44514. const parent = vue.inject(TABLE_INJECTION_KEY);
  44515. const ns = useNamespace("table");
  44516. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  44517. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  44518. const hoveredCellList = [];
  44519. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  44520. var _a;
  44521. const el = instance == null ? void 0 : instance.vnode.el;
  44522. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  44523. let rowNum = newVal;
  44524. const childNodes = (_a = rows[rowNum]) == null ? void 0 : _a.childNodes;
  44525. if (childNodes == null ? void 0 : childNodes.length) {
  44526. let control = 0;
  44527. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  44528. var _a2, _b;
  44529. if (((_a2 = childNodes[index]) == null ? void 0 : _a2.colSpan) > 1) {
  44530. control = (_b = childNodes[index]) == null ? void 0 : _b.colSpan;
  44531. }
  44532. if (item.nodeName !== "TD" && control === 0) {
  44533. acc.push(index);
  44534. }
  44535. control > 0 && control--;
  44536. return acc;
  44537. }, []);
  44538. indexes.forEach((rowIndex) => {
  44539. var _a2;
  44540. rowNum = newVal;
  44541. while (rowNum > 0) {
  44542. const preChildNodes = (_a2 = rows[rowNum - 1]) == null ? void 0 : _a2.childNodes;
  44543. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  44544. addClass(preChildNodes[rowIndex], "hover-cell");
  44545. hoveredCellList.push(preChildNodes[rowIndex]);
  44546. break;
  44547. }
  44548. rowNum--;
  44549. }
  44550. });
  44551. } else {
  44552. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  44553. hoveredCellList.length = 0;
  44554. }
  44555. if (!props.store.states.isComplex.value || !isClient)
  44556. return;
  44557. rAF(() => {
  44558. const oldRow = rows[oldVal];
  44559. const newRow = rows[newVal];
  44560. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  44561. removeClass(oldRow, "hover-row");
  44562. }
  44563. if (newRow) {
  44564. addClass(newRow, "hover-row");
  44565. }
  44566. });
  44567. });
  44568. vue.onUnmounted(() => {
  44569. var _a;
  44570. (_a = removePopper) == null ? void 0 : _a();
  44571. });
  44572. return {
  44573. ns,
  44574. onColumnsChange,
  44575. onScrollableChange,
  44576. wrappedRowRender,
  44577. tooltipContent,
  44578. tooltipTrigger
  44579. };
  44580. },
  44581. render() {
  44582. const { wrappedRowRender, store } = this;
  44583. const data = store.states.data.value || [];
  44584. return vue.h("tbody", { tabIndex: -1 }, [
  44585. data.reduce((acc, row) => {
  44586. return acc.concat(wrappedRowRender(row, acc.length));
  44587. }, [])
  44588. ]);
  44589. }
  44590. });
  44591. function useMapState() {
  44592. const table = vue.inject(TABLE_INJECTION_KEY);
  44593. const store = table == null ? void 0 : table.store;
  44594. const leftFixedLeafCount = vue.computed(() => {
  44595. return store.states.fixedLeafColumnsLength.value;
  44596. });
  44597. const rightFixedLeafCount = vue.computed(() => {
  44598. return store.states.rightFixedColumns.value.length;
  44599. });
  44600. const columnsCount = vue.computed(() => {
  44601. return store.states.columns.value.length;
  44602. });
  44603. const leftFixedCount = vue.computed(() => {
  44604. return store.states.fixedColumns.value.length;
  44605. });
  44606. const rightFixedCount = vue.computed(() => {
  44607. return store.states.rightFixedColumns.value.length;
  44608. });
  44609. return {
  44610. leftFixedLeafCount,
  44611. rightFixedLeafCount,
  44612. columnsCount,
  44613. leftFixedCount,
  44614. rightFixedCount,
  44615. columns: store.states.columns
  44616. };
  44617. }
  44618. function useStyle$1(props) {
  44619. const { columns } = useMapState();
  44620. const ns = useNamespace("table");
  44621. const getCellClasses = (columns2, cellIndex) => {
  44622. const column = columns2[cellIndex];
  44623. const classes = [
  44624. ns.e("cell"),
  44625. column.id,
  44626. column.align,
  44627. column.labelClassName,
  44628. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  44629. ];
  44630. if (column.className) {
  44631. classes.push(column.className);
  44632. }
  44633. if (!column.children) {
  44634. classes.push(ns.is("leaf"));
  44635. }
  44636. return classes;
  44637. };
  44638. const getCellStyles = (column, cellIndex) => {
  44639. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  44640. ensurePosition(fixedStyle, "left");
  44641. ensurePosition(fixedStyle, "right");
  44642. return fixedStyle;
  44643. };
  44644. return {
  44645. getCellClasses,
  44646. getCellStyles,
  44647. columns
  44648. };
  44649. }
  44650. var TableFooter = vue.defineComponent({
  44651. name: "ElTableFooter",
  44652. props: {
  44653. fixed: {
  44654. type: String,
  44655. default: ""
  44656. },
  44657. store: {
  44658. required: true,
  44659. type: Object
  44660. },
  44661. summaryMethod: Function,
  44662. sumText: String,
  44663. border: Boolean,
  44664. defaultSort: {
  44665. type: Object,
  44666. default: () => {
  44667. return {
  44668. prop: "",
  44669. order: ""
  44670. };
  44671. }
  44672. }
  44673. },
  44674. setup(props) {
  44675. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  44676. const ns = useNamespace("table");
  44677. return {
  44678. ns,
  44679. getCellClasses,
  44680. getCellStyles,
  44681. columns
  44682. };
  44683. },
  44684. render() {
  44685. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  44686. const data = this.store.states.data.value;
  44687. let sums = [];
  44688. if (summaryMethod) {
  44689. sums = summaryMethod({
  44690. columns,
  44691. data
  44692. });
  44693. } else {
  44694. columns.forEach((column, index) => {
  44695. if (index === 0) {
  44696. sums[index] = sumText;
  44697. return;
  44698. }
  44699. const values = data.map((item) => Number(item[column.property]));
  44700. const precisions = [];
  44701. let notNumber = true;
  44702. values.forEach((value) => {
  44703. if (!Number.isNaN(+value)) {
  44704. notNumber = false;
  44705. const decimal = `${value}`.split(".")[1];
  44706. precisions.push(decimal ? decimal.length : 0);
  44707. }
  44708. });
  44709. const precision = Math.max.apply(null, precisions);
  44710. if (!notNumber) {
  44711. sums[index] = values.reduce((prev, curr) => {
  44712. const value = Number(curr);
  44713. if (!Number.isNaN(+value)) {
  44714. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  44715. } else {
  44716. return prev;
  44717. }
  44718. }, 0);
  44719. } else {
  44720. sums[index] = "";
  44721. }
  44722. });
  44723. }
  44724. return vue.h(vue.h("tfoot", [
  44725. vue.h("tr", {}, [
  44726. ...columns.map((column, cellIndex) => vue.h("td", {
  44727. key: cellIndex,
  44728. colspan: column.colSpan,
  44729. rowspan: column.rowSpan,
  44730. class: getCellClasses(columns, cellIndex),
  44731. style: getCellStyles(column, cellIndex)
  44732. }, [
  44733. vue.h("div", {
  44734. class: ["cell", column.labelClassName]
  44735. }, [sums[cellIndex]])
  44736. ]))
  44737. ])
  44738. ]));
  44739. }
  44740. });
  44741. function useUtils(store) {
  44742. const setCurrentRow = (row) => {
  44743. store.commit("setCurrentRow", row);
  44744. };
  44745. const getSelectionRows = () => {
  44746. return store.getSelectionRows();
  44747. };
  44748. const toggleRowSelection = (row, selected) => {
  44749. store.toggleRowSelection(row, selected, false);
  44750. store.updateAllSelected();
  44751. };
  44752. const clearSelection = () => {
  44753. store.clearSelection();
  44754. };
  44755. const clearFilter = (columnKeys) => {
  44756. store.clearFilter(columnKeys);
  44757. };
  44758. const toggleAllSelection = () => {
  44759. store.commit("toggleAllSelection");
  44760. };
  44761. const toggleRowExpansion = (row, expanded) => {
  44762. store.toggleRowExpansionAdapter(row, expanded);
  44763. };
  44764. const clearSort = () => {
  44765. store.clearSort();
  44766. };
  44767. const sort = (prop, order) => {
  44768. store.commit("sort", { prop, order });
  44769. };
  44770. return {
  44771. setCurrentRow,
  44772. getSelectionRows,
  44773. toggleRowSelection,
  44774. clearSelection,
  44775. clearFilter,
  44776. toggleAllSelection,
  44777. toggleRowExpansion,
  44778. clearSort,
  44779. sort
  44780. };
  44781. }
  44782. function useStyle(props, layout, store, table) {
  44783. const isHidden = vue.ref(false);
  44784. const renderExpanded = vue.ref(null);
  44785. const resizeProxyVisible = vue.ref(false);
  44786. const setDragVisible = (visible) => {
  44787. resizeProxyVisible.value = visible;
  44788. };
  44789. const resizeState = vue.ref({
  44790. width: null,
  44791. height: null,
  44792. headerHeight: null
  44793. });
  44794. const isGroup = vue.ref(false);
  44795. const scrollbarViewStyle = {
  44796. display: "inline-block",
  44797. verticalAlign: "middle"
  44798. };
  44799. const tableWidth = vue.ref();
  44800. const tableScrollHeight = vue.ref(0);
  44801. const bodyScrollHeight = vue.ref(0);
  44802. const headerScrollHeight = vue.ref(0);
  44803. const footerScrollHeight = vue.ref(0);
  44804. const appendScrollHeight = vue.ref(0);
  44805. vue.watchEffect(() => {
  44806. layout.setHeight(props.height);
  44807. });
  44808. vue.watchEffect(() => {
  44809. layout.setMaxHeight(props.maxHeight);
  44810. });
  44811. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  44812. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  44813. return;
  44814. store.setCurrentRowKey(`${currentRowKey}`);
  44815. }, {
  44816. immediate: true
  44817. });
  44818. vue.watch(() => props.data, (data) => {
  44819. table.store.commit("setData", data);
  44820. }, {
  44821. immediate: true,
  44822. deep: true
  44823. });
  44824. vue.watchEffect(() => {
  44825. if (props.expandRowKeys) {
  44826. store.setExpandRowKeysAdapter(props.expandRowKeys);
  44827. }
  44828. });
  44829. const handleMouseLeave = () => {
  44830. table.store.commit("setHoverRow", null);
  44831. if (table.hoverState)
  44832. table.hoverState = null;
  44833. };
  44834. const handleHeaderFooterMousewheel = (event, data) => {
  44835. const { pixelX, pixelY } = data;
  44836. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  44837. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  44838. }
  44839. };
  44840. const shouldUpdateHeight = vue.computed(() => {
  44841. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  44842. });
  44843. const tableBodyStyles = vue.computed(() => {
  44844. return {
  44845. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  44846. };
  44847. });
  44848. const doLayout = () => {
  44849. if (shouldUpdateHeight.value) {
  44850. layout.updateElsHeight();
  44851. }
  44852. layout.updateColumnsWidth();
  44853. requestAnimationFrame(syncPosition);
  44854. };
  44855. vue.onMounted(async () => {
  44856. await vue.nextTick();
  44857. store.updateColumns();
  44858. bindEvents();
  44859. requestAnimationFrame(doLayout);
  44860. const el = table.vnode.el;
  44861. const tableHeader = table.refs.headerWrapper;
  44862. if (props.flexible && el && el.parentElement) {
  44863. el.parentElement.style.minWidth = "0";
  44864. }
  44865. resizeState.value = {
  44866. width: tableWidth.value = el.offsetWidth,
  44867. height: el.offsetHeight,
  44868. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  44869. };
  44870. store.states.columns.value.forEach((column) => {
  44871. if (column.filteredValue && column.filteredValue.length) {
  44872. table.store.commit("filterChange", {
  44873. column,
  44874. values: column.filteredValue,
  44875. silent: true
  44876. });
  44877. }
  44878. });
  44879. table.$ready = true;
  44880. });
  44881. const setScrollClassByEl = (el, className) => {
  44882. if (!el)
  44883. return;
  44884. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  44885. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  44886. el.className = classList.join(" ");
  44887. };
  44888. const setScrollClass = (className) => {
  44889. const { tableWrapper } = table.refs;
  44890. setScrollClassByEl(tableWrapper, className);
  44891. };
  44892. const hasScrollClass = (className) => {
  44893. const { tableWrapper } = table.refs;
  44894. return !!(tableWrapper && tableWrapper.classList.contains(className));
  44895. };
  44896. const syncPosition = function() {
  44897. if (!table.refs.scrollBarRef)
  44898. return;
  44899. if (!layout.scrollX.value) {
  44900. const scrollingNoneClass = "is-scrolling-none";
  44901. if (!hasScrollClass(scrollingNoneClass)) {
  44902. setScrollClass(scrollingNoneClass);
  44903. }
  44904. return;
  44905. }
  44906. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  44907. if (!scrollContainer)
  44908. return;
  44909. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  44910. const { headerWrapper, footerWrapper } = table.refs;
  44911. if (headerWrapper)
  44912. headerWrapper.scrollLeft = scrollLeft;
  44913. if (footerWrapper)
  44914. footerWrapper.scrollLeft = scrollLeft;
  44915. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  44916. if (scrollLeft >= maxScrollLeftPosition) {
  44917. setScrollClass("is-scrolling-right");
  44918. } else if (scrollLeft === 0) {
  44919. setScrollClass("is-scrolling-left");
  44920. } else {
  44921. setScrollClass("is-scrolling-middle");
  44922. }
  44923. };
  44924. const bindEvents = () => {
  44925. if (!table.refs.scrollBarRef)
  44926. return;
  44927. if (table.refs.scrollBarRef.wrapRef) {
  44928. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  44929. passive: true
  44930. });
  44931. }
  44932. if (props.fit) {
  44933. useResizeObserver(table.vnode.el, resizeListener);
  44934. } else {
  44935. useEventListener(window, "resize", resizeListener);
  44936. }
  44937. useResizeObserver(table.refs.bodyWrapper, () => {
  44938. var _a, _b;
  44939. resizeListener();
  44940. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  44941. });
  44942. };
  44943. const resizeListener = () => {
  44944. var _a, _b, _c, _d;
  44945. const el = table.vnode.el;
  44946. if (!table.$ready || !el)
  44947. return;
  44948. let shouldUpdateLayout = false;
  44949. const {
  44950. width: oldWidth,
  44951. height: oldHeight,
  44952. headerHeight: oldHeaderHeight
  44953. } = resizeState.value;
  44954. const width = tableWidth.value = el.offsetWidth;
  44955. if (oldWidth !== width) {
  44956. shouldUpdateLayout = true;
  44957. }
  44958. const height = el.offsetHeight;
  44959. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  44960. shouldUpdateLayout = true;
  44961. }
  44962. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  44963. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  44964. shouldUpdateLayout = true;
  44965. }
  44966. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  44967. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  44968. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  44969. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  44970. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  44971. if (shouldUpdateLayout) {
  44972. resizeState.value = {
  44973. width,
  44974. height,
  44975. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  44976. };
  44977. doLayout();
  44978. }
  44979. };
  44980. const tableSize = useFormSize();
  44981. const bodyWidth = vue.computed(() => {
  44982. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  44983. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  44984. });
  44985. const tableLayout = vue.computed(() => {
  44986. if (props.maxHeight)
  44987. return "fixed";
  44988. return props.tableLayout;
  44989. });
  44990. const emptyBlockStyle = vue.computed(() => {
  44991. if (props.data && props.data.length)
  44992. return null;
  44993. let height = "100%";
  44994. if (props.height && bodyScrollHeight.value) {
  44995. height = `${bodyScrollHeight.value}px`;
  44996. }
  44997. const width = tableWidth.value;
  44998. return {
  44999. width: width ? `${width}px` : "",
  45000. height
  45001. };
  45002. });
  45003. const tableInnerStyle = vue.computed(() => {
  45004. if (props.height) {
  45005. return {
  45006. height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height
  45007. };
  45008. }
  45009. if (props.maxHeight) {
  45010. return {
  45011. maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight
  45012. };
  45013. }
  45014. return {};
  45015. });
  45016. const scrollbarStyle = vue.computed(() => {
  45017. if (props.height) {
  45018. return {
  45019. height: "100%"
  45020. };
  45021. }
  45022. if (props.maxHeight) {
  45023. if (!Number.isNaN(Number(props.maxHeight))) {
  45024. return {
  45025. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  45026. };
  45027. } else {
  45028. return {
  45029. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  45030. };
  45031. }
  45032. }
  45033. return {};
  45034. });
  45035. const handleFixedMousewheel = (event, data) => {
  45036. const bodyWrapper = table.refs.bodyWrapper;
  45037. if (Math.abs(data.spinY) > 0) {
  45038. const currentScrollTop = bodyWrapper.scrollTop;
  45039. if (data.pixelY < 0 && currentScrollTop !== 0) {
  45040. event.preventDefault();
  45041. }
  45042. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  45043. event.preventDefault();
  45044. }
  45045. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  45046. } else {
  45047. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  45048. }
  45049. };
  45050. return {
  45051. isHidden,
  45052. renderExpanded,
  45053. setDragVisible,
  45054. isGroup,
  45055. handleMouseLeave,
  45056. handleHeaderFooterMousewheel,
  45057. tableSize,
  45058. emptyBlockStyle,
  45059. handleFixedMousewheel,
  45060. resizeProxyVisible,
  45061. bodyWidth,
  45062. resizeState,
  45063. doLayout,
  45064. tableBodyStyles,
  45065. tableLayout,
  45066. scrollbarViewStyle,
  45067. tableInnerStyle,
  45068. scrollbarStyle
  45069. };
  45070. }
  45071. function useKeyRender(table) {
  45072. const observer = vue.ref();
  45073. const initWatchDom = () => {
  45074. const el = table.vnode.el;
  45075. const columnsWrapper = el.querySelector(".hidden-columns");
  45076. const config = { childList: true, subtree: true };
  45077. const updateOrderFns = table.store.states.updateOrderFns;
  45078. observer.value = new MutationObserver(() => {
  45079. updateOrderFns.forEach((fn) => fn());
  45080. });
  45081. observer.value.observe(columnsWrapper, config);
  45082. };
  45083. vue.onMounted(() => {
  45084. initWatchDom();
  45085. });
  45086. vue.onUnmounted(() => {
  45087. var _a;
  45088. (_a = observer.value) == null ? void 0 : _a.disconnect();
  45089. });
  45090. }
  45091. var defaultProps$1 = {
  45092. data: {
  45093. type: Array,
  45094. default: () => []
  45095. },
  45096. size: useSizeProp,
  45097. width: [String, Number],
  45098. height: [String, Number],
  45099. maxHeight: [String, Number],
  45100. fit: {
  45101. type: Boolean,
  45102. default: true
  45103. },
  45104. stripe: Boolean,
  45105. border: Boolean,
  45106. rowKey: [String, Function],
  45107. showHeader: {
  45108. type: Boolean,
  45109. default: true
  45110. },
  45111. showSummary: Boolean,
  45112. sumText: String,
  45113. summaryMethod: Function,
  45114. rowClassName: [String, Function],
  45115. rowStyle: [Object, Function],
  45116. cellClassName: [String, Function],
  45117. cellStyle: [Object, Function],
  45118. headerRowClassName: [String, Function],
  45119. headerRowStyle: [Object, Function],
  45120. headerCellClassName: [String, Function],
  45121. headerCellStyle: [Object, Function],
  45122. highlightCurrentRow: Boolean,
  45123. currentRowKey: [String, Number],
  45124. emptyText: String,
  45125. expandRowKeys: Array,
  45126. defaultExpandAll: Boolean,
  45127. defaultSort: Object,
  45128. tooltipEffect: String,
  45129. tooltipOptions: Object,
  45130. spanMethod: Function,
  45131. selectOnIndeterminate: {
  45132. type: Boolean,
  45133. default: true
  45134. },
  45135. indent: {
  45136. type: Number,
  45137. default: 16
  45138. },
  45139. treeProps: {
  45140. type: Object,
  45141. default: () => {
  45142. return {
  45143. hasChildren: "hasChildren",
  45144. children: "children",
  45145. checkStrictly: false
  45146. };
  45147. }
  45148. },
  45149. lazy: Boolean,
  45150. load: Function,
  45151. style: {
  45152. type: Object,
  45153. default: () => ({})
  45154. },
  45155. className: {
  45156. type: String,
  45157. default: ""
  45158. },
  45159. tableLayout: {
  45160. type: String,
  45161. default: "fixed"
  45162. },
  45163. scrollbarAlwaysOn: Boolean,
  45164. flexible: Boolean,
  45165. showOverflowTooltip: [Boolean, Object]
  45166. };
  45167. function hColgroup(props) {
  45168. const isAuto = props.tableLayout === "auto";
  45169. let columns = props.columns || [];
  45170. if (isAuto) {
  45171. if (columns.every((column) => column.width === void 0)) {
  45172. columns = [];
  45173. }
  45174. }
  45175. const getPropsData = (column) => {
  45176. const propsData = {
  45177. key: `${props.tableLayout}_${column.id}`,
  45178. style: {},
  45179. name: void 0
  45180. };
  45181. if (isAuto) {
  45182. propsData.style = {
  45183. width: `${column.width}px`
  45184. };
  45185. } else {
  45186. propsData.name = column.id;
  45187. }
  45188. return propsData;
  45189. };
  45190. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  45191. }
  45192. hColgroup.props = ["columns", "tableLayout"];
  45193. const useScrollbar$1 = () => {
  45194. const scrollBarRef = vue.ref();
  45195. const scrollTo = (options, yCoord) => {
  45196. const scrollbar = scrollBarRef.value;
  45197. if (scrollbar) {
  45198. scrollbar.scrollTo(options, yCoord);
  45199. }
  45200. };
  45201. const setScrollPosition = (position, offset) => {
  45202. const scrollbar = scrollBarRef.value;
  45203. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  45204. scrollbar[`setScroll${position}`](offset);
  45205. }
  45206. };
  45207. const setScrollTop = (top) => setScrollPosition("Top", top);
  45208. const setScrollLeft = (left) => setScrollPosition("Left", left);
  45209. return {
  45210. scrollBarRef,
  45211. scrollTo,
  45212. setScrollTop,
  45213. setScrollLeft
  45214. };
  45215. };
  45216. let tableIdSeed = 1;
  45217. const _sfc_main$A = vue.defineComponent({
  45218. name: "ElTable",
  45219. directives: {
  45220. Mousewheel
  45221. },
  45222. components: {
  45223. TableHeader,
  45224. TableBody,
  45225. TableFooter,
  45226. ElScrollbar,
  45227. hColgroup
  45228. },
  45229. props: defaultProps$1,
  45230. emits: [
  45231. "select",
  45232. "select-all",
  45233. "selection-change",
  45234. "cell-mouse-enter",
  45235. "cell-mouse-leave",
  45236. "cell-contextmenu",
  45237. "cell-click",
  45238. "cell-dblclick",
  45239. "row-click",
  45240. "row-contextmenu",
  45241. "row-dblclick",
  45242. "header-click",
  45243. "header-contextmenu",
  45244. "sort-change",
  45245. "filter-change",
  45246. "current-change",
  45247. "header-dragend",
  45248. "expand-change"
  45249. ],
  45250. setup(props) {
  45251. const { t } = useLocale();
  45252. const ns = useNamespace("table");
  45253. const table = vue.getCurrentInstance();
  45254. vue.provide(TABLE_INJECTION_KEY, table);
  45255. const store = createStore(table, props);
  45256. table.store = store;
  45257. const layout = new TableLayout$1({
  45258. store: table.store,
  45259. table,
  45260. fit: props.fit,
  45261. showHeader: props.showHeader
  45262. });
  45263. table.layout = layout;
  45264. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  45265. const {
  45266. setCurrentRow,
  45267. getSelectionRows,
  45268. toggleRowSelection,
  45269. clearSelection,
  45270. clearFilter,
  45271. toggleAllSelection,
  45272. toggleRowExpansion,
  45273. clearSort,
  45274. sort
  45275. } = useUtils(store);
  45276. const {
  45277. isHidden,
  45278. renderExpanded,
  45279. setDragVisible,
  45280. isGroup,
  45281. handleMouseLeave,
  45282. handleHeaderFooterMousewheel,
  45283. tableSize,
  45284. emptyBlockStyle,
  45285. handleFixedMousewheel,
  45286. resizeProxyVisible,
  45287. bodyWidth,
  45288. resizeState,
  45289. doLayout,
  45290. tableBodyStyles,
  45291. tableLayout,
  45292. scrollbarViewStyle,
  45293. tableInnerStyle,
  45294. scrollbarStyle
  45295. } = useStyle(props, layout, store, table);
  45296. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  45297. const debouncedUpdateLayout = debounce(doLayout, 50);
  45298. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  45299. table.tableId = tableId;
  45300. table.state = {
  45301. isGroup,
  45302. resizeState,
  45303. doLayout,
  45304. debouncedUpdateLayout
  45305. };
  45306. const computedSumText = vue.computed(() => {
  45307. var _a;
  45308. return (_a = props.sumText) != null ? _a : t("el.table.sumText");
  45309. });
  45310. const computedEmptyText = vue.computed(() => {
  45311. var _a;
  45312. return (_a = props.emptyText) != null ? _a : t("el.table.emptyText");
  45313. });
  45314. const columns = vue.computed(() => {
  45315. return convertToRows(store.states.originColumns.value)[0];
  45316. });
  45317. useKeyRender(table);
  45318. return {
  45319. ns,
  45320. layout,
  45321. store,
  45322. columns,
  45323. handleHeaderFooterMousewheel,
  45324. handleMouseLeave,
  45325. tableId,
  45326. tableSize,
  45327. isHidden,
  45328. isEmpty,
  45329. renderExpanded,
  45330. resizeProxyVisible,
  45331. resizeState,
  45332. isGroup,
  45333. bodyWidth,
  45334. tableBodyStyles,
  45335. emptyBlockStyle,
  45336. debouncedUpdateLayout,
  45337. handleFixedMousewheel,
  45338. setCurrentRow,
  45339. getSelectionRows,
  45340. toggleRowSelection,
  45341. clearSelection,
  45342. clearFilter,
  45343. toggleAllSelection,
  45344. toggleRowExpansion,
  45345. clearSort,
  45346. doLayout,
  45347. sort,
  45348. t,
  45349. setDragVisible,
  45350. context: table,
  45351. computedSumText,
  45352. computedEmptyText,
  45353. tableLayout,
  45354. scrollbarViewStyle,
  45355. tableInnerStyle,
  45356. scrollbarStyle,
  45357. scrollBarRef,
  45358. scrollTo,
  45359. setScrollLeft,
  45360. setScrollTop
  45361. };
  45362. }
  45363. });
  45364. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  45365. const _component_hColgroup = vue.resolveComponent("hColgroup");
  45366. const _component_table_header = vue.resolveComponent("table-header");
  45367. const _component_table_body = vue.resolveComponent("table-body");
  45368. const _component_table_footer = vue.resolveComponent("table-footer");
  45369. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  45370. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  45371. return vue.openBlock(), vue.createElementBlock("div", {
  45372. ref: "tableWrapper",
  45373. class: vue.normalizeClass([
  45374. {
  45375. [_ctx.ns.m("fit")]: _ctx.fit,
  45376. [_ctx.ns.m("striped")]: _ctx.stripe,
  45377. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  45378. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  45379. [_ctx.ns.m("group")]: _ctx.isGroup,
  45380. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  45381. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  45382. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  45383. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  45384. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  45385. "has-footer": _ctx.showSummary
  45386. },
  45387. _ctx.ns.m(_ctx.tableSize),
  45388. _ctx.className,
  45389. _ctx.ns.b(),
  45390. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  45391. ]),
  45392. style: vue.normalizeStyle(_ctx.style),
  45393. "data-prefix": _ctx.ns.namespace.value,
  45394. onMouseleave: _ctx.handleMouseLeave
  45395. }, [
  45396. vue.createElementVNode("div", {
  45397. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper")),
  45398. style: vue.normalizeStyle(_ctx.tableInnerStyle)
  45399. }, [
  45400. vue.createElementVNode("div", {
  45401. ref: "hiddenColumns",
  45402. class: "hidden-columns"
  45403. }, [
  45404. vue.renderSlot(_ctx.$slots, "default")
  45405. ], 512),
  45406. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  45407. key: 0,
  45408. ref: "headerWrapper",
  45409. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  45410. }, [
  45411. vue.createElementVNode("table", {
  45412. ref: "tableHeader",
  45413. class: vue.normalizeClass(_ctx.ns.e("header")),
  45414. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  45415. border: "0",
  45416. cellpadding: "0",
  45417. cellspacing: "0"
  45418. }, [
  45419. vue.createVNode(_component_hColgroup, {
  45420. columns: _ctx.store.states.columns.value,
  45421. "table-layout": _ctx.tableLayout
  45422. }, null, 8, ["columns", "table-layout"]),
  45423. vue.createVNode(_component_table_header, {
  45424. ref: "tableHeaderRef",
  45425. border: _ctx.border,
  45426. "default-sort": _ctx.defaultSort,
  45427. store: _ctx.store,
  45428. onSetDragVisible: _ctx.setDragVisible
  45429. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  45430. ], 6)
  45431. ], 2)), [
  45432. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  45433. ]) : vue.createCommentVNode("v-if", true),
  45434. vue.createElementVNode("div", {
  45435. ref: "bodyWrapper",
  45436. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  45437. }, [
  45438. vue.createVNode(_component_el_scrollbar, {
  45439. ref: "scrollBarRef",
  45440. "view-style": _ctx.scrollbarViewStyle,
  45441. "wrap-style": _ctx.scrollbarStyle,
  45442. always: _ctx.scrollbarAlwaysOn
  45443. }, {
  45444. default: vue.withCtx(() => [
  45445. vue.createElementVNode("table", {
  45446. ref: "tableBody",
  45447. class: vue.normalizeClass(_ctx.ns.e("body")),
  45448. cellspacing: "0",
  45449. cellpadding: "0",
  45450. border: "0",
  45451. style: vue.normalizeStyle({
  45452. width: _ctx.bodyWidth,
  45453. tableLayout: _ctx.tableLayout
  45454. })
  45455. }, [
  45456. vue.createVNode(_component_hColgroup, {
  45457. columns: _ctx.store.states.columns.value,
  45458. "table-layout": _ctx.tableLayout
  45459. }, null, 8, ["columns", "table-layout"]),
  45460. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  45461. key: 0,
  45462. ref: "tableHeaderRef",
  45463. class: vue.normalizeClass(_ctx.ns.e("body-header")),
  45464. border: _ctx.border,
  45465. "default-sort": _ctx.defaultSort,
  45466. store: _ctx.store,
  45467. onSetDragVisible: _ctx.setDragVisible
  45468. }, null, 8, ["class", "border", "default-sort", "store", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  45469. vue.createVNode(_component_table_body, {
  45470. context: _ctx.context,
  45471. highlight: _ctx.highlightCurrentRow,
  45472. "row-class-name": _ctx.rowClassName,
  45473. "tooltip-effect": _ctx.tooltipEffect,
  45474. "tooltip-options": _ctx.tooltipOptions,
  45475. "row-style": _ctx.rowStyle,
  45476. store: _ctx.store,
  45477. stripe: _ctx.stripe
  45478. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  45479. _ctx.showSummary && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_footer, {
  45480. key: 1,
  45481. class: vue.normalizeClass(_ctx.ns.e("body-footer")),
  45482. border: _ctx.border,
  45483. "default-sort": _ctx.defaultSort,
  45484. store: _ctx.store,
  45485. "sum-text": _ctx.computedSumText,
  45486. "summary-method": _ctx.summaryMethod
  45487. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : vue.createCommentVNode("v-if", true)
  45488. ], 6),
  45489. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  45490. key: 0,
  45491. ref: "emptyBlock",
  45492. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  45493. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  45494. }, [
  45495. vue.createElementVNode("span", {
  45496. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  45497. }, [
  45498. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  45499. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  45500. ])
  45501. ], 2)
  45502. ], 6)) : vue.createCommentVNode("v-if", true),
  45503. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  45504. key: 1,
  45505. ref: "appendWrapper",
  45506. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  45507. }, [
  45508. vue.renderSlot(_ctx.$slots, "append")
  45509. ], 2)) : vue.createCommentVNode("v-if", true)
  45510. ]),
  45511. _: 3
  45512. }, 8, ["view-style", "wrap-style", "always"])
  45513. ], 2),
  45514. _ctx.showSummary && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  45515. key: 1,
  45516. ref: "footerWrapper",
  45517. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  45518. }, [
  45519. vue.createElementVNode("table", {
  45520. class: vue.normalizeClass(_ctx.ns.e("footer")),
  45521. cellspacing: "0",
  45522. cellpadding: "0",
  45523. border: "0",
  45524. style: vue.normalizeStyle(_ctx.tableBodyStyles)
  45525. }, [
  45526. vue.createVNode(_component_hColgroup, {
  45527. columns: _ctx.store.states.columns.value,
  45528. "table-layout": _ctx.tableLayout
  45529. }, null, 8, ["columns", "table-layout"]),
  45530. vue.createVNode(_component_table_footer, {
  45531. border: _ctx.border,
  45532. "default-sort": _ctx.defaultSort,
  45533. store: _ctx.store,
  45534. "sum-text": _ctx.computedSumText,
  45535. "summary-method": _ctx.summaryMethod
  45536. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  45537. ], 6)
  45538. ], 2)), [
  45539. [vue.vShow, !_ctx.isEmpty],
  45540. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  45541. ]) : vue.createCommentVNode("v-if", true),
  45542. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  45543. key: 2,
  45544. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  45545. }, null, 2)) : vue.createCommentVNode("v-if", true)
  45546. ], 6),
  45547. vue.withDirectives(vue.createElementVNode("div", {
  45548. ref: "resizeProxy",
  45549. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  45550. }, null, 2), [
  45551. [vue.vShow, _ctx.resizeProxyVisible]
  45552. ])
  45553. ], 46, ["data-prefix", "onMouseleave"]);
  45554. }
  45555. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  45556. const defaultClassNames = {
  45557. selection: "table-column--selection",
  45558. expand: "table__expand-column"
  45559. };
  45560. const cellStarts = {
  45561. default: {
  45562. order: ""
  45563. },
  45564. selection: {
  45565. width: 48,
  45566. minWidth: 48,
  45567. realWidth: 48,
  45568. order: ""
  45569. },
  45570. expand: {
  45571. width: 48,
  45572. minWidth: 48,
  45573. realWidth: 48,
  45574. order: ""
  45575. },
  45576. index: {
  45577. width: 48,
  45578. minWidth: 48,
  45579. realWidth: 48,
  45580. order: ""
  45581. }
  45582. };
  45583. const getDefaultClassName = (type) => {
  45584. return defaultClassNames[type] || "";
  45585. };
  45586. const cellForced = {
  45587. selection: {
  45588. renderHeader({ store, column }) {
  45589. function isDisabled() {
  45590. return store.states.data.value && store.states.data.value.length === 0;
  45591. }
  45592. return vue.h(ElCheckbox, {
  45593. disabled: isDisabled(),
  45594. size: store.states.tableSize.value,
  45595. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  45596. "onUpdate:modelValue": store.toggleAllSelection,
  45597. modelValue: store.states.isAllSelected.value,
  45598. ariaLabel: column.label
  45599. });
  45600. },
  45601. renderCell({
  45602. row,
  45603. column,
  45604. store,
  45605. $index
  45606. }) {
  45607. return vue.h(ElCheckbox, {
  45608. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  45609. size: store.states.tableSize.value,
  45610. onChange: () => {
  45611. store.commit("rowSelectedChanged", row);
  45612. },
  45613. onClick: (event) => event.stopPropagation(),
  45614. modelValue: store.isSelected(row),
  45615. ariaLabel: column.label
  45616. });
  45617. },
  45618. sortable: false,
  45619. resizable: false
  45620. },
  45621. index: {
  45622. renderHeader({ column }) {
  45623. return column.label || "#";
  45624. },
  45625. renderCell({
  45626. column,
  45627. $index
  45628. }) {
  45629. let i = $index + 1;
  45630. const index = column.index;
  45631. if (typeof index === "number") {
  45632. i = $index + index;
  45633. } else if (typeof index === "function") {
  45634. i = index($index);
  45635. }
  45636. return vue.h("div", {}, [i]);
  45637. },
  45638. sortable: false
  45639. },
  45640. expand: {
  45641. renderHeader({ column }) {
  45642. return column.label || "";
  45643. },
  45644. renderCell({
  45645. row,
  45646. store,
  45647. expanded
  45648. }) {
  45649. const { ns } = store;
  45650. const classes = [ns.e("expand-icon")];
  45651. if (expanded) {
  45652. classes.push(ns.em("expand-icon", "expanded"));
  45653. }
  45654. const callback = function(e) {
  45655. e.stopPropagation();
  45656. store.toggleRowExpansion(row);
  45657. };
  45658. return vue.h("div", {
  45659. class: classes,
  45660. onClick: callback
  45661. }, {
  45662. default: () => {
  45663. return [
  45664. vue.h(ElIcon, null, {
  45665. default: () => {
  45666. return [vue.h(arrow_right_default)];
  45667. }
  45668. })
  45669. ];
  45670. }
  45671. });
  45672. },
  45673. sortable: false,
  45674. resizable: false
  45675. }
  45676. };
  45677. function defaultRenderCell({
  45678. row,
  45679. column,
  45680. $index
  45681. }) {
  45682. var _a;
  45683. const property = column.property;
  45684. const value = property && getProp(row, property).value;
  45685. if (column && column.formatter) {
  45686. return column.formatter(row, column, value, $index);
  45687. }
  45688. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  45689. }
  45690. function treeCellPrefix({
  45691. row,
  45692. treeNode,
  45693. store
  45694. }, createPlaceholder = false) {
  45695. const { ns } = store;
  45696. if (!treeNode) {
  45697. if (createPlaceholder) {
  45698. return [
  45699. vue.h("span", {
  45700. class: ns.e("placeholder")
  45701. })
  45702. ];
  45703. }
  45704. return null;
  45705. }
  45706. const ele = [];
  45707. const callback = function(e) {
  45708. e.stopPropagation();
  45709. if (treeNode.loading) {
  45710. return;
  45711. }
  45712. store.loadOrToggle(row);
  45713. };
  45714. if (treeNode.indent) {
  45715. ele.push(vue.h("span", {
  45716. class: ns.e("indent"),
  45717. style: { "padding-left": `${treeNode.indent}px` }
  45718. }));
  45719. }
  45720. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  45721. const expandClasses = [
  45722. ns.e("expand-icon"),
  45723. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  45724. ];
  45725. let icon = arrow_right_default;
  45726. if (treeNode.loading) {
  45727. icon = loading_default;
  45728. }
  45729. ele.push(vue.h("div", {
  45730. class: expandClasses,
  45731. onClick: callback
  45732. }, {
  45733. default: () => {
  45734. return [
  45735. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  45736. default: () => [vue.h(icon)]
  45737. })
  45738. ];
  45739. }
  45740. }));
  45741. } else {
  45742. ele.push(vue.h("span", {
  45743. class: ns.e("placeholder")
  45744. }));
  45745. }
  45746. return ele;
  45747. }
  45748. function getAllAliases(props, aliases) {
  45749. return props.reduce((prev, cur) => {
  45750. prev[cur] = cur;
  45751. return prev;
  45752. }, aliases);
  45753. }
  45754. function useWatcher(owner, props_) {
  45755. const instance = vue.getCurrentInstance();
  45756. const registerComplexWatchers = () => {
  45757. const props = ["fixed"];
  45758. const aliases = {
  45759. realWidth: "width",
  45760. realMinWidth: "minWidth"
  45761. };
  45762. const allAliases = getAllAliases(props, aliases);
  45763. Object.keys(allAliases).forEach((key) => {
  45764. const columnKey = aliases[key];
  45765. if (hasOwn(props_, columnKey)) {
  45766. vue.watch(() => props_[columnKey], (newVal) => {
  45767. let value = newVal;
  45768. if (columnKey === "width" && key === "realWidth") {
  45769. value = parseWidth(newVal);
  45770. }
  45771. if (columnKey === "minWidth" && key === "realMinWidth") {
  45772. value = parseMinWidth(newVal);
  45773. }
  45774. instance.columnConfig.value[columnKey] = value;
  45775. instance.columnConfig.value[key] = value;
  45776. const updateColumns = columnKey === "fixed";
  45777. owner.value.store.scheduleLayout(updateColumns);
  45778. });
  45779. }
  45780. });
  45781. };
  45782. const registerNormalWatchers = () => {
  45783. const props = [
  45784. "label",
  45785. "filters",
  45786. "filterMultiple",
  45787. "filteredValue",
  45788. "sortable",
  45789. "index",
  45790. "formatter",
  45791. "className",
  45792. "labelClassName",
  45793. "filterClassName",
  45794. "showOverflowTooltip"
  45795. ];
  45796. const aliases = {
  45797. property: "prop",
  45798. align: "realAlign",
  45799. headerAlign: "realHeaderAlign"
  45800. };
  45801. const allAliases = getAllAliases(props, aliases);
  45802. Object.keys(allAliases).forEach((key) => {
  45803. const columnKey = aliases[key];
  45804. if (hasOwn(props_, columnKey)) {
  45805. vue.watch(() => props_[columnKey], (newVal) => {
  45806. instance.columnConfig.value[key] = newVal;
  45807. });
  45808. }
  45809. });
  45810. };
  45811. return {
  45812. registerComplexWatchers,
  45813. registerNormalWatchers
  45814. };
  45815. }
  45816. function useRender(props, slots, owner) {
  45817. const instance = vue.getCurrentInstance();
  45818. const columnId = vue.ref("");
  45819. const isSubColumn = vue.ref(false);
  45820. const realAlign = vue.ref();
  45821. const realHeaderAlign = vue.ref();
  45822. const ns = useNamespace("table");
  45823. vue.watchEffect(() => {
  45824. realAlign.value = props.align ? `is-${props.align}` : null;
  45825. realAlign.value;
  45826. });
  45827. vue.watchEffect(() => {
  45828. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  45829. realHeaderAlign.value;
  45830. });
  45831. const columnOrTableParent = vue.computed(() => {
  45832. let parent = instance.vnode.vParent || instance.parent;
  45833. while (parent && !parent.tableId && !parent.columnId) {
  45834. parent = parent.vnode.vParent || parent.parent;
  45835. }
  45836. return parent;
  45837. });
  45838. const hasTreeColumn = vue.computed(() => {
  45839. const { store } = instance.parent;
  45840. if (!store)
  45841. return false;
  45842. const { treeData } = store.states;
  45843. const treeDataValue = treeData.value;
  45844. return treeDataValue && Object.keys(treeDataValue).length > 0;
  45845. });
  45846. const realWidth = vue.ref(parseWidth(props.width));
  45847. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  45848. const setColumnWidth = (column) => {
  45849. if (realWidth.value)
  45850. column.width = realWidth.value;
  45851. if (realMinWidth.value) {
  45852. column.minWidth = realMinWidth.value;
  45853. }
  45854. if (!realWidth.value && realMinWidth.value) {
  45855. column.width = void 0;
  45856. }
  45857. if (!column.minWidth) {
  45858. column.minWidth = 80;
  45859. }
  45860. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  45861. return column;
  45862. };
  45863. const setColumnForcedProps = (column) => {
  45864. const type = column.type;
  45865. const source = cellForced[type] || {};
  45866. Object.keys(source).forEach((prop) => {
  45867. const value = source[prop];
  45868. if (prop !== "className" && value !== void 0) {
  45869. column[prop] = value;
  45870. }
  45871. });
  45872. const className = getDefaultClassName(type);
  45873. if (className) {
  45874. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  45875. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  45876. }
  45877. return column;
  45878. };
  45879. const checkSubColumn = (children) => {
  45880. if (Array.isArray(children)) {
  45881. children.forEach((child) => check(child));
  45882. } else {
  45883. check(children);
  45884. }
  45885. function check(item) {
  45886. var _a;
  45887. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  45888. item.vParent = instance;
  45889. }
  45890. }
  45891. };
  45892. const setColumnRenders = (column) => {
  45893. if (props.renderHeader) ; else if (column.type !== "selection") {
  45894. column.renderHeader = (scope) => {
  45895. instance.columnConfig.value["label"];
  45896. return vue.renderSlot(slots, "header", scope, () => [column.label]);
  45897. };
  45898. }
  45899. if (slots["filter-icon"]) {
  45900. column.renderFilterIcon = (scope) => {
  45901. return vue.renderSlot(slots, "filter-icon", scope);
  45902. };
  45903. }
  45904. let originRenderCell = column.renderCell;
  45905. if (column.type === "expand") {
  45906. column.renderCell = (data) => vue.h("div", {
  45907. class: "cell"
  45908. }, [originRenderCell(data)]);
  45909. owner.value.renderExpanded = (data) => {
  45910. return slots.default ? slots.default(data) : slots.default;
  45911. };
  45912. } else {
  45913. originRenderCell = originRenderCell || defaultRenderCell;
  45914. column.renderCell = (data) => {
  45915. let children = null;
  45916. if (slots.default) {
  45917. const vnodes = slots.default(data);
  45918. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  45919. } else {
  45920. children = originRenderCell(data);
  45921. }
  45922. const { columns } = owner.value.store.states;
  45923. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  45924. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  45925. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  45926. const props2 = {
  45927. class: "cell",
  45928. style: {}
  45929. };
  45930. if (column.showOverflowTooltip) {
  45931. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  45932. props2.style = {
  45933. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  45934. };
  45935. }
  45936. checkSubColumn(children);
  45937. return vue.h("div", props2, [prefix, children]);
  45938. };
  45939. }
  45940. return column;
  45941. };
  45942. const getPropsData = (...propsKey) => {
  45943. return propsKey.reduce((prev, cur) => {
  45944. if (Array.isArray(cur)) {
  45945. cur.forEach((key) => {
  45946. prev[key] = props[key];
  45947. });
  45948. }
  45949. return prev;
  45950. }, {});
  45951. };
  45952. const getColumnElIndex = (children, child) => {
  45953. return Array.prototype.indexOf.call(children, child);
  45954. };
  45955. const updateColumnOrder = () => {
  45956. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  45957. };
  45958. return {
  45959. columnId,
  45960. realAlign,
  45961. isSubColumn,
  45962. realHeaderAlign,
  45963. columnOrTableParent,
  45964. setColumnWidth,
  45965. setColumnForcedProps,
  45966. setColumnRenders,
  45967. getPropsData,
  45968. getColumnElIndex,
  45969. updateColumnOrder
  45970. };
  45971. }
  45972. var defaultProps = {
  45973. type: {
  45974. type: String,
  45975. default: "default"
  45976. },
  45977. label: String,
  45978. className: String,
  45979. labelClassName: String,
  45980. property: String,
  45981. prop: String,
  45982. width: {
  45983. type: [String, Number],
  45984. default: ""
  45985. },
  45986. minWidth: {
  45987. type: [String, Number],
  45988. default: ""
  45989. },
  45990. renderHeader: Function,
  45991. sortable: {
  45992. type: [Boolean, String],
  45993. default: false
  45994. },
  45995. sortMethod: Function,
  45996. sortBy: [String, Function, Array],
  45997. resizable: {
  45998. type: Boolean,
  45999. default: true
  46000. },
  46001. columnKey: String,
  46002. align: String,
  46003. headerAlign: String,
  46004. showOverflowTooltip: {
  46005. type: [Boolean, Object],
  46006. default: void 0
  46007. },
  46008. fixed: [Boolean, String],
  46009. formatter: Function,
  46010. selectable: Function,
  46011. reserveSelection: Boolean,
  46012. filterMethod: Function,
  46013. filteredValue: Array,
  46014. filters: Array,
  46015. filterPlacement: String,
  46016. filterMultiple: {
  46017. type: Boolean,
  46018. default: true
  46019. },
  46020. filterClassName: String,
  46021. index: [Number, Function],
  46022. sortOrders: {
  46023. type: Array,
  46024. default: () => {
  46025. return ["ascending", "descending", null];
  46026. },
  46027. validator: (val) => {
  46028. return val.every((order) => ["ascending", "descending", null].includes(order));
  46029. }
  46030. }
  46031. };
  46032. let columnIdSeed = 1;
  46033. var ElTableColumn$1 = vue.defineComponent({
  46034. name: "ElTableColumn",
  46035. components: {
  46036. ElCheckbox
  46037. },
  46038. props: defaultProps,
  46039. setup(props, { slots }) {
  46040. const instance = vue.getCurrentInstance();
  46041. const columnConfig = vue.ref({});
  46042. const owner = vue.computed(() => {
  46043. let parent2 = instance.parent;
  46044. while (parent2 && !parent2.tableId) {
  46045. parent2 = parent2.parent;
  46046. }
  46047. return parent2;
  46048. });
  46049. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  46050. const {
  46051. columnId,
  46052. isSubColumn,
  46053. realHeaderAlign,
  46054. columnOrTableParent,
  46055. setColumnWidth,
  46056. setColumnForcedProps,
  46057. setColumnRenders,
  46058. getPropsData,
  46059. getColumnElIndex,
  46060. realAlign,
  46061. updateColumnOrder
  46062. } = useRender(props, slots, owner);
  46063. const parent = columnOrTableParent.value;
  46064. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  46065. vue.onBeforeMount(() => {
  46066. isSubColumn.value = owner.value !== parent;
  46067. const type = props.type || "default";
  46068. const sortable = props.sortable === "" ? true : props.sortable;
  46069. const showOverflowTooltip = isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  46070. const defaults = {
  46071. ...cellStarts[type],
  46072. id: columnId.value,
  46073. type,
  46074. property: props.prop || props.property,
  46075. align: realAlign,
  46076. headerAlign: realHeaderAlign,
  46077. showOverflowTooltip,
  46078. filterable: props.filters || props.filterMethod,
  46079. filteredValue: [],
  46080. filterPlacement: "",
  46081. filterClassName: "",
  46082. isColumnGroup: false,
  46083. isSubColumn: false,
  46084. filterOpened: false,
  46085. sortable,
  46086. index: props.index,
  46087. rawColumnKey: instance.vnode.key
  46088. };
  46089. const basicProps = [
  46090. "columnKey",
  46091. "label",
  46092. "className",
  46093. "labelClassName",
  46094. "type",
  46095. "renderHeader",
  46096. "formatter",
  46097. "fixed",
  46098. "resizable"
  46099. ];
  46100. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  46101. const selectProps = ["selectable", "reserveSelection"];
  46102. const filterProps = [
  46103. "filterMethod",
  46104. "filters",
  46105. "filterMultiple",
  46106. "filterOpened",
  46107. "filteredValue",
  46108. "filterPlacement",
  46109. "filterClassName"
  46110. ];
  46111. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  46112. column = mergeOptions(defaults, column);
  46113. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  46114. column = chains(column);
  46115. columnConfig.value = column;
  46116. registerNormalWatchers();
  46117. registerComplexWatchers();
  46118. });
  46119. vue.onMounted(() => {
  46120. var _a;
  46121. const parent2 = columnOrTableParent.value;
  46122. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  46123. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  46124. columnConfig.value.getColumnIndex = getColumnIndex;
  46125. const columnIndex = getColumnIndex();
  46126. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  46127. });
  46128. vue.onBeforeUnmount(() => {
  46129. const getColumnIndex = columnConfig.value.getColumnIndex;
  46130. const columnIndex = getColumnIndex ? getColumnIndex() : -1;
  46131. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  46132. });
  46133. instance.columnId = columnId.value;
  46134. instance.columnConfig = columnConfig;
  46135. return;
  46136. },
  46137. render() {
  46138. var _a, _b, _c;
  46139. try {
  46140. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  46141. row: {},
  46142. column: {},
  46143. $index: -1
  46144. });
  46145. const children = [];
  46146. if (Array.isArray(renderDefault)) {
  46147. for (const childNode of renderDefault) {
  46148. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  46149. children.push(childNode);
  46150. } else if (childNode.type === vue.Fragment && Array.isArray(childNode.children)) {
  46151. childNode.children.forEach((vnode2) => {
  46152. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  46153. children.push(vnode2);
  46154. }
  46155. });
  46156. }
  46157. }
  46158. }
  46159. const vnode = vue.h("div", children);
  46160. return vnode;
  46161. } catch (e) {
  46162. return vue.h("div", []);
  46163. }
  46164. }
  46165. });
  46166. const ElTable = withInstall(Table, {
  46167. TableColumn: ElTableColumn$1
  46168. });
  46169. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  46170. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  46171. SortOrder2["ASC"] = "asc";
  46172. SortOrder2["DESC"] = "desc";
  46173. return SortOrder2;
  46174. })(SortOrder || {});
  46175. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  46176. Alignment2["CENTER"] = "center";
  46177. Alignment2["RIGHT"] = "right";
  46178. return Alignment2;
  46179. })(Alignment || {});
  46180. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  46181. FixedDir2["LEFT"] = "left";
  46182. FixedDir2["RIGHT"] = "right";
  46183. return FixedDir2;
  46184. })(FixedDir || {});
  46185. const oppositeOrderMap = {
  46186. ["asc" /* ASC */]: "desc" /* DESC */,
  46187. ["desc" /* DESC */]: "asc" /* ASC */
  46188. };
  46189. const placeholderSign = Symbol("placeholder");
  46190. const calcColumnStyle = (column, fixedColumn, fixed) => {
  46191. var _a;
  46192. const flex = {
  46193. flexGrow: 0,
  46194. flexShrink: 0,
  46195. ...fixed ? {} : {
  46196. flexGrow: column.flexGrow || 0,
  46197. flexShrink: column.flexShrink || 1
  46198. }
  46199. };
  46200. if (!fixed) {
  46201. flex.flexShrink = 1;
  46202. }
  46203. const style = {
  46204. ...(_a = column.style) != null ? _a : {},
  46205. ...flex,
  46206. flexBasis: "auto",
  46207. width: column.width
  46208. };
  46209. if (!fixedColumn) {
  46210. if (column.maxWidth)
  46211. style.maxWidth = column.maxWidth;
  46212. if (column.minWidth)
  46213. style.minWidth = column.minWidth;
  46214. }
  46215. return style;
  46216. };
  46217. function useColumns(props, columns, fixed) {
  46218. const _columns = vue.computed(() => vue.unref(columns).map((column, index) => {
  46219. var _a, _b;
  46220. return {
  46221. ...column,
  46222. key: (_b = (_a = column.key) != null ? _a : column.dataKey) != null ? _b : index
  46223. };
  46224. }));
  46225. const visibleColumns = vue.computed(() => {
  46226. return vue.unref(_columns).filter((column) => !column.hidden);
  46227. });
  46228. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  46229. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  46230. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  46231. const mainColumns = vue.computed(() => {
  46232. const ret = [];
  46233. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  46234. ret.push({
  46235. ...column,
  46236. placeholderSign
  46237. });
  46238. });
  46239. vue.unref(normalColumns).forEach((column) => {
  46240. ret.push(column);
  46241. });
  46242. vue.unref(fixedColumnsOnRight).forEach((column) => {
  46243. ret.push({
  46244. ...column,
  46245. placeholderSign
  46246. });
  46247. });
  46248. return ret;
  46249. });
  46250. const hasFixedColumns = vue.computed(() => {
  46251. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  46252. });
  46253. const columnsStyles = vue.computed(() => {
  46254. return vue.unref(_columns).reduce((style, column) => {
  46255. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  46256. return style;
  46257. }, {});
  46258. });
  46259. const columnsTotalWidth = vue.computed(() => {
  46260. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  46261. });
  46262. const getColumn = (key) => {
  46263. return vue.unref(_columns).find((column) => column.key === key);
  46264. };
  46265. const getColumnStyle = (key) => {
  46266. return vue.unref(columnsStyles)[key];
  46267. };
  46268. const updateColumnWidth = (column, width) => {
  46269. column.width = width;
  46270. };
  46271. function onColumnSorted(e) {
  46272. var _a;
  46273. const { key } = e.currentTarget.dataset;
  46274. if (!key)
  46275. return;
  46276. const { sortState, sortBy } = props;
  46277. let order = SortOrder.ASC;
  46278. if (isObject$1(sortState)) {
  46279. order = oppositeOrderMap[sortState[key]];
  46280. } else {
  46281. order = oppositeOrderMap[sortBy.order];
  46282. }
  46283. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  46284. }
  46285. return {
  46286. columns: _columns,
  46287. columnsStyles,
  46288. columnsTotalWidth,
  46289. fixedColumnsOnLeft,
  46290. fixedColumnsOnRight,
  46291. hasFixedColumns,
  46292. mainColumns,
  46293. normalColumns,
  46294. visibleColumns,
  46295. getColumn,
  46296. getColumnStyle,
  46297. updateColumnWidth,
  46298. onColumnSorted
  46299. };
  46300. }
  46301. const useScrollbar = (props, {
  46302. mainTableRef,
  46303. leftTableRef,
  46304. rightTableRef,
  46305. onMaybeEndReached
  46306. }) => {
  46307. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  46308. function doScroll(params) {
  46309. var _a, _b, _c;
  46310. const { scrollTop } = params;
  46311. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  46312. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  46313. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  46314. }
  46315. function scrollTo(params) {
  46316. scrollPos.value = params;
  46317. doScroll(params);
  46318. }
  46319. function scrollToTop(scrollTop) {
  46320. scrollPos.value.scrollTop = scrollTop;
  46321. doScroll(vue.unref(scrollPos));
  46322. }
  46323. function scrollToLeft(scrollLeft) {
  46324. var _a, _b;
  46325. scrollPos.value.scrollLeft = scrollLeft;
  46326. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  46327. }
  46328. function onScroll(params) {
  46329. var _a;
  46330. scrollTo(params);
  46331. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  46332. }
  46333. function onVerticalScroll({ scrollTop }) {
  46334. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  46335. if (scrollTop !== currentScrollTop)
  46336. scrollToTop(scrollTop);
  46337. }
  46338. function scrollToRow(row, strategy = "auto") {
  46339. var _a;
  46340. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  46341. }
  46342. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  46343. if (cur > prev)
  46344. onMaybeEndReached();
  46345. });
  46346. return {
  46347. scrollPos,
  46348. scrollTo,
  46349. scrollToLeft,
  46350. scrollToTop,
  46351. scrollToRow,
  46352. onScroll,
  46353. onVerticalScroll
  46354. };
  46355. };
  46356. const useRow = (props, {
  46357. mainTableRef,
  46358. leftTableRef,
  46359. rightTableRef,
  46360. tableInstance,
  46361. ns,
  46362. isScrolling
  46363. }) => {
  46364. const vm = vue.getCurrentInstance();
  46365. const { emit } = vm;
  46366. const isResetting = vue.shallowRef(false);
  46367. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  46368. const lastRenderedRowIndex = vue.ref(-1);
  46369. const resetIndex = vue.shallowRef(null);
  46370. const rowHeights = vue.ref({});
  46371. const pendingRowHeights = vue.ref({});
  46372. const leftTableHeights = vue.shallowRef({});
  46373. const mainTableHeights = vue.shallowRef({});
  46374. const rightTableHeights = vue.shallowRef({});
  46375. const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight));
  46376. function onRowsRendered(params) {
  46377. var _a;
  46378. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  46379. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  46380. lastRenderedRowIndex.value = params.rowCacheEnd;
  46381. }
  46382. }
  46383. function onRowHovered({ hovered, rowKey }) {
  46384. if (isScrolling.value) {
  46385. return;
  46386. }
  46387. const tableRoot = tableInstance.vnode.el;
  46388. const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
  46389. rows.forEach((row) => {
  46390. if (hovered) {
  46391. row.classList.add(ns.is("hovered"));
  46392. } else {
  46393. row.classList.remove(ns.is("hovered"));
  46394. }
  46395. });
  46396. }
  46397. function onRowExpanded({
  46398. expanded,
  46399. rowData,
  46400. rowIndex,
  46401. rowKey
  46402. }) {
  46403. var _a, _b;
  46404. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  46405. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  46406. if (expanded) {
  46407. if (currentKeyIndex === -1)
  46408. _expandedRowKeys.push(rowKey);
  46409. } else {
  46410. if (currentKeyIndex > -1)
  46411. _expandedRowKeys.splice(currentKeyIndex, 1);
  46412. }
  46413. expandedRowKeys.value = _expandedRowKeys;
  46414. emit("update:expandedRowKeys", _expandedRowKeys);
  46415. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  46416. expanded,
  46417. rowData,
  46418. rowIndex,
  46419. rowKey
  46420. });
  46421. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  46422. }
  46423. const flushingRowHeights = debounce(() => {
  46424. var _a, _b, _c, _d;
  46425. isResetting.value = true;
  46426. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  46427. resetAfterIndex(vue.unref(resetIndex), false);
  46428. pendingRowHeights.value = {};
  46429. resetIndex.value = null;
  46430. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  46431. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  46432. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  46433. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  46434. isResetting.value = false;
  46435. }, 0);
  46436. function resetAfterIndex(index, forceUpdate = false) {
  46437. if (!vue.unref(isDynamic))
  46438. return;
  46439. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  46440. const table = vue.unref(tableRef);
  46441. if (table)
  46442. table.resetAfterRowIndex(index, forceUpdate);
  46443. });
  46444. }
  46445. function resetHeights(rowKey, height, rowIdx) {
  46446. const resetIdx = vue.unref(resetIndex);
  46447. if (resetIdx === null) {
  46448. resetIndex.value = rowIdx;
  46449. } else {
  46450. if (resetIdx > rowIdx) {
  46451. resetIndex.value = rowIdx;
  46452. }
  46453. }
  46454. pendingRowHeights.value[rowKey] = height;
  46455. }
  46456. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  46457. if (!fixedDir) {
  46458. mainTableHeights.value[rowKey] = height;
  46459. } else {
  46460. if (fixedDir === FixedDir.RIGHT) {
  46461. rightTableHeights.value[rowKey] = height;
  46462. } else {
  46463. leftTableHeights.value[rowKey] = height;
  46464. }
  46465. }
  46466. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  46467. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  46468. resetHeights(rowKey, maximumHeight, rowIndex);
  46469. flushingRowHeights();
  46470. }
  46471. }
  46472. return {
  46473. expandedRowKeys,
  46474. lastRenderedRowIndex,
  46475. isDynamic,
  46476. isResetting,
  46477. rowHeights,
  46478. resetAfterIndex,
  46479. onRowExpanded,
  46480. onRowHovered,
  46481. onRowsRendered,
  46482. onRowHeightChange
  46483. };
  46484. };
  46485. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  46486. const depthMap = vue.ref({});
  46487. const flattenedData = vue.computed(() => {
  46488. const depths = {};
  46489. const { data: data2, rowKey } = props;
  46490. const _expandedRowKeys = vue.unref(expandedRowKeys);
  46491. if (!_expandedRowKeys || !_expandedRowKeys.length)
  46492. return data2;
  46493. const array = [];
  46494. const keysSet = /* @__PURE__ */ new Set();
  46495. _expandedRowKeys.forEach((x) => keysSet.add(x));
  46496. let copy = data2.slice();
  46497. copy.forEach((x) => depths[x[rowKey]] = 0);
  46498. while (copy.length > 0) {
  46499. const item = copy.shift();
  46500. array.push(item);
  46501. if (keysSet.has(item[rowKey]) && Array.isArray(item.children) && item.children.length > 0) {
  46502. copy = [...item.children, ...copy];
  46503. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  46504. }
  46505. }
  46506. depthMap.value = depths;
  46507. return array;
  46508. });
  46509. const data = vue.computed(() => {
  46510. const { data: data2, expandColumnKey } = props;
  46511. return expandColumnKey ? vue.unref(flattenedData) : data2;
  46512. });
  46513. vue.watch(data, (val, prev) => {
  46514. if (val !== prev) {
  46515. lastRenderedRowIndex.value = -1;
  46516. resetAfterIndex(0, true);
  46517. }
  46518. });
  46519. return {
  46520. data,
  46521. depthMap
  46522. };
  46523. };
  46524. const sumReducer = (sum2, num) => sum2 + num;
  46525. const sum = (listLike) => {
  46526. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  46527. };
  46528. const tryCall = (fLike, params, defaultRet = {}) => {
  46529. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  46530. };
  46531. const enforceUnit = (style) => {
  46532. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  46533. style[key] = addUnit(style[key]);
  46534. });
  46535. return style;
  46536. };
  46537. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  46538. const useStyles = (props, {
  46539. columnsTotalWidth,
  46540. data,
  46541. fixedColumnsOnLeft,
  46542. fixedColumnsOnRight
  46543. }) => {
  46544. const bodyWidth = vue.computed(() => {
  46545. const { fixed, width, vScrollbarSize } = props;
  46546. const ret = width - vScrollbarSize;
  46547. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  46548. });
  46549. const headerWidth = vue.computed(() => vue.unref(bodyWidth) + props.vScrollbarSize);
  46550. const mainTableHeight = vue.computed(() => {
  46551. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  46552. if (maxHeight > 0) {
  46553. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  46554. const _rowsHeight = vue.unref(rowsHeight);
  46555. const _headerHeight = vue.unref(headerHeight);
  46556. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  46557. return Math.min(total, maxHeight - footerHeight2);
  46558. }
  46559. return height - footerHeight2;
  46560. });
  46561. const rowsHeight = vue.computed(() => {
  46562. const { rowHeight, estimatedRowHeight } = props;
  46563. const _data = vue.unref(data);
  46564. if (isNumber(estimatedRowHeight)) {
  46565. return _data.length * estimatedRowHeight;
  46566. }
  46567. return _data.length * rowHeight;
  46568. });
  46569. const fixedTableHeight = vue.computed(() => {
  46570. const { maxHeight } = props;
  46571. const tableHeight = vue.unref(mainTableHeight);
  46572. if (isNumber(maxHeight) && maxHeight > 0)
  46573. return tableHeight;
  46574. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  46575. return Math.min(tableHeight, totalHeight);
  46576. });
  46577. const mapColumn = (column) => column.width;
  46578. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  46579. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  46580. const headerHeight = vue.computed(() => sum(props.headerHeight));
  46581. const fixedRowsHeight = vue.computed(() => {
  46582. var _a;
  46583. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  46584. });
  46585. const windowHeight = vue.computed(() => {
  46586. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  46587. });
  46588. const rootStyle = vue.computed(() => {
  46589. const { style = {}, height, width } = props;
  46590. return enforceUnit({
  46591. ...style,
  46592. height,
  46593. width
  46594. });
  46595. });
  46596. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  46597. const emptyStyle = vue.computed(() => ({
  46598. top: addUnit(vue.unref(headerHeight)),
  46599. bottom: addUnit(props.footerHeight),
  46600. width: addUnit(props.width)
  46601. }));
  46602. return {
  46603. bodyWidth,
  46604. fixedTableHeight,
  46605. mainTableHeight,
  46606. leftTableWidth,
  46607. rightTableWidth,
  46608. headerWidth,
  46609. rowsHeight,
  46610. windowHeight,
  46611. footerHeight,
  46612. emptyStyle,
  46613. rootStyle,
  46614. headerHeight
  46615. };
  46616. };
  46617. const useAutoResize = (props) => {
  46618. const sizer = vue.ref();
  46619. const width$ = vue.ref(0);
  46620. const height$ = vue.ref(0);
  46621. let resizerStopper;
  46622. vue.onMounted(() => {
  46623. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  46624. const { width, height } = entry.contentRect;
  46625. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  46626. const left = Number.parseInt(paddingLeft) || 0;
  46627. const right = Number.parseInt(paddingRight) || 0;
  46628. const top = Number.parseInt(paddingTop) || 0;
  46629. const bottom = Number.parseInt(paddingBottom) || 0;
  46630. width$.value = width - left - right;
  46631. height$.value = height - top - bottom;
  46632. }).stop;
  46633. });
  46634. vue.onBeforeUnmount(() => {
  46635. resizerStopper == null ? void 0 : resizerStopper();
  46636. });
  46637. vue.watch([width$, height$], ([width, height]) => {
  46638. var _a;
  46639. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  46640. width,
  46641. height
  46642. });
  46643. });
  46644. return {
  46645. sizer,
  46646. width: width$,
  46647. height: height$
  46648. };
  46649. };
  46650. function useTable(props) {
  46651. const mainTableRef = vue.ref();
  46652. const leftTableRef = vue.ref();
  46653. const rightTableRef = vue.ref();
  46654. const {
  46655. columns,
  46656. columnsStyles,
  46657. columnsTotalWidth,
  46658. fixedColumnsOnLeft,
  46659. fixedColumnsOnRight,
  46660. hasFixedColumns,
  46661. mainColumns,
  46662. onColumnSorted
  46663. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  46664. const {
  46665. scrollTo,
  46666. scrollToLeft,
  46667. scrollToTop,
  46668. scrollToRow,
  46669. onScroll,
  46670. onVerticalScroll,
  46671. scrollPos
  46672. } = useScrollbar(props, {
  46673. mainTableRef,
  46674. leftTableRef,
  46675. rightTableRef,
  46676. onMaybeEndReached
  46677. });
  46678. const ns = useNamespace("table-v2");
  46679. const instance = vue.getCurrentInstance();
  46680. const isScrolling = vue.shallowRef(false);
  46681. const {
  46682. expandedRowKeys,
  46683. lastRenderedRowIndex,
  46684. isDynamic,
  46685. isResetting,
  46686. rowHeights,
  46687. resetAfterIndex,
  46688. onRowExpanded,
  46689. onRowHeightChange,
  46690. onRowHovered,
  46691. onRowsRendered
  46692. } = useRow(props, {
  46693. mainTableRef,
  46694. leftTableRef,
  46695. rightTableRef,
  46696. tableInstance: instance,
  46697. ns,
  46698. isScrolling
  46699. });
  46700. const { data, depthMap } = useData(props, {
  46701. expandedRowKeys,
  46702. lastRenderedRowIndex,
  46703. resetAfterIndex
  46704. });
  46705. const {
  46706. bodyWidth,
  46707. fixedTableHeight,
  46708. mainTableHeight,
  46709. leftTableWidth,
  46710. rightTableWidth,
  46711. headerWidth,
  46712. rowsHeight,
  46713. windowHeight,
  46714. footerHeight,
  46715. emptyStyle,
  46716. rootStyle,
  46717. headerHeight
  46718. } = useStyles(props, {
  46719. columnsTotalWidth,
  46720. data,
  46721. fixedColumnsOnLeft,
  46722. fixedColumnsOnRight
  46723. });
  46724. const containerRef = vue.ref();
  46725. const showEmpty = vue.computed(() => {
  46726. const noData = vue.unref(data).length === 0;
  46727. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  46728. });
  46729. function getRowHeight(rowIndex) {
  46730. const { estimatedRowHeight, rowHeight, rowKey } = props;
  46731. if (!estimatedRowHeight)
  46732. return rowHeight;
  46733. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  46734. }
  46735. function onMaybeEndReached() {
  46736. const { onEndReached } = props;
  46737. if (!onEndReached)
  46738. return;
  46739. const { scrollTop } = vue.unref(scrollPos);
  46740. const _totalHeight = vue.unref(rowsHeight);
  46741. const clientHeight = vue.unref(windowHeight);
  46742. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  46743. if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  46744. onEndReached(heightUntilEnd);
  46745. }
  46746. }
  46747. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  46748. deep: true
  46749. });
  46750. return {
  46751. columns,
  46752. containerRef,
  46753. mainTableRef,
  46754. leftTableRef,
  46755. rightTableRef,
  46756. isDynamic,
  46757. isResetting,
  46758. isScrolling,
  46759. hasFixedColumns,
  46760. columnsStyles,
  46761. columnsTotalWidth,
  46762. data,
  46763. expandedRowKeys,
  46764. depthMap,
  46765. fixedColumnsOnLeft,
  46766. fixedColumnsOnRight,
  46767. mainColumns,
  46768. bodyWidth,
  46769. emptyStyle,
  46770. rootStyle,
  46771. headerWidth,
  46772. footerHeight,
  46773. mainTableHeight,
  46774. fixedTableHeight,
  46775. leftTableWidth,
  46776. rightTableWidth,
  46777. showEmpty,
  46778. getRowHeight,
  46779. onColumnSorted,
  46780. onRowHovered,
  46781. onRowExpanded,
  46782. onRowsRendered,
  46783. onRowHeightChange,
  46784. scrollTo,
  46785. scrollToLeft,
  46786. scrollToTop,
  46787. scrollToRow,
  46788. onScroll,
  46789. onVerticalScroll
  46790. };
  46791. }
  46792. const TableV2InjectionKey = Symbol("tableV2");
  46793. const classType = String;
  46794. const columns = {
  46795. type: definePropType(Array),
  46796. required: true
  46797. };
  46798. const fixedDataType = {
  46799. type: definePropType(Array)
  46800. };
  46801. const dataType = {
  46802. ...fixedDataType,
  46803. required: true
  46804. };
  46805. const expandColumnKey = String;
  46806. const expandKeys = {
  46807. type: definePropType(Array),
  46808. default: () => mutable([])
  46809. };
  46810. const requiredNumber = {
  46811. type: Number,
  46812. required: true
  46813. };
  46814. const rowKey = {
  46815. type: definePropType([String, Number, Symbol]),
  46816. default: "id"
  46817. };
  46818. const styleType = {
  46819. type: definePropType(Object)
  46820. };
  46821. const tableV2RowProps = buildProps({
  46822. class: String,
  46823. columns,
  46824. columnsStyles: {
  46825. type: definePropType(Object),
  46826. required: true
  46827. },
  46828. depth: Number,
  46829. expandColumnKey,
  46830. estimatedRowHeight: {
  46831. ...virtualizedGridProps.estimatedRowHeight,
  46832. default: void 0
  46833. },
  46834. isScrolling: Boolean,
  46835. onRowExpand: {
  46836. type: definePropType(Function)
  46837. },
  46838. onRowHover: {
  46839. type: definePropType(Function)
  46840. },
  46841. onRowHeightChange: {
  46842. type: definePropType(Function)
  46843. },
  46844. rowData: {
  46845. type: definePropType(Object),
  46846. required: true
  46847. },
  46848. rowEventHandlers: {
  46849. type: definePropType(Object)
  46850. },
  46851. rowIndex: {
  46852. type: Number,
  46853. required: true
  46854. },
  46855. rowKey,
  46856. style: {
  46857. type: definePropType(Object)
  46858. }
  46859. });
  46860. const requiredNumberType = {
  46861. type: Number,
  46862. required: true
  46863. };
  46864. const tableV2HeaderProps = buildProps({
  46865. class: String,
  46866. columns,
  46867. fixedHeaderData: {
  46868. type: definePropType(Array)
  46869. },
  46870. headerData: {
  46871. type: definePropType(Array),
  46872. required: true
  46873. },
  46874. headerHeight: {
  46875. type: definePropType([Number, Array]),
  46876. default: 50
  46877. },
  46878. rowWidth: requiredNumberType,
  46879. rowHeight: {
  46880. type: Number,
  46881. default: 50
  46882. },
  46883. height: requiredNumberType,
  46884. width: requiredNumberType
  46885. });
  46886. const tableV2GridProps = buildProps({
  46887. columns,
  46888. data: dataType,
  46889. fixedData: fixedDataType,
  46890. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  46891. width: requiredNumber,
  46892. height: requiredNumber,
  46893. headerWidth: requiredNumber,
  46894. headerHeight: tableV2HeaderProps.headerHeight,
  46895. bodyWidth: requiredNumber,
  46896. rowHeight: requiredNumber,
  46897. cache: virtualizedListProps.cache,
  46898. useIsScrolling: Boolean,
  46899. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  46900. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  46901. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  46902. class: classType,
  46903. style: styleType,
  46904. containerStyle: styleType,
  46905. getRowHeight: {
  46906. type: definePropType(Function),
  46907. required: true
  46908. },
  46909. rowKey: tableV2RowProps.rowKey,
  46910. onRowsRendered: {
  46911. type: definePropType(Function)
  46912. },
  46913. onScroll: {
  46914. type: definePropType(Function)
  46915. }
  46916. });
  46917. const tableV2Props = buildProps({
  46918. cache: tableV2GridProps.cache,
  46919. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  46920. rowKey,
  46921. headerClass: {
  46922. type: definePropType([
  46923. String,
  46924. Function
  46925. ])
  46926. },
  46927. headerProps: {
  46928. type: definePropType([
  46929. Object,
  46930. Function
  46931. ])
  46932. },
  46933. headerCellProps: {
  46934. type: definePropType([
  46935. Object,
  46936. Function
  46937. ])
  46938. },
  46939. headerHeight: tableV2HeaderProps.headerHeight,
  46940. footerHeight: {
  46941. type: Number,
  46942. default: 0
  46943. },
  46944. rowClass: {
  46945. type: definePropType([String, Function])
  46946. },
  46947. rowProps: {
  46948. type: definePropType([Object, Function])
  46949. },
  46950. rowHeight: {
  46951. type: Number,
  46952. default: 50
  46953. },
  46954. cellProps: {
  46955. type: definePropType([
  46956. Object,
  46957. Function
  46958. ])
  46959. },
  46960. columns,
  46961. data: dataType,
  46962. dataGetter: {
  46963. type: definePropType(Function)
  46964. },
  46965. fixedData: fixedDataType,
  46966. expandColumnKey: tableV2RowProps.expandColumnKey,
  46967. expandedRowKeys: expandKeys,
  46968. defaultExpandedRowKeys: expandKeys,
  46969. class: classType,
  46970. fixed: Boolean,
  46971. style: {
  46972. type: definePropType(Object)
  46973. },
  46974. width: requiredNumber,
  46975. height: requiredNumber,
  46976. maxHeight: Number,
  46977. useIsScrolling: Boolean,
  46978. indentSize: {
  46979. type: Number,
  46980. default: 12
  46981. },
  46982. iconSize: {
  46983. type: Number,
  46984. default: 12
  46985. },
  46986. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  46987. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  46988. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  46989. sortBy: {
  46990. type: definePropType(Object),
  46991. default: () => ({})
  46992. },
  46993. sortState: {
  46994. type: definePropType(Object),
  46995. default: void 0
  46996. },
  46997. onColumnSort: {
  46998. type: definePropType(Function)
  46999. },
  47000. onExpandedRowsChange: {
  47001. type: definePropType(Function)
  47002. },
  47003. onEndReached: {
  47004. type: definePropType(Function)
  47005. },
  47006. onRowExpand: tableV2RowProps.onRowExpand,
  47007. onScroll: tableV2GridProps.onScroll,
  47008. onRowsRendered: tableV2GridProps.onRowsRendered,
  47009. rowEventHandlers: tableV2RowProps.rowEventHandlers
  47010. });
  47011. const TableV2Cell = (props, {
  47012. slots
  47013. }) => {
  47014. var _a;
  47015. const {
  47016. cellData,
  47017. style
  47018. } = props;
  47019. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  47020. const defaultSlot = vue.renderSlot(slots, "default", props, () => [displayText]);
  47021. return vue.createVNode("div", {
  47022. "class": props.class,
  47023. "title": displayText,
  47024. "style": style
  47025. }, [defaultSlot]);
  47026. };
  47027. TableV2Cell.displayName = "ElTableV2Cell";
  47028. TableV2Cell.inheritAttrs = false;
  47029. var TableCell = TableV2Cell;
  47030. const HeaderCell = (props, {
  47031. slots
  47032. }) => vue.renderSlot(slots, "default", props, () => {
  47033. var _a, _b;
  47034. return [vue.createVNode("div", {
  47035. "class": props.class,
  47036. "title": (_a = props.column) == null ? void 0 : _a.title
  47037. }, [(_b = props.column) == null ? void 0 : _b.title])];
  47038. });
  47039. HeaderCell.displayName = "ElTableV2HeaderCell";
  47040. HeaderCell.inheritAttrs = false;
  47041. var HeaderCell$1 = HeaderCell;
  47042. const tableV2HeaderRowProps = buildProps({
  47043. class: String,
  47044. columns,
  47045. columnsStyles: {
  47046. type: definePropType(Object),
  47047. required: true
  47048. },
  47049. headerIndex: Number,
  47050. style: { type: definePropType(Object) }
  47051. });
  47052. const TableV2HeaderRow = vue.defineComponent({
  47053. name: "ElTableV2HeaderRow",
  47054. props: tableV2HeaderRowProps,
  47055. setup(props, {
  47056. slots
  47057. }) {
  47058. return () => {
  47059. const {
  47060. columns,
  47061. columnsStyles,
  47062. headerIndex,
  47063. style
  47064. } = props;
  47065. let Cells = columns.map((column, columnIndex) => {
  47066. return slots.cell({
  47067. columns,
  47068. column,
  47069. columnIndex,
  47070. headerIndex,
  47071. style: columnsStyles[column.key]
  47072. });
  47073. });
  47074. if (slots.header) {
  47075. Cells = slots.header({
  47076. cells: Cells.map((node) => {
  47077. if (isArray$1(node) && node.length === 1) {
  47078. return node[0];
  47079. }
  47080. return node;
  47081. }),
  47082. columns,
  47083. headerIndex
  47084. });
  47085. }
  47086. return vue.createVNode("div", {
  47087. "class": props.class,
  47088. "style": style,
  47089. "role": "row"
  47090. }, [Cells]);
  47091. };
  47092. }
  47093. });
  47094. var HeaderRow = TableV2HeaderRow;
  47095. const COMPONENT_NAME$7 = "ElTableV2Header";
  47096. const TableV2Header = vue.defineComponent({
  47097. name: COMPONENT_NAME$7,
  47098. props: tableV2HeaderProps,
  47099. setup(props, {
  47100. slots,
  47101. expose
  47102. }) {
  47103. const ns = useNamespace("table-v2");
  47104. const headerRef = vue.ref();
  47105. const headerStyle = vue.computed(() => enforceUnit({
  47106. width: props.width,
  47107. height: props.height
  47108. }));
  47109. const rowStyle = vue.computed(() => enforceUnit({
  47110. width: props.rowWidth,
  47111. height: props.height
  47112. }));
  47113. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  47114. const scrollToLeft = (left) => {
  47115. const headerEl = vue.unref(headerRef);
  47116. vue.nextTick(() => {
  47117. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  47118. left
  47119. });
  47120. });
  47121. };
  47122. const renderFixedRows = () => {
  47123. const fixedRowClassName = ns.e("fixed-header-row");
  47124. const {
  47125. columns,
  47126. fixedHeaderData,
  47127. rowHeight
  47128. } = props;
  47129. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  47130. var _a;
  47131. const style = enforceUnit({
  47132. height: rowHeight,
  47133. width: "100%"
  47134. });
  47135. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  47136. class: fixedRowClassName,
  47137. columns,
  47138. rowData: fixedRowData,
  47139. rowIndex: -(fixedRowIndex + 1),
  47140. style
  47141. });
  47142. });
  47143. };
  47144. const renderDynamicRows = () => {
  47145. const dynamicRowClassName = ns.e("dynamic-header-row");
  47146. const {
  47147. columns
  47148. } = props;
  47149. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  47150. var _a;
  47151. const style = enforceUnit({
  47152. width: "100%",
  47153. height: rowHeight
  47154. });
  47155. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  47156. class: dynamicRowClassName,
  47157. columns,
  47158. headerIndex: rowIndex,
  47159. style
  47160. });
  47161. });
  47162. };
  47163. expose({
  47164. scrollToLeft
  47165. });
  47166. return () => {
  47167. if (props.height <= 0)
  47168. return;
  47169. return vue.createVNode("div", {
  47170. "ref": headerRef,
  47171. "class": props.class,
  47172. "style": vue.unref(headerStyle),
  47173. "role": "rowgroup"
  47174. }, [vue.createVNode("div", {
  47175. "style": vue.unref(rowStyle),
  47176. "class": ns.e("header")
  47177. }, [renderDynamicRows(), renderFixedRows()])]);
  47178. };
  47179. }
  47180. });
  47181. var Header = TableV2Header;
  47182. const useTableRow = (props) => {
  47183. const {
  47184. isScrolling
  47185. } = vue.inject(TableV2InjectionKey);
  47186. const measured = vue.ref(false);
  47187. const rowRef = vue.ref();
  47188. const measurable = vue.computed(() => {
  47189. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  47190. });
  47191. const doMeasure = (isInit = false) => {
  47192. const $rowRef = vue.unref(rowRef);
  47193. if (!$rowRef)
  47194. return;
  47195. const {
  47196. columns,
  47197. onRowHeightChange,
  47198. rowKey,
  47199. rowIndex,
  47200. style
  47201. } = props;
  47202. const {
  47203. height
  47204. } = $rowRef.getBoundingClientRect();
  47205. measured.value = true;
  47206. vue.nextTick(() => {
  47207. if (isInit || height !== Number.parseInt(style.height)) {
  47208. const firstColumn = columns[0];
  47209. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  47210. onRowHeightChange == null ? void 0 : onRowHeightChange({
  47211. rowKey,
  47212. height,
  47213. rowIndex
  47214. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  47215. }
  47216. });
  47217. };
  47218. const eventHandlers = vue.computed(() => {
  47219. const {
  47220. rowData,
  47221. rowIndex,
  47222. rowKey,
  47223. onRowHover
  47224. } = props;
  47225. const handlers = props.rowEventHandlers || {};
  47226. const eventHandlers2 = {};
  47227. Object.entries(handlers).forEach(([eventName, handler]) => {
  47228. if (isFunction$1(handler)) {
  47229. eventHandlers2[eventName] = (event) => {
  47230. handler({
  47231. event,
  47232. rowData,
  47233. rowIndex,
  47234. rowKey
  47235. });
  47236. };
  47237. }
  47238. });
  47239. if (onRowHover) {
  47240. [{
  47241. name: "onMouseleave",
  47242. hovered: false
  47243. }, {
  47244. name: "onMouseenter",
  47245. hovered: true
  47246. }].forEach(({
  47247. name,
  47248. hovered
  47249. }) => {
  47250. const existedHandler = eventHandlers2[name];
  47251. eventHandlers2[name] = (event) => {
  47252. onRowHover({
  47253. event,
  47254. hovered,
  47255. rowData,
  47256. rowIndex,
  47257. rowKey
  47258. });
  47259. existedHandler == null ? void 0 : existedHandler(event);
  47260. };
  47261. });
  47262. }
  47263. return eventHandlers2;
  47264. });
  47265. const onExpand = (expanded) => {
  47266. const {
  47267. onRowExpand,
  47268. rowData,
  47269. rowIndex,
  47270. rowKey
  47271. } = props;
  47272. onRowExpand == null ? void 0 : onRowExpand({
  47273. expanded,
  47274. rowData,
  47275. rowIndex,
  47276. rowKey
  47277. });
  47278. };
  47279. vue.onMounted(() => {
  47280. if (vue.unref(measurable)) {
  47281. doMeasure(true);
  47282. }
  47283. });
  47284. return {
  47285. isScrolling,
  47286. measurable,
  47287. measured,
  47288. rowRef,
  47289. eventHandlers,
  47290. onExpand
  47291. };
  47292. };
  47293. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  47294. const TableV2Row = vue.defineComponent({
  47295. name: COMPONENT_NAME$6,
  47296. props: tableV2RowProps,
  47297. setup(props, {
  47298. expose,
  47299. slots,
  47300. attrs
  47301. }) {
  47302. const {
  47303. eventHandlers,
  47304. isScrolling,
  47305. measurable,
  47306. measured,
  47307. rowRef,
  47308. onExpand
  47309. } = useTableRow(props);
  47310. expose({
  47311. onExpand
  47312. });
  47313. return () => {
  47314. const {
  47315. columns,
  47316. columnsStyles,
  47317. expandColumnKey,
  47318. depth,
  47319. rowData,
  47320. rowIndex,
  47321. style
  47322. } = props;
  47323. let ColumnCells = columns.map((column, columnIndex) => {
  47324. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  47325. return slots.cell({
  47326. column,
  47327. columns,
  47328. columnIndex,
  47329. depth,
  47330. style: columnsStyles[column.key],
  47331. rowData,
  47332. rowIndex,
  47333. isScrolling: vue.unref(isScrolling),
  47334. expandIconProps: expandable ? {
  47335. rowData,
  47336. rowIndex,
  47337. onExpand
  47338. } : void 0
  47339. });
  47340. });
  47341. if (slots.row) {
  47342. ColumnCells = slots.row({
  47343. cells: ColumnCells.map((node) => {
  47344. if (isArray$1(node) && node.length === 1) {
  47345. return node[0];
  47346. }
  47347. return node;
  47348. }),
  47349. style,
  47350. columns,
  47351. depth,
  47352. rowData,
  47353. rowIndex,
  47354. isScrolling: vue.unref(isScrolling)
  47355. });
  47356. }
  47357. if (vue.unref(measurable)) {
  47358. const {
  47359. height,
  47360. ...exceptHeightStyle
  47361. } = style || {};
  47362. const _measured = vue.unref(measured);
  47363. return vue.createVNode("div", vue.mergeProps({
  47364. "ref": rowRef,
  47365. "class": props.class,
  47366. "style": _measured ? style : exceptHeightStyle,
  47367. "role": "row"
  47368. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  47369. }
  47370. return vue.createVNode("div", vue.mergeProps(attrs, {
  47371. "ref": rowRef,
  47372. "class": props.class,
  47373. "style": style,
  47374. "role": "row"
  47375. }, vue.unref(eventHandlers)), [ColumnCells]);
  47376. };
  47377. }
  47378. });
  47379. var Row = TableV2Row;
  47380. const SortIcon = (props) => {
  47381. const {
  47382. sortOrder
  47383. } = props;
  47384. return vue.createVNode(ElIcon, {
  47385. "size": 14,
  47386. "class": props.class
  47387. }, {
  47388. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  47389. });
  47390. };
  47391. var SortIcon$1 = SortIcon;
  47392. const ExpandIcon = (props) => {
  47393. const {
  47394. expanded,
  47395. expandable,
  47396. onExpand,
  47397. style,
  47398. size
  47399. } = props;
  47400. const expandIconProps = {
  47401. onClick: expandable ? () => onExpand(!expanded) : void 0,
  47402. class: props.class
  47403. };
  47404. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  47405. "size": size,
  47406. "style": style
  47407. }), {
  47408. default: () => [vue.createVNode(arrow_right_default, null, null)]
  47409. });
  47410. };
  47411. var ExpandIcon$1 = ExpandIcon;
  47412. const COMPONENT_NAME$5 = "ElTableV2Grid";
  47413. const useTableGrid = (props) => {
  47414. const headerRef = vue.ref();
  47415. const bodyRef = vue.ref();
  47416. const totalHeight = vue.computed(() => {
  47417. const {
  47418. data,
  47419. rowHeight,
  47420. estimatedRowHeight
  47421. } = props;
  47422. if (estimatedRowHeight) {
  47423. return;
  47424. }
  47425. return data.length * rowHeight;
  47426. });
  47427. const fixedRowHeight = vue.computed(() => {
  47428. const {
  47429. fixedData,
  47430. rowHeight
  47431. } = props;
  47432. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  47433. });
  47434. const headerHeight = vue.computed(() => sum(props.headerHeight));
  47435. const gridHeight = vue.computed(() => {
  47436. const {
  47437. height
  47438. } = props;
  47439. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  47440. });
  47441. const hasHeader = vue.computed(() => {
  47442. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  47443. });
  47444. const itemKey = ({
  47445. data,
  47446. rowIndex
  47447. }) => data[rowIndex][props.rowKey];
  47448. function onItemRendered({
  47449. rowCacheStart,
  47450. rowCacheEnd,
  47451. rowVisibleStart,
  47452. rowVisibleEnd
  47453. }) {
  47454. var _a;
  47455. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  47456. rowCacheStart,
  47457. rowCacheEnd,
  47458. rowVisibleStart,
  47459. rowVisibleEnd
  47460. });
  47461. }
  47462. function resetAfterRowIndex(index, forceUpdate2) {
  47463. var _a;
  47464. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  47465. }
  47466. function scrollTo(leftOrOptions, top) {
  47467. const header$ = vue.unref(headerRef);
  47468. const body$ = vue.unref(bodyRef);
  47469. if (isObject$1(leftOrOptions)) {
  47470. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  47471. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  47472. } else {
  47473. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  47474. body$ == null ? void 0 : body$.scrollTo({
  47475. scrollLeft: leftOrOptions,
  47476. scrollTop: top
  47477. });
  47478. }
  47479. }
  47480. function scrollToTop(scrollTop) {
  47481. var _a;
  47482. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  47483. scrollTop
  47484. });
  47485. }
  47486. function scrollToRow(row, strategy) {
  47487. var _a;
  47488. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  47489. }
  47490. function forceUpdate() {
  47491. var _a, _b;
  47492. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  47493. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  47494. }
  47495. return {
  47496. bodyRef,
  47497. forceUpdate,
  47498. fixedRowHeight,
  47499. gridHeight,
  47500. hasHeader,
  47501. headerHeight,
  47502. headerRef,
  47503. totalHeight,
  47504. itemKey,
  47505. onItemRendered,
  47506. resetAfterRowIndex,
  47507. scrollTo,
  47508. scrollToTop,
  47509. scrollToRow
  47510. };
  47511. };
  47512. const TableGrid = vue.defineComponent({
  47513. name: COMPONENT_NAME$5,
  47514. props: tableV2GridProps,
  47515. setup(props, {
  47516. slots,
  47517. expose
  47518. }) {
  47519. const {
  47520. ns
  47521. } = vue.inject(TableV2InjectionKey);
  47522. const {
  47523. bodyRef,
  47524. fixedRowHeight,
  47525. gridHeight,
  47526. hasHeader,
  47527. headerRef,
  47528. headerHeight,
  47529. totalHeight,
  47530. forceUpdate,
  47531. itemKey,
  47532. onItemRendered,
  47533. resetAfterRowIndex,
  47534. scrollTo,
  47535. scrollToTop,
  47536. scrollToRow
  47537. } = useTableGrid(props);
  47538. expose({
  47539. forceUpdate,
  47540. totalHeight,
  47541. scrollTo,
  47542. scrollToTop,
  47543. scrollToRow,
  47544. resetAfterRowIndex
  47545. });
  47546. const getColumnWidth = () => props.bodyWidth;
  47547. return () => {
  47548. const {
  47549. cache,
  47550. columns,
  47551. data,
  47552. fixedData,
  47553. useIsScrolling,
  47554. scrollbarAlwaysOn,
  47555. scrollbarEndGap,
  47556. scrollbarStartGap,
  47557. style,
  47558. rowHeight,
  47559. bodyWidth,
  47560. estimatedRowHeight,
  47561. headerWidth,
  47562. height,
  47563. width,
  47564. getRowHeight,
  47565. onScroll
  47566. } = props;
  47567. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  47568. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  47569. const _headerHeight = vue.unref(headerHeight);
  47570. return vue.createVNode("div", {
  47571. "role": "table",
  47572. "class": [ns.e("table"), props.class],
  47573. "style": style
  47574. }, [vue.createVNode(Grid, {
  47575. "ref": bodyRef,
  47576. "data": data,
  47577. "useIsScrolling": useIsScrolling,
  47578. "itemKey": itemKey,
  47579. "columnCache": 0,
  47580. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  47581. "totalColumn": 1,
  47582. "totalRow": data.length,
  47583. "rowCache": cache,
  47584. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  47585. "width": width,
  47586. "height": vue.unref(gridHeight),
  47587. "class": ns.e("body"),
  47588. "role": "rowgroup",
  47589. "scrollbarStartGap": scrollbarStartGap,
  47590. "scrollbarEndGap": scrollbarEndGap,
  47591. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  47592. "onScroll": onScroll,
  47593. "onItemRendered": onItemRendered,
  47594. "perfMode": false
  47595. }, {
  47596. default: (params) => {
  47597. var _a;
  47598. const rowData = data[params.rowIndex];
  47599. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  47600. ...params,
  47601. columns,
  47602. rowData
  47603. });
  47604. }
  47605. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  47606. "ref": headerRef,
  47607. "class": ns.e("header-wrapper"),
  47608. "columns": columns,
  47609. "headerData": data,
  47610. "headerHeight": props.headerHeight,
  47611. "fixedHeaderData": fixedData,
  47612. "rowWidth": headerWidth,
  47613. "rowHeight": rowHeight,
  47614. "width": width,
  47615. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  47616. }, {
  47617. dynamic: slots.header,
  47618. fixed: slots.row
  47619. })]);
  47620. };
  47621. }
  47622. });
  47623. function _isSlot$5(s) {
  47624. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47625. }
  47626. const MainTable = (props, {
  47627. slots
  47628. }) => {
  47629. const {
  47630. mainTableRef,
  47631. ...rest
  47632. } = props;
  47633. return vue.createVNode(TableGrid, vue.mergeProps({
  47634. "ref": mainTableRef
  47635. }, rest), _isSlot$5(slots) ? slots : {
  47636. default: () => [slots]
  47637. });
  47638. };
  47639. function _isSlot$4(s) {
  47640. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47641. }
  47642. const LeftTable$1 = (props, {
  47643. slots
  47644. }) => {
  47645. if (!props.columns.length)
  47646. return;
  47647. const {
  47648. leftTableRef,
  47649. ...rest
  47650. } = props;
  47651. return vue.createVNode(TableGrid, vue.mergeProps({
  47652. "ref": leftTableRef
  47653. }, rest), _isSlot$4(slots) ? slots : {
  47654. default: () => [slots]
  47655. });
  47656. };
  47657. function _isSlot$3(s) {
  47658. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47659. }
  47660. const LeftTable = (props, {
  47661. slots
  47662. }) => {
  47663. if (!props.columns.length)
  47664. return;
  47665. const {
  47666. rightTableRef,
  47667. ...rest
  47668. } = props;
  47669. return vue.createVNode(TableGrid, vue.mergeProps({
  47670. "ref": rightTableRef
  47671. }, rest), _isSlot$3(slots) ? slots : {
  47672. default: () => [slots]
  47673. });
  47674. };
  47675. function _isSlot$2(s) {
  47676. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47677. }
  47678. const RowRenderer = (props, {
  47679. slots
  47680. }) => {
  47681. const {
  47682. columns,
  47683. columnsStyles,
  47684. depthMap,
  47685. expandColumnKey,
  47686. expandedRowKeys,
  47687. estimatedRowHeight,
  47688. hasFixedColumns,
  47689. rowData,
  47690. rowIndex,
  47691. style,
  47692. isScrolling,
  47693. rowProps,
  47694. rowClass,
  47695. rowKey,
  47696. rowEventHandlers,
  47697. ns,
  47698. onRowHovered,
  47699. onRowExpanded
  47700. } = props;
  47701. const rowKls = tryCall(rowClass, {
  47702. columns,
  47703. rowData,
  47704. rowIndex
  47705. }, "");
  47706. const additionalProps = tryCall(rowProps, {
  47707. columns,
  47708. rowData,
  47709. rowIndex
  47710. });
  47711. const _rowKey = rowData[rowKey];
  47712. const depth = depthMap[_rowKey] || 0;
  47713. const canExpand = Boolean(expandColumnKey);
  47714. const isFixedRow = rowIndex < 0;
  47715. const kls = [ns.e("row"), rowKls, {
  47716. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  47717. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  47718. [ns.is("fixed")]: !depth && isFixedRow,
  47719. [ns.is("customized")]: Boolean(slots.row)
  47720. }];
  47721. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  47722. const _rowProps = {
  47723. ...additionalProps,
  47724. columns,
  47725. columnsStyles,
  47726. class: kls,
  47727. depth,
  47728. expandColumnKey,
  47729. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  47730. isScrolling,
  47731. rowIndex,
  47732. rowData,
  47733. rowKey: _rowKey,
  47734. rowEventHandlers,
  47735. style
  47736. };
  47737. const handlerMosueEnter = (e) => {
  47738. onRowHover == null ? void 0 : onRowHover({
  47739. hovered: true,
  47740. rowKey: _rowKey,
  47741. event: e,
  47742. rowData,
  47743. rowIndex
  47744. });
  47745. };
  47746. const handlerMouseLeave = (e) => {
  47747. onRowHover == null ? void 0 : onRowHover({
  47748. hovered: false,
  47749. rowKey: _rowKey,
  47750. event: e,
  47751. rowData,
  47752. rowIndex
  47753. });
  47754. };
  47755. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  47756. "onRowExpand": onRowExpanded,
  47757. "onMouseenter": handlerMosueEnter,
  47758. "onMouseleave": handlerMouseLeave,
  47759. "rowkey": _rowKey
  47760. }), _isSlot$2(slots) ? slots : {
  47761. default: () => [slots]
  47762. });
  47763. };
  47764. const CellRenderer = ({
  47765. columns,
  47766. column,
  47767. columnIndex,
  47768. depth,
  47769. expandIconProps,
  47770. isScrolling,
  47771. rowData,
  47772. rowIndex,
  47773. style,
  47774. expandedRowKeys,
  47775. ns,
  47776. cellProps: _cellProps,
  47777. expandColumnKey,
  47778. indentSize,
  47779. iconSize,
  47780. rowKey
  47781. }, {
  47782. slots
  47783. }) => {
  47784. const cellStyle = enforceUnit(style);
  47785. if (column.placeholderSign === placeholderSign) {
  47786. return vue.createVNode("div", {
  47787. "class": ns.em("row-cell", "placeholder"),
  47788. "style": cellStyle
  47789. }, null);
  47790. }
  47791. const {
  47792. cellRenderer,
  47793. dataKey,
  47794. dataGetter
  47795. } = column;
  47796. const cellData = isFunction$1(dataGetter) ? dataGetter({
  47797. columns,
  47798. column,
  47799. columnIndex,
  47800. rowData,
  47801. rowIndex
  47802. }) : get(rowData, dataKey != null ? dataKey : "");
  47803. const extraCellProps = tryCall(_cellProps, {
  47804. cellData,
  47805. columns,
  47806. column,
  47807. columnIndex,
  47808. rowIndex,
  47809. rowData
  47810. });
  47811. const cellProps = {
  47812. class: ns.e("cell-text"),
  47813. columns,
  47814. column,
  47815. columnIndex,
  47816. cellData,
  47817. isScrolling,
  47818. rowData,
  47819. rowIndex
  47820. };
  47821. const columnCellRenderer = componentToSlot(cellRenderer);
  47822. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(TableCell, cellProps, null)]);
  47823. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  47824. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  47825. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  47826. let IconOrPlaceholder;
  47827. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  47828. if (expandable) {
  47829. if (isObject$1(expandIconProps)) {
  47830. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  47831. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  47832. "size": iconSize,
  47833. "expanded": expanded,
  47834. "style": iconStyle,
  47835. "expandable": true
  47836. }), null);
  47837. } else {
  47838. IconOrPlaceholder = vue.createVNode("div", {
  47839. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  47840. }, null);
  47841. }
  47842. }
  47843. return vue.createVNode("div", vue.mergeProps({
  47844. "class": kls,
  47845. "style": cellStyle
  47846. }, extraCellProps, {
  47847. "role": "cell"
  47848. }), [IconOrPlaceholder, Cell]);
  47849. };
  47850. CellRenderer.inheritAttrs = false;
  47851. function _isSlot$1(s) {
  47852. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47853. }
  47854. const HeaderRenderer = ({
  47855. columns,
  47856. columnsStyles,
  47857. headerIndex,
  47858. style,
  47859. headerClass,
  47860. headerProps,
  47861. ns
  47862. }, {
  47863. slots
  47864. }) => {
  47865. const param = {
  47866. columns,
  47867. headerIndex
  47868. };
  47869. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  47870. [ns.is("customized")]: Boolean(slots.header)
  47871. }];
  47872. const extraProps = {
  47873. ...tryCall(headerProps, param),
  47874. columnsStyles,
  47875. class: kls,
  47876. columns,
  47877. headerIndex,
  47878. style
  47879. };
  47880. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  47881. default: () => [slots]
  47882. });
  47883. };
  47884. const HeaderCellRenderer = (props, {
  47885. slots
  47886. }) => {
  47887. const {
  47888. column,
  47889. ns,
  47890. style,
  47891. onColumnSorted
  47892. } = props;
  47893. const cellStyle = enforceUnit(style);
  47894. if (column.placeholderSign === placeholderSign) {
  47895. return vue.createVNode("div", {
  47896. "class": ns.em("header-row-cell", "placeholder"),
  47897. "style": cellStyle
  47898. }, null);
  47899. }
  47900. const {
  47901. headerCellRenderer,
  47902. headerClass,
  47903. sortable
  47904. } = column;
  47905. const cellProps = {
  47906. ...props,
  47907. class: ns.e("header-cell-text")
  47908. };
  47909. const columnCellRenderer = componentToSlot(headerCellRenderer);
  47910. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(HeaderCell$1, cellProps, null)]);
  47911. const {
  47912. sortBy,
  47913. sortState,
  47914. headerCellProps
  47915. } = props;
  47916. let sorting, sortOrder;
  47917. if (sortState) {
  47918. const order = sortState[column.key];
  47919. sorting = Boolean(oppositeOrderMap[order]);
  47920. sortOrder = sorting ? order : SortOrder.ASC;
  47921. } else {
  47922. sorting = column.key === sortBy.key;
  47923. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  47924. }
  47925. 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")];
  47926. const cellWrapperProps = {
  47927. ...tryCall(headerCellProps, props),
  47928. onClick: column.sortable ? onColumnSorted : void 0,
  47929. class: cellKls,
  47930. style: cellStyle,
  47931. ["data-key"]: column.key
  47932. };
  47933. return vue.createVNode("div", vue.mergeProps(cellWrapperProps, {
  47934. "role": "columnheader"
  47935. }), [Cell, sortable && vue.createVNode(SortIcon$1, {
  47936. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  47937. "sortOrder": sortOrder
  47938. }, null)]);
  47939. };
  47940. const Footer$1 = (props, {
  47941. slots
  47942. }) => {
  47943. var _a;
  47944. return vue.createVNode("div", {
  47945. "class": props.class,
  47946. "style": props.style
  47947. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  47948. };
  47949. Footer$1.displayName = "ElTableV2Footer";
  47950. const Footer = (props, {
  47951. slots
  47952. }) => {
  47953. const defaultSlot = vue.renderSlot(slots, "default", {}, () => [vue.createVNode(ElEmpty, null, null)]);
  47954. return vue.createVNode("div", {
  47955. "class": props.class,
  47956. "style": props.style
  47957. }, [defaultSlot]);
  47958. };
  47959. Footer.displayName = "ElTableV2Empty";
  47960. const Overlay = (props, {
  47961. slots
  47962. }) => {
  47963. var _a;
  47964. return vue.createVNode("div", {
  47965. "class": props.class,
  47966. "style": props.style
  47967. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  47968. };
  47969. Overlay.displayName = "ElTableV2Overlay";
  47970. function _isSlot(s) {
  47971. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47972. }
  47973. const COMPONENT_NAME$4 = "ElTableV2";
  47974. const TableV2 = vue.defineComponent({
  47975. name: COMPONENT_NAME$4,
  47976. props: tableV2Props,
  47977. setup(props, {
  47978. slots,
  47979. expose
  47980. }) {
  47981. const ns = useNamespace("table-v2");
  47982. const {
  47983. columnsStyles,
  47984. fixedColumnsOnLeft,
  47985. fixedColumnsOnRight,
  47986. mainColumns,
  47987. mainTableHeight,
  47988. fixedTableHeight,
  47989. leftTableWidth,
  47990. rightTableWidth,
  47991. data,
  47992. depthMap,
  47993. expandedRowKeys,
  47994. hasFixedColumns,
  47995. mainTableRef,
  47996. leftTableRef,
  47997. rightTableRef,
  47998. isDynamic,
  47999. isResetting,
  48000. isScrolling,
  48001. bodyWidth,
  48002. emptyStyle,
  48003. rootStyle,
  48004. headerWidth,
  48005. footerHeight,
  48006. showEmpty,
  48007. scrollTo,
  48008. scrollToLeft,
  48009. scrollToTop,
  48010. scrollToRow,
  48011. getRowHeight,
  48012. onColumnSorted,
  48013. onRowHeightChange,
  48014. onRowHovered,
  48015. onRowExpanded,
  48016. onRowsRendered,
  48017. onScroll,
  48018. onVerticalScroll
  48019. } = useTable(props);
  48020. expose({
  48021. scrollTo,
  48022. scrollToLeft,
  48023. scrollToTop,
  48024. scrollToRow
  48025. });
  48026. vue.provide(TableV2InjectionKey, {
  48027. ns,
  48028. isResetting,
  48029. isScrolling
  48030. });
  48031. return () => {
  48032. const {
  48033. cache,
  48034. cellProps,
  48035. estimatedRowHeight,
  48036. expandColumnKey,
  48037. fixedData,
  48038. headerHeight,
  48039. headerClass,
  48040. headerProps,
  48041. headerCellProps,
  48042. sortBy,
  48043. sortState,
  48044. rowHeight,
  48045. rowClass,
  48046. rowEventHandlers,
  48047. rowKey,
  48048. rowProps,
  48049. scrollbarAlwaysOn,
  48050. indentSize,
  48051. iconSize,
  48052. useIsScrolling,
  48053. vScrollbarSize,
  48054. width
  48055. } = props;
  48056. const _data = vue.unref(data);
  48057. const mainTableProps = {
  48058. cache,
  48059. class: ns.e("main"),
  48060. columns: vue.unref(mainColumns),
  48061. data: _data,
  48062. fixedData,
  48063. estimatedRowHeight,
  48064. bodyWidth: vue.unref(bodyWidth) + vScrollbarSize,
  48065. headerHeight,
  48066. headerWidth: vue.unref(headerWidth),
  48067. height: vue.unref(mainTableHeight),
  48068. mainTableRef,
  48069. rowKey,
  48070. rowHeight,
  48071. scrollbarAlwaysOn,
  48072. scrollbarStartGap: 2,
  48073. scrollbarEndGap: vScrollbarSize,
  48074. useIsScrolling,
  48075. width,
  48076. getRowHeight,
  48077. onRowsRendered,
  48078. onScroll
  48079. };
  48080. const leftColumnsWidth = vue.unref(leftTableWidth);
  48081. const _fixedTableHeight = vue.unref(fixedTableHeight);
  48082. const leftTableProps = {
  48083. cache,
  48084. class: ns.e("left"),
  48085. columns: vue.unref(fixedColumnsOnLeft),
  48086. data: _data,
  48087. estimatedRowHeight,
  48088. leftTableRef,
  48089. rowHeight,
  48090. bodyWidth: leftColumnsWidth,
  48091. headerWidth: leftColumnsWidth,
  48092. headerHeight,
  48093. height: _fixedTableHeight,
  48094. rowKey,
  48095. scrollbarAlwaysOn,
  48096. scrollbarStartGap: 2,
  48097. scrollbarEndGap: vScrollbarSize,
  48098. useIsScrolling,
  48099. width: leftColumnsWidth,
  48100. getRowHeight,
  48101. onScroll: onVerticalScroll
  48102. };
  48103. const rightColumnsWidth = vue.unref(rightTableWidth);
  48104. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  48105. const rightTableProps = {
  48106. cache,
  48107. class: ns.e("right"),
  48108. columns: vue.unref(fixedColumnsOnRight),
  48109. data: _data,
  48110. estimatedRowHeight,
  48111. rightTableRef,
  48112. rowHeight,
  48113. bodyWidth: rightColumnsWidthWithScrollbar,
  48114. headerWidth: rightColumnsWidthWithScrollbar,
  48115. headerHeight,
  48116. height: _fixedTableHeight,
  48117. rowKey,
  48118. scrollbarAlwaysOn,
  48119. scrollbarStartGap: 2,
  48120. scrollbarEndGap: vScrollbarSize,
  48121. width: rightColumnsWidthWithScrollbar,
  48122. style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  48123. useIsScrolling,
  48124. getRowHeight,
  48125. onScroll: onVerticalScroll
  48126. };
  48127. const _columnsStyles = vue.unref(columnsStyles);
  48128. const tableRowProps = {
  48129. ns,
  48130. depthMap: vue.unref(depthMap),
  48131. columnsStyles: _columnsStyles,
  48132. expandColumnKey,
  48133. expandedRowKeys: vue.unref(expandedRowKeys),
  48134. estimatedRowHeight,
  48135. hasFixedColumns: vue.unref(hasFixedColumns),
  48136. rowProps,
  48137. rowClass,
  48138. rowKey,
  48139. rowEventHandlers,
  48140. onRowHovered,
  48141. onRowExpanded,
  48142. onRowHeightChange
  48143. };
  48144. const tableCellProps = {
  48145. cellProps,
  48146. expandColumnKey,
  48147. indentSize,
  48148. iconSize,
  48149. rowKey,
  48150. expandedRowKeys: vue.unref(expandedRowKeys),
  48151. ns
  48152. };
  48153. const tableHeaderProps = {
  48154. ns,
  48155. headerClass,
  48156. headerProps,
  48157. columnsStyles: _columnsStyles
  48158. };
  48159. const tableHeaderCellProps = {
  48160. ns,
  48161. sortBy,
  48162. sortState,
  48163. headerCellProps,
  48164. onColumnSorted
  48165. };
  48166. const tableSlots = {
  48167. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  48168. row: slots.row,
  48169. cell: (props3) => {
  48170. let _slot;
  48171. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  48172. "style": _columnsStyles[props3.column.key]
  48173. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  48174. default: () => [_slot]
  48175. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  48176. "style": _columnsStyles[props3.column.key]
  48177. }), null);
  48178. }
  48179. }),
  48180. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  48181. header: slots.header,
  48182. cell: (props3) => {
  48183. let _slot2;
  48184. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  48185. "style": _columnsStyles[props3.column.key]
  48186. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  48187. default: () => [_slot2]
  48188. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  48189. "style": _columnsStyles[props3.column.key]
  48190. }), null);
  48191. }
  48192. })
  48193. };
  48194. const rootKls = [props.class, ns.b(), ns.e("root"), {
  48195. [ns.is("dynamic")]: vue.unref(isDynamic)
  48196. }];
  48197. const footerProps = {
  48198. class: ns.e("footer"),
  48199. style: vue.unref(footerHeight)
  48200. };
  48201. return vue.createVNode("div", {
  48202. "class": rootKls,
  48203. "style": vue.unref(rootStyle)
  48204. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  48205. default: () => [tableSlots]
  48206. }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  48207. default: () => [tableSlots]
  48208. }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  48209. default: () => [tableSlots]
  48210. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  48211. default: slots.footer
  48212. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  48213. "class": ns.e("empty"),
  48214. "style": vue.unref(emptyStyle)
  48215. }, {
  48216. default: slots.empty
  48217. }), slots.overlay && vue.createVNode(Overlay, {
  48218. "class": ns.e("overlay")
  48219. }, {
  48220. default: slots.overlay
  48221. })]);
  48222. };
  48223. }
  48224. });
  48225. var TableV2$1 = TableV2;
  48226. const autoResizerProps = buildProps({
  48227. disableWidth: Boolean,
  48228. disableHeight: Boolean,
  48229. onResize: {
  48230. type: definePropType(Function)
  48231. }
  48232. });
  48233. const AutoResizer = vue.defineComponent({
  48234. name: "ElAutoResizer",
  48235. props: autoResizerProps,
  48236. setup(props, {
  48237. slots
  48238. }) {
  48239. const ns = useNamespace("auto-resizer");
  48240. const {
  48241. height,
  48242. width,
  48243. sizer
  48244. } = useAutoResize(props);
  48245. const style = {
  48246. width: "100%",
  48247. height: "100%"
  48248. };
  48249. return () => {
  48250. var _a;
  48251. return vue.createVNode("div", {
  48252. "ref": sizer,
  48253. "class": ns.b(),
  48254. "style": style
  48255. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  48256. height: height.value,
  48257. width: width.value
  48258. })]);
  48259. };
  48260. }
  48261. });
  48262. const ElTableV2 = withInstall(TableV2$1);
  48263. const ElAutoResizer = withInstall(AutoResizer);
  48264. const tabsRootContextKey = Symbol("tabsRootContextKey");
  48265. const tabBarProps = buildProps({
  48266. tabs: {
  48267. type: definePropType(Array),
  48268. default: () => mutable([])
  48269. }
  48270. });
  48271. const COMPONENT_NAME$3 = "ElTabBar";
  48272. const __default__$u = vue.defineComponent({
  48273. name: COMPONENT_NAME$3
  48274. });
  48275. const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
  48276. ...__default__$u,
  48277. props: tabBarProps,
  48278. setup(__props, { expose }) {
  48279. const props = __props;
  48280. const instance = vue.getCurrentInstance();
  48281. const rootTabs = vue.inject(tabsRootContextKey);
  48282. if (!rootTabs)
  48283. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  48284. const ns = useNamespace("tabs");
  48285. const barRef = vue.ref();
  48286. const barStyle = vue.ref();
  48287. const getBarStyle = () => {
  48288. let offset = 0;
  48289. let tabSize = 0;
  48290. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  48291. const sizeDir = sizeName === "width" ? "x" : "y";
  48292. const position = sizeDir === "x" ? "left" : "top";
  48293. props.tabs.every((tab) => {
  48294. var _a, _b;
  48295. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  48296. if (!$el)
  48297. return false;
  48298. if (!tab.active) {
  48299. return true;
  48300. }
  48301. offset = $el[`offset${capitalize(position)}`];
  48302. tabSize = $el[`client${capitalize(sizeName)}`];
  48303. const tabStyles = window.getComputedStyle($el);
  48304. if (sizeName === "width") {
  48305. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  48306. offset += Number.parseFloat(tabStyles.paddingLeft);
  48307. }
  48308. return false;
  48309. });
  48310. return {
  48311. [sizeName]: `${tabSize}px`,
  48312. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  48313. };
  48314. };
  48315. const update = () => barStyle.value = getBarStyle();
  48316. const saveObserver = [];
  48317. const observerTabs = () => {
  48318. var _a;
  48319. saveObserver.forEach((observer) => observer.stop());
  48320. saveObserver.length = 0;
  48321. const list = (_a = instance.parent) == null ? void 0 : _a.refs;
  48322. if (!list)
  48323. return;
  48324. for (const key in list) {
  48325. if (key.startsWith("tab-")) {
  48326. const _el = list[key];
  48327. if (_el) {
  48328. saveObserver.push(useResizeObserver(_el, update));
  48329. }
  48330. }
  48331. }
  48332. };
  48333. vue.watch(() => props.tabs, async () => {
  48334. await vue.nextTick();
  48335. update();
  48336. observerTabs();
  48337. }, { immediate: true });
  48338. const barObserever = useResizeObserver(barRef, () => update());
  48339. vue.onBeforeUnmount(() => {
  48340. saveObserver.forEach((observer) => observer.stop());
  48341. saveObserver.length = 0;
  48342. barObserever.stop();
  48343. });
  48344. expose({
  48345. ref: barRef,
  48346. update
  48347. });
  48348. return (_ctx, _cache) => {
  48349. return vue.openBlock(), vue.createElementBlock("div", {
  48350. ref_key: "barRef",
  48351. ref: barRef,
  48352. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  48353. style: vue.normalizeStyle(barStyle.value)
  48354. }, null, 6);
  48355. };
  48356. }
  48357. });
  48358. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__file", "tab-bar.vue"]]);
  48359. const tabNavProps = buildProps({
  48360. panes: {
  48361. type: definePropType(Array),
  48362. default: () => mutable([])
  48363. },
  48364. currentName: {
  48365. type: [String, Number],
  48366. default: ""
  48367. },
  48368. editable: Boolean,
  48369. type: {
  48370. type: String,
  48371. values: ["card", "border-card", ""],
  48372. default: ""
  48373. },
  48374. stretch: Boolean
  48375. });
  48376. const tabNavEmits = {
  48377. tabClick: (tab, tabName, ev) => ev instanceof Event,
  48378. tabRemove: (tab, ev) => ev instanceof Event
  48379. };
  48380. const COMPONENT_NAME$2 = "ElTabNav";
  48381. const TabNav = vue.defineComponent({
  48382. name: COMPONENT_NAME$2,
  48383. props: tabNavProps,
  48384. emits: tabNavEmits,
  48385. setup(props, {
  48386. expose,
  48387. emit
  48388. }) {
  48389. const rootTabs = vue.inject(tabsRootContextKey);
  48390. if (!rootTabs)
  48391. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  48392. const ns = useNamespace("tabs");
  48393. const visibility = useDocumentVisibility();
  48394. const focused = useWindowFocus();
  48395. const navScroll$ = vue.ref();
  48396. const nav$ = vue.ref();
  48397. const el$ = vue.ref();
  48398. const tabBarRef = vue.ref();
  48399. const scrollable = vue.ref(false);
  48400. const navOffset = vue.ref(0);
  48401. const isFocus = vue.ref(false);
  48402. const focusable = vue.ref(true);
  48403. const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  48404. const navStyle = vue.computed(() => {
  48405. const dir = sizeName.value === "width" ? "X" : "Y";
  48406. return {
  48407. transform: `translate${dir}(-${navOffset.value}px)`
  48408. };
  48409. });
  48410. const scrollPrev = () => {
  48411. if (!navScroll$.value)
  48412. return;
  48413. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  48414. const currentOffset = navOffset.value;
  48415. if (!currentOffset)
  48416. return;
  48417. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  48418. navOffset.value = newOffset;
  48419. };
  48420. const scrollNext = () => {
  48421. if (!navScroll$.value || !nav$.value)
  48422. return;
  48423. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  48424. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  48425. const currentOffset = navOffset.value;
  48426. if (navSize - currentOffset <= containerSize)
  48427. return;
  48428. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  48429. navOffset.value = newOffset;
  48430. };
  48431. const scrollToActiveTab = async () => {
  48432. const nav = nav$.value;
  48433. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  48434. return;
  48435. await vue.nextTick();
  48436. const activeTab = el$.value.querySelector(".is-active");
  48437. if (!activeTab)
  48438. return;
  48439. const navScroll = navScroll$.value;
  48440. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  48441. const activeTabBounding = activeTab.getBoundingClientRect();
  48442. const navScrollBounding = navScroll.getBoundingClientRect();
  48443. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  48444. const currentOffset = navOffset.value;
  48445. let newOffset = currentOffset;
  48446. if (isHorizontal) {
  48447. if (activeTabBounding.left < navScrollBounding.left) {
  48448. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  48449. }
  48450. if (activeTabBounding.right > navScrollBounding.right) {
  48451. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  48452. }
  48453. } else {
  48454. if (activeTabBounding.top < navScrollBounding.top) {
  48455. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  48456. }
  48457. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  48458. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  48459. }
  48460. }
  48461. newOffset = Math.max(newOffset, 0);
  48462. navOffset.value = Math.min(newOffset, maxOffset);
  48463. };
  48464. const update = () => {
  48465. var _a;
  48466. if (!nav$.value || !navScroll$.value)
  48467. return;
  48468. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  48469. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  48470. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  48471. const currentOffset = navOffset.value;
  48472. if (containerSize < navSize) {
  48473. scrollable.value = scrollable.value || {};
  48474. scrollable.value.prev = currentOffset;
  48475. scrollable.value.next = currentOffset + containerSize < navSize;
  48476. if (navSize - currentOffset < containerSize) {
  48477. navOffset.value = navSize - containerSize;
  48478. }
  48479. } else {
  48480. scrollable.value = false;
  48481. if (currentOffset > 0) {
  48482. navOffset.value = 0;
  48483. }
  48484. }
  48485. };
  48486. const changeTab = (e) => {
  48487. const code = e.code;
  48488. const {
  48489. up,
  48490. down,
  48491. left,
  48492. right
  48493. } = EVENT_CODE;
  48494. if (![up, down, left, right].includes(code))
  48495. return;
  48496. const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  48497. const currentIndex = tabList.indexOf(e.target);
  48498. let nextIndex;
  48499. if (code === left || code === up) {
  48500. if (currentIndex === 0) {
  48501. nextIndex = tabList.length - 1;
  48502. } else {
  48503. nextIndex = currentIndex - 1;
  48504. }
  48505. } else {
  48506. if (currentIndex < tabList.length - 1) {
  48507. nextIndex = currentIndex + 1;
  48508. } else {
  48509. nextIndex = 0;
  48510. }
  48511. }
  48512. tabList[nextIndex].focus({
  48513. preventScroll: true
  48514. });
  48515. tabList[nextIndex].click();
  48516. setFocus();
  48517. };
  48518. const setFocus = () => {
  48519. if (focusable.value)
  48520. isFocus.value = true;
  48521. };
  48522. const removeFocus = () => isFocus.value = false;
  48523. vue.watch(visibility, (visibility2) => {
  48524. if (visibility2 === "hidden") {
  48525. focusable.value = false;
  48526. } else if (visibility2 === "visible") {
  48527. setTimeout(() => focusable.value = true, 50);
  48528. }
  48529. });
  48530. vue.watch(focused, (focused2) => {
  48531. if (focused2) {
  48532. setTimeout(() => focusable.value = true, 50);
  48533. } else {
  48534. focusable.value = false;
  48535. }
  48536. });
  48537. useResizeObserver(el$, update);
  48538. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  48539. vue.onUpdated(() => update());
  48540. expose({
  48541. scrollToActiveTab,
  48542. removeFocus
  48543. });
  48544. return () => {
  48545. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  48546. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  48547. "onClick": scrollPrev
  48548. }, [vue.createVNode(ElIcon, null, {
  48549. default: () => [vue.createVNode(arrow_left_default, null, null)]
  48550. })]), vue.createVNode("span", {
  48551. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  48552. "onClick": scrollNext
  48553. }, [vue.createVNode(ElIcon, null, {
  48554. default: () => [vue.createVNode(arrow_right_default, null, null)]
  48555. })])] : null;
  48556. const tabs = props.panes.map((pane, index) => {
  48557. var _a, _b, _c, _d;
  48558. const uid = pane.uid;
  48559. const disabled = pane.props.disabled;
  48560. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  48561. const closable = !disabled && (pane.isClosable || props.editable);
  48562. pane.index = `${index}`;
  48563. const btnClose = closable ? vue.createVNode(ElIcon, {
  48564. "class": "is-icon-close",
  48565. "onClick": (ev) => emit("tabRemove", pane, ev)
  48566. }, {
  48567. default: () => [vue.createVNode(close_default, null, null)]
  48568. }) : null;
  48569. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  48570. const tabindex = !disabled && pane.active ? 0 : -1;
  48571. return vue.createVNode("div", {
  48572. "ref": `tab-${uid}`,
  48573. "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)],
  48574. "id": `tab-${tabName}`,
  48575. "key": `tab-${uid}`,
  48576. "aria-controls": `pane-${tabName}`,
  48577. "role": "tab",
  48578. "aria-selected": pane.active,
  48579. "tabindex": tabindex,
  48580. "onFocus": () => setFocus(),
  48581. "onBlur": () => removeFocus(),
  48582. "onClick": (ev) => {
  48583. removeFocus();
  48584. emit("tabClick", pane, tabName, ev);
  48585. },
  48586. "onKeydown": (ev) => {
  48587. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  48588. emit("tabRemove", pane, ev);
  48589. }
  48590. }
  48591. }, [...[tabLabelContent, btnClose]]);
  48592. });
  48593. return vue.createVNode("div", {
  48594. "ref": el$,
  48595. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  48596. }, [scrollBtn, vue.createVNode("div", {
  48597. "class": ns.e("nav-scroll"),
  48598. "ref": navScroll$
  48599. }, [vue.createVNode("div", {
  48600. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  48601. "ref": nav$,
  48602. "style": navStyle.value,
  48603. "role": "tablist",
  48604. "onKeydown": changeTab
  48605. }, [...[!props.type ? vue.createVNode(TabBar, {
  48606. "ref": tabBarRef,
  48607. "tabs": [...props.panes]
  48608. }, null) : null, tabs]])])]);
  48609. };
  48610. }
  48611. });
  48612. const tabsProps = buildProps({
  48613. type: {
  48614. type: String,
  48615. values: ["card", "border-card", ""],
  48616. default: ""
  48617. },
  48618. closable: Boolean,
  48619. addable: Boolean,
  48620. modelValue: {
  48621. type: [String, Number]
  48622. },
  48623. editable: Boolean,
  48624. tabPosition: {
  48625. type: String,
  48626. values: ["top", "right", "bottom", "left"],
  48627. default: "top"
  48628. },
  48629. beforeLeave: {
  48630. type: definePropType(Function),
  48631. default: () => true
  48632. },
  48633. stretch: Boolean
  48634. });
  48635. const isPaneName = (value) => isString$1(value) || isNumber(value);
  48636. const tabsEmits = {
  48637. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  48638. tabClick: (pane, ev) => ev instanceof Event,
  48639. tabChange: (name) => isPaneName(name),
  48640. edit: (paneName, action) => ["remove", "add"].includes(action),
  48641. tabRemove: (name) => isPaneName(name),
  48642. tabAdd: () => true
  48643. };
  48644. const Tabs = vue.defineComponent({
  48645. name: "ElTabs",
  48646. props: tabsProps,
  48647. emits: tabsEmits,
  48648. setup(props, {
  48649. emit,
  48650. slots,
  48651. expose
  48652. }) {
  48653. var _a;
  48654. const ns = useNamespace("tabs");
  48655. const isVertical = vue.computed(() => ["left", "right"].includes(props.tabPosition));
  48656. const {
  48657. children: panes,
  48658. addChild: sortPane,
  48659. removeChild: unregisterPane
  48660. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  48661. const nav$ = vue.ref();
  48662. const currentName = vue.ref((_a = props.modelValue) != null ? _a : "0");
  48663. const setCurrentName = async (value, trigger = false) => {
  48664. var _a2, _b, _c;
  48665. if (currentName.value === value || isUndefined(value))
  48666. return;
  48667. try {
  48668. const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value));
  48669. if (canLeave !== false) {
  48670. currentName.value = value;
  48671. if (trigger) {
  48672. emit(UPDATE_MODEL_EVENT, value);
  48673. emit("tabChange", value);
  48674. }
  48675. (_c = (_b = nav$.value) == null ? void 0 : _b.removeFocus) == null ? void 0 : _c.call(_b);
  48676. }
  48677. } catch (e) {
  48678. }
  48679. };
  48680. const handleTabClick = (tab, tabName, event) => {
  48681. if (tab.props.disabled)
  48682. return;
  48683. setCurrentName(tabName, true);
  48684. emit("tabClick", tab, event);
  48685. };
  48686. const handleTabRemove = (pane, ev) => {
  48687. if (pane.props.disabled || isUndefined(pane.props.name))
  48688. return;
  48689. ev.stopPropagation();
  48690. emit("edit", pane.props.name, "remove");
  48691. emit("tabRemove", pane.props.name);
  48692. };
  48693. const handleTabAdd = () => {
  48694. emit("edit", void 0, "add");
  48695. emit("tabAdd");
  48696. };
  48697. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  48698. vue.watch(currentName, async () => {
  48699. var _a2;
  48700. await vue.nextTick();
  48701. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  48702. });
  48703. vue.provide(tabsRootContextKey, {
  48704. props,
  48705. currentName,
  48706. registerPane: (pane) => {
  48707. panes.value.push(pane);
  48708. },
  48709. sortPane,
  48710. unregisterPane
  48711. });
  48712. expose({
  48713. currentName
  48714. });
  48715. const TabNavRenderer = ({
  48716. render
  48717. }) => {
  48718. return render();
  48719. };
  48720. return () => {
  48721. const addSlot = slots["add-icon"];
  48722. const newButton = props.editable || props.addable ? vue.createVNode("div", {
  48723. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  48724. "tabindex": "0",
  48725. "onClick": handleTabAdd,
  48726. "onKeydown": (ev) => {
  48727. if (ev.code === EVENT_CODE.enter)
  48728. handleTabAdd();
  48729. }
  48730. }, [addSlot ? vue.renderSlot(slots, "add-icon") : vue.createVNode(ElIcon, {
  48731. "class": ns.is("icon-plus")
  48732. }, {
  48733. default: () => [vue.createVNode(plus_default, null, null)]
  48734. })]) : null;
  48735. const header = vue.createVNode("div", {
  48736. "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
  48737. }, [vue.createVNode(TabNavRenderer, {
  48738. "render": () => {
  48739. const hasLabelSlot = panes.value.some((pane) => pane.slots.label);
  48740. return vue.createVNode(TabNav, {
  48741. ref: nav$,
  48742. currentName: currentName.value,
  48743. editable: props.editable,
  48744. type: props.type,
  48745. panes: panes.value,
  48746. stretch: props.stretch,
  48747. onTabClick: handleTabClick,
  48748. onTabRemove: handleTabRemove
  48749. }, {
  48750. $stable: !hasLabelSlot
  48751. });
  48752. }
  48753. }, null), newButton]);
  48754. const panels = vue.createVNode("div", {
  48755. "class": ns.e("content")
  48756. }, [vue.renderSlot(slots, "default")]);
  48757. return vue.createVNode("div", {
  48758. "class": [ns.b(), ns.m(props.tabPosition), {
  48759. [ns.m("card")]: props.type === "card",
  48760. [ns.m("border-card")]: props.type === "border-card"
  48761. }]
  48762. }, [panels, header]);
  48763. };
  48764. }
  48765. });
  48766. const tabPaneProps = buildProps({
  48767. label: {
  48768. type: String,
  48769. default: ""
  48770. },
  48771. name: {
  48772. type: [String, Number]
  48773. },
  48774. closable: Boolean,
  48775. disabled: Boolean,
  48776. lazy: Boolean
  48777. });
  48778. const COMPONENT_NAME$1 = "ElTabPane";
  48779. const __default__$t = vue.defineComponent({
  48780. name: COMPONENT_NAME$1
  48781. });
  48782. const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
  48783. ...__default__$t,
  48784. props: tabPaneProps,
  48785. setup(__props) {
  48786. const props = __props;
  48787. const instance = vue.getCurrentInstance();
  48788. const slots = vue.useSlots();
  48789. const tabsRoot = vue.inject(tabsRootContextKey);
  48790. if (!tabsRoot)
  48791. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  48792. const ns = useNamespace("tab-pane");
  48793. const index = vue.ref();
  48794. const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
  48795. const active = computedEager(() => {
  48796. var _a;
  48797. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  48798. });
  48799. const loaded = vue.ref(active.value);
  48800. const paneName = vue.computed(() => {
  48801. var _a;
  48802. return (_a = props.name) != null ? _a : index.value;
  48803. });
  48804. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  48805. vue.watch(active, (val) => {
  48806. if (val)
  48807. loaded.value = true;
  48808. });
  48809. const pane = vue.reactive({
  48810. uid: instance.uid,
  48811. slots,
  48812. props,
  48813. paneName,
  48814. active,
  48815. index,
  48816. isClosable
  48817. });
  48818. tabsRoot.registerPane(pane);
  48819. vue.onMounted(() => {
  48820. tabsRoot.sortPane(pane);
  48821. });
  48822. vue.onUnmounted(() => {
  48823. tabsRoot.unregisterPane(pane.uid);
  48824. });
  48825. return (_ctx, _cache) => {
  48826. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  48827. key: 0,
  48828. id: `pane-${vue.unref(paneName)}`,
  48829. class: vue.normalizeClass(vue.unref(ns).b()),
  48830. role: "tabpanel",
  48831. "aria-hidden": !vue.unref(active),
  48832. "aria-labelledby": `tab-${vue.unref(paneName)}`
  48833. }, [
  48834. vue.renderSlot(_ctx.$slots, "default")
  48835. ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
  48836. [vue.vShow, vue.unref(active)]
  48837. ]) : vue.createCommentVNode("v-if", true);
  48838. };
  48839. }
  48840. });
  48841. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "tab-pane.vue"]]);
  48842. const ElTabs = withInstall(Tabs, {
  48843. TabPane
  48844. });
  48845. const ElTabPane = withNoopInstall(TabPane);
  48846. const textProps = buildProps({
  48847. type: {
  48848. type: String,
  48849. values: ["primary", "success", "info", "warning", "danger", ""],
  48850. default: ""
  48851. },
  48852. size: {
  48853. type: String,
  48854. values: componentSizes,
  48855. default: ""
  48856. },
  48857. truncated: Boolean,
  48858. lineClamp: {
  48859. type: [String, Number]
  48860. },
  48861. tag: {
  48862. type: String,
  48863. default: "span"
  48864. }
  48865. });
  48866. const __default__$s = vue.defineComponent({
  48867. name: "ElText"
  48868. });
  48869. const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
  48870. ...__default__$s,
  48871. props: textProps,
  48872. setup(__props) {
  48873. const props = __props;
  48874. const textSize = useFormSize();
  48875. const ns = useNamespace("text");
  48876. const textKls = vue.computed(() => [
  48877. ns.b(),
  48878. ns.m(props.type),
  48879. ns.m(textSize.value),
  48880. ns.is("truncated", props.truncated),
  48881. ns.is("line-clamp", !isUndefined(props.lineClamp))
  48882. ]);
  48883. return (_ctx, _cache) => {
  48884. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  48885. class: vue.normalizeClass(vue.unref(textKls)),
  48886. style: vue.normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  48887. }, {
  48888. default: vue.withCtx(() => [
  48889. vue.renderSlot(_ctx.$slots, "default")
  48890. ]),
  48891. _: 3
  48892. }, 8, ["class", "style"]);
  48893. };
  48894. }
  48895. });
  48896. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "text.vue"]]);
  48897. const ElText = withInstall(Text);
  48898. const timeSelectProps = buildProps({
  48899. format: {
  48900. type: String,
  48901. default: "HH:mm"
  48902. },
  48903. modelValue: String,
  48904. disabled: Boolean,
  48905. editable: {
  48906. type: Boolean,
  48907. default: true
  48908. },
  48909. effect: {
  48910. type: definePropType(String),
  48911. default: "light"
  48912. },
  48913. clearable: {
  48914. type: Boolean,
  48915. default: true
  48916. },
  48917. size: useSizeProp,
  48918. placeholder: String,
  48919. start: {
  48920. type: String,
  48921. default: "09:00"
  48922. },
  48923. end: {
  48924. type: String,
  48925. default: "18:00"
  48926. },
  48927. step: {
  48928. type: String,
  48929. default: "00:30"
  48930. },
  48931. minTime: String,
  48932. maxTime: String,
  48933. name: String,
  48934. prefixIcon: {
  48935. type: definePropType([String, Object]),
  48936. default: () => clock_default
  48937. },
  48938. clearIcon: {
  48939. type: definePropType([String, Object]),
  48940. default: () => circle_close_default
  48941. },
  48942. ...useEmptyValuesProps
  48943. });
  48944. const parseTime = (time) => {
  48945. const values = (time || "").split(":");
  48946. if (values.length >= 2) {
  48947. let hours = Number.parseInt(values[0], 10);
  48948. const minutes = Number.parseInt(values[1], 10);
  48949. const timeUpper = time.toUpperCase();
  48950. if (timeUpper.includes("AM") && hours === 12) {
  48951. hours = 0;
  48952. } else if (timeUpper.includes("PM") && hours !== 12) {
  48953. hours += 12;
  48954. }
  48955. return {
  48956. hours,
  48957. minutes
  48958. };
  48959. }
  48960. return null;
  48961. };
  48962. const compareTime = (time1, time2) => {
  48963. const value1 = parseTime(time1);
  48964. if (!value1)
  48965. return -1;
  48966. const value2 = parseTime(time2);
  48967. if (!value2)
  48968. return -1;
  48969. const minutes1 = value1.minutes + value1.hours * 60;
  48970. const minutes2 = value2.minutes + value2.hours * 60;
  48971. if (minutes1 === minutes2) {
  48972. return 0;
  48973. }
  48974. return minutes1 > minutes2 ? 1 : -1;
  48975. };
  48976. const padTime = (time) => {
  48977. return `${time}`.padStart(2, "0");
  48978. };
  48979. const formatTime = (time) => {
  48980. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  48981. };
  48982. const nextTime = (time, step) => {
  48983. const timeValue = parseTime(time);
  48984. if (!timeValue)
  48985. return "";
  48986. const stepValue = parseTime(step);
  48987. if (!stepValue)
  48988. return "";
  48989. const next = {
  48990. hours: timeValue.hours,
  48991. minutes: timeValue.minutes
  48992. };
  48993. next.minutes += stepValue.minutes;
  48994. next.hours += stepValue.hours;
  48995. next.hours += Math.floor(next.minutes / 60);
  48996. next.minutes = next.minutes % 60;
  48997. return formatTime(next);
  48998. };
  48999. const __default__$r = vue.defineComponent({
  49000. name: "ElTimeSelect"
  49001. });
  49002. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  49003. ...__default__$r,
  49004. props: timeSelectProps,
  49005. emits: ["change", "blur", "focus", "clear", "update:modelValue"],
  49006. setup(__props, { expose }) {
  49007. const props = __props;
  49008. dayjs.extend(customParseFormat);
  49009. const { Option: ElOption } = ElSelect;
  49010. const nsInput = useNamespace("input");
  49011. const select = vue.ref();
  49012. const _disabled = useFormDisabled();
  49013. const { lang } = useLocale();
  49014. const value = vue.computed(() => props.modelValue);
  49015. const start = vue.computed(() => {
  49016. const time = parseTime(props.start);
  49017. return time ? formatTime(time) : null;
  49018. });
  49019. const end = vue.computed(() => {
  49020. const time = parseTime(props.end);
  49021. return time ? formatTime(time) : null;
  49022. });
  49023. const step = vue.computed(() => {
  49024. const time = parseTime(props.step);
  49025. return time ? formatTime(time) : null;
  49026. });
  49027. const minTime = vue.computed(() => {
  49028. const time = parseTime(props.minTime || "");
  49029. return time ? formatTime(time) : null;
  49030. });
  49031. const maxTime = vue.computed(() => {
  49032. const time = parseTime(props.maxTime || "");
  49033. return time ? formatTime(time) : null;
  49034. });
  49035. const items = vue.computed(() => {
  49036. const result = [];
  49037. if (props.start && props.end && props.step) {
  49038. let current = start.value;
  49039. let currentTime;
  49040. while (current && end.value && compareTime(current, end.value) <= 0) {
  49041. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  49042. result.push({
  49043. value: currentTime,
  49044. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  49045. });
  49046. current = nextTime(current, step.value);
  49047. }
  49048. }
  49049. return result;
  49050. });
  49051. const blur = () => {
  49052. var _a, _b;
  49053. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  49054. };
  49055. const focus = () => {
  49056. var _a, _b;
  49057. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  49058. };
  49059. expose({
  49060. blur,
  49061. focus
  49062. });
  49063. return (_ctx, _cache) => {
  49064. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  49065. ref_key: "select",
  49066. ref: select,
  49067. "model-value": vue.unref(value),
  49068. disabled: vue.unref(_disabled),
  49069. clearable: _ctx.clearable,
  49070. "clear-icon": _ctx.clearIcon,
  49071. size: _ctx.size,
  49072. effect: _ctx.effect,
  49073. placeholder: _ctx.placeholder,
  49074. "default-first-option": "",
  49075. filterable: _ctx.editable,
  49076. "empty-values": _ctx.emptyValues,
  49077. "value-on-clear": _ctx.valueOnClear,
  49078. "onUpdate:modelValue": (event) => _ctx.$emit("update:modelValue", event),
  49079. onChange: (event) => _ctx.$emit("change", event),
  49080. onBlur: (event) => _ctx.$emit("blur", event),
  49081. onFocus: (event) => _ctx.$emit("focus", event),
  49082. onClear: () => _ctx.$emit("clear")
  49083. }, {
  49084. prefix: vue.withCtx(() => [
  49085. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  49086. key: 0,
  49087. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  49088. }, {
  49089. default: vue.withCtx(() => [
  49090. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  49091. ]),
  49092. _: 1
  49093. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  49094. ]),
  49095. default: vue.withCtx(() => [
  49096. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  49097. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  49098. key: item.value,
  49099. label: item.value,
  49100. value: item.value,
  49101. disabled: item.disabled
  49102. }, null, 8, ["label", "value", "disabled"]);
  49103. }), 128))
  49104. ]),
  49105. _: 1
  49106. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
  49107. };
  49108. }
  49109. });
  49110. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "time-select.vue"]]);
  49111. const ElTimeSelect = withInstall(TimeSelect);
  49112. const Timeline = vue.defineComponent({
  49113. name: "ElTimeline",
  49114. setup(_, { slots }) {
  49115. const ns = useNamespace("timeline");
  49116. vue.provide("timeline", slots);
  49117. return () => {
  49118. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  49119. };
  49120. }
  49121. });
  49122. var Timeline$1 = Timeline;
  49123. const timelineItemProps = buildProps({
  49124. timestamp: {
  49125. type: String,
  49126. default: ""
  49127. },
  49128. hideTimestamp: Boolean,
  49129. center: Boolean,
  49130. placement: {
  49131. type: String,
  49132. values: ["top", "bottom"],
  49133. default: "bottom"
  49134. },
  49135. type: {
  49136. type: String,
  49137. values: ["primary", "success", "warning", "danger", "info"],
  49138. default: ""
  49139. },
  49140. color: {
  49141. type: String,
  49142. default: ""
  49143. },
  49144. size: {
  49145. type: String,
  49146. values: ["normal", "large"],
  49147. default: "normal"
  49148. },
  49149. icon: {
  49150. type: iconPropType
  49151. },
  49152. hollow: Boolean
  49153. });
  49154. const __default__$q = vue.defineComponent({
  49155. name: "ElTimelineItem"
  49156. });
  49157. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  49158. ...__default__$q,
  49159. props: timelineItemProps,
  49160. setup(__props) {
  49161. const props = __props;
  49162. const ns = useNamespace("timeline-item");
  49163. const defaultNodeKls = vue.computed(() => [
  49164. ns.e("node"),
  49165. ns.em("node", props.size || ""),
  49166. ns.em("node", props.type || ""),
  49167. ns.is("hollow", props.hollow)
  49168. ]);
  49169. return (_ctx, _cache) => {
  49170. return vue.openBlock(), vue.createElementBlock("li", {
  49171. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  49172. }, [
  49173. vue.createElementVNode("div", {
  49174. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  49175. }, null, 2),
  49176. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  49177. key: 0,
  49178. class: vue.normalizeClass(vue.unref(defaultNodeKls)),
  49179. style: vue.normalizeStyle({
  49180. backgroundColor: _ctx.color
  49181. })
  49182. }, [
  49183. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  49184. key: 0,
  49185. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  49186. }, {
  49187. default: vue.withCtx(() => [
  49188. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  49189. ]),
  49190. _: 1
  49191. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  49192. ], 6)) : vue.createCommentVNode("v-if", true),
  49193. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  49194. key: 1,
  49195. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  49196. }, [
  49197. vue.renderSlot(_ctx.$slots, "dot")
  49198. ], 2)) : vue.createCommentVNode("v-if", true),
  49199. vue.createElementVNode("div", {
  49200. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  49201. }, [
  49202. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  49203. key: 0,
  49204. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  49205. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  49206. vue.createElementVNode("div", {
  49207. class: vue.normalizeClass(vue.unref(ns).e("content"))
  49208. }, [
  49209. vue.renderSlot(_ctx.$slots, "default")
  49210. ], 2),
  49211. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  49212. key: 1,
  49213. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  49214. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  49215. ], 2)
  49216. ], 2);
  49217. };
  49218. }
  49219. });
  49220. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "timeline-item.vue"]]);
  49221. const ElTimeline = withInstall(Timeline$1, {
  49222. TimelineItem
  49223. });
  49224. const ElTimelineItem = withNoopInstall(TimelineItem);
  49225. const tooltipV2CommonProps = buildProps({
  49226. nowrap: Boolean
  49227. });
  49228. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  49229. TooltipV2Sides2["top"] = "top";
  49230. TooltipV2Sides2["bottom"] = "bottom";
  49231. TooltipV2Sides2["left"] = "left";
  49232. TooltipV2Sides2["right"] = "right";
  49233. return TooltipV2Sides2;
  49234. })(TooltipV2Sides || {});
  49235. const tooltipV2Sides = Object.values(TooltipV2Sides);
  49236. const tooltipV2ArrowProps = buildProps({
  49237. width: {
  49238. type: Number,
  49239. default: 10
  49240. },
  49241. height: {
  49242. type: Number,
  49243. default: 10
  49244. },
  49245. style: {
  49246. type: definePropType(Object),
  49247. default: null
  49248. }
  49249. });
  49250. const tooltipV2ArrowSpecialProps = buildProps({
  49251. side: {
  49252. type: definePropType(String),
  49253. values: tooltipV2Sides,
  49254. required: true
  49255. }
  49256. });
  49257. const tooltipV2Strategies = ["absolute", "fixed"];
  49258. const tooltipV2Placements = [
  49259. "top-start",
  49260. "top-end",
  49261. "top",
  49262. "bottom-start",
  49263. "bottom-end",
  49264. "bottom",
  49265. "left-start",
  49266. "left-end",
  49267. "left",
  49268. "right-start",
  49269. "right-end",
  49270. "right"
  49271. ];
  49272. const tooltipV2ContentProps = buildProps({
  49273. arrowPadding: {
  49274. type: definePropType(Number),
  49275. default: 5
  49276. },
  49277. effect: {
  49278. type: definePropType(String),
  49279. default: "light"
  49280. },
  49281. contentClass: String,
  49282. placement: {
  49283. type: definePropType(String),
  49284. values: tooltipV2Placements,
  49285. default: "bottom"
  49286. },
  49287. reference: {
  49288. type: definePropType(Object),
  49289. default: null
  49290. },
  49291. offset: {
  49292. type: Number,
  49293. default: 8
  49294. },
  49295. strategy: {
  49296. type: definePropType(String),
  49297. values: tooltipV2Strategies,
  49298. default: "absolute"
  49299. },
  49300. showArrow: Boolean,
  49301. ...useAriaProps(["ariaLabel"])
  49302. });
  49303. const tooltipV2RootProps = buildProps({
  49304. delayDuration: {
  49305. type: Number,
  49306. default: 300
  49307. },
  49308. defaultOpen: Boolean,
  49309. open: {
  49310. type: Boolean,
  49311. default: void 0
  49312. },
  49313. onOpenChange: {
  49314. type: definePropType(Function)
  49315. },
  49316. "onUpdate:open": {
  49317. type: definePropType(Function)
  49318. }
  49319. });
  49320. const EventHandler = {
  49321. type: definePropType(Function)
  49322. };
  49323. const tooltipV2TriggerProps = buildProps({
  49324. onBlur: EventHandler,
  49325. onClick: EventHandler,
  49326. onFocus: EventHandler,
  49327. onMouseDown: EventHandler,
  49328. onMouseEnter: EventHandler,
  49329. onMouseLeave: EventHandler
  49330. });
  49331. const tooltipV2Props = buildProps({
  49332. ...tooltipV2RootProps,
  49333. ...tooltipV2ArrowProps,
  49334. ...tooltipV2TriggerProps,
  49335. ...tooltipV2ContentProps,
  49336. alwaysOn: Boolean,
  49337. fullTransition: Boolean,
  49338. transitionProps: {
  49339. type: definePropType(Object),
  49340. default: null
  49341. },
  49342. teleported: Boolean,
  49343. to: {
  49344. type: definePropType(String),
  49345. default: "body"
  49346. }
  49347. });
  49348. const tooltipV2RootKey = Symbol("tooltipV2");
  49349. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  49350. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  49351. const __default__$p = vue.defineComponent({
  49352. name: "ElTooltipV2Root"
  49353. });
  49354. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  49355. ...__default__$p,
  49356. props: tooltipV2RootProps,
  49357. setup(__props, { expose }) {
  49358. const props = __props;
  49359. const _open = vue.ref(props.defaultOpen);
  49360. const triggerRef = vue.ref(null);
  49361. const open = vue.computed({
  49362. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  49363. set: (open2) => {
  49364. var _a;
  49365. _open.value = open2;
  49366. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  49367. }
  49368. });
  49369. const isOpenDelayed = vue.computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  49370. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  49371. open.value = true;
  49372. }, vue.computed(() => props.delayDuration), {
  49373. immediate: false
  49374. });
  49375. const ns = useNamespace("tooltip-v2");
  49376. const contentId = useId();
  49377. const onNormalOpen = () => {
  49378. clearTimer();
  49379. open.value = true;
  49380. };
  49381. const onDelayOpen = () => {
  49382. vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  49383. };
  49384. const onOpen = onNormalOpen;
  49385. const onClose = () => {
  49386. clearTimer();
  49387. open.value = false;
  49388. };
  49389. const onChange = (open2) => {
  49390. var _a;
  49391. if (open2) {
  49392. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  49393. onOpen();
  49394. }
  49395. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  49396. };
  49397. vue.watch(open, onChange);
  49398. vue.onMounted(() => {
  49399. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  49400. });
  49401. vue.onBeforeUnmount(() => {
  49402. clearTimer();
  49403. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  49404. });
  49405. vue.provide(tooltipV2RootKey, {
  49406. contentId,
  49407. triggerRef,
  49408. ns,
  49409. onClose,
  49410. onDelayOpen,
  49411. onOpen
  49412. });
  49413. expose({
  49414. onOpen,
  49415. onClose
  49416. });
  49417. return (_ctx, _cache) => {
  49418. return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) });
  49419. };
  49420. }
  49421. });
  49422. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "root.vue"]]);
  49423. const __default__$o = vue.defineComponent({
  49424. name: "ElTooltipV2Arrow"
  49425. });
  49426. const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
  49427. ...__default__$o,
  49428. props: {
  49429. ...tooltipV2ArrowProps,
  49430. ...tooltipV2ArrowSpecialProps
  49431. },
  49432. setup(__props) {
  49433. const props = __props;
  49434. const { ns } = vue.inject(tooltipV2RootKey);
  49435. const { arrowRef } = vue.inject(tooltipV2ContentKey);
  49436. const arrowStyle = vue.computed(() => {
  49437. const { style, width, height } = props;
  49438. const namespace = ns.namespace.value;
  49439. return {
  49440. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  49441. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  49442. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  49443. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  49444. ...style || {}
  49445. };
  49446. });
  49447. return (_ctx, _cache) => {
  49448. return vue.openBlock(), vue.createElementBlock("span", {
  49449. ref_key: "arrowRef",
  49450. ref: arrowRef,
  49451. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  49452. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  49453. }, null, 6);
  49454. };
  49455. }
  49456. });
  49457. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "arrow.vue"]]);
  49458. const visualHiddenProps = buildProps({
  49459. style: {
  49460. type: definePropType([String, Object, Array]),
  49461. default: () => ({})
  49462. }
  49463. });
  49464. const __default__$n = vue.defineComponent({
  49465. name: "ElVisuallyHidden"
  49466. });
  49467. const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
  49468. ...__default__$n,
  49469. props: visualHiddenProps,
  49470. setup(__props) {
  49471. const props = __props;
  49472. const computedStyle = vue.computed(() => {
  49473. return [
  49474. props.style,
  49475. {
  49476. position: "absolute",
  49477. border: 0,
  49478. width: 1,
  49479. height: 1,
  49480. padding: 0,
  49481. margin: -1,
  49482. overflow: "hidden",
  49483. clip: "rect(0, 0, 0, 0)",
  49484. whiteSpace: "nowrap",
  49485. wordWrap: "normal"
  49486. }
  49487. ];
  49488. });
  49489. return (_ctx, _cache) => {
  49490. return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
  49491. vue.renderSlot(_ctx.$slots, "default")
  49492. ], 16);
  49493. };
  49494. }
  49495. });
  49496. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "visual-hidden.vue"]]);
  49497. const __default__$m = vue.defineComponent({
  49498. name: "ElTooltipV2Content"
  49499. });
  49500. const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
  49501. ...__default__$m,
  49502. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  49503. setup(__props) {
  49504. const props = __props;
  49505. const { triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  49506. const placement = vue.ref(props.placement);
  49507. const strategy = vue.ref(props.strategy);
  49508. const arrowRef = vue.ref(null);
  49509. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating$1({
  49510. placement,
  49511. strategy,
  49512. middleware: vue.computed(() => {
  49513. const middleware = [offset(props.offset)];
  49514. if (props.showArrow) {
  49515. middleware.push(arrowMiddleware({
  49516. arrowRef
  49517. }));
  49518. }
  49519. return middleware;
  49520. })
  49521. });
  49522. const zIndex = useZIndex().nextZIndex();
  49523. const ns = useNamespace("tooltip-v2");
  49524. const side = vue.computed(() => {
  49525. return placement.value.split("-")[0];
  49526. });
  49527. const contentStyle = vue.computed(() => {
  49528. return {
  49529. position: vue.unref(strategy),
  49530. top: `${vue.unref(y) || 0}px`,
  49531. left: `${vue.unref(x) || 0}px`,
  49532. zIndex
  49533. };
  49534. });
  49535. const arrowStyle = vue.computed(() => {
  49536. if (!props.showArrow)
  49537. return {};
  49538. const { arrow } = vue.unref(middlewareData);
  49539. return {
  49540. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  49541. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  49542. };
  49543. });
  49544. const contentClass = vue.computed(() => [
  49545. ns.e("content"),
  49546. ns.is("dark", props.effect === "dark"),
  49547. ns.is(vue.unref(strategy)),
  49548. props.contentClass
  49549. ]);
  49550. vue.watch(arrowRef, () => update());
  49551. vue.watch(() => props.placement, (val) => placement.value = val);
  49552. vue.onMounted(() => {
  49553. vue.watch(() => props.reference || triggerRef.value, (el) => {
  49554. referenceRef.value = el || void 0;
  49555. }, {
  49556. immediate: true
  49557. });
  49558. });
  49559. vue.provide(tooltipV2ContentKey, { arrowRef });
  49560. return (_ctx, _cache) => {
  49561. return vue.openBlock(), vue.createElementBlock("div", {
  49562. ref_key: "contentRef",
  49563. ref: contentRef,
  49564. style: vue.normalizeStyle(vue.unref(contentStyle)),
  49565. "data-tooltip-v2-root": ""
  49566. }, [
  49567. !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", {
  49568. key: 0,
  49569. "data-side": vue.unref(side),
  49570. class: vue.normalizeClass(vue.unref(contentClass))
  49571. }, [
  49572. vue.renderSlot(_ctx.$slots, "default", {
  49573. contentStyle: vue.unref(contentStyle),
  49574. contentClass: vue.unref(contentClass)
  49575. }),
  49576. vue.createVNode(vue.unref(ElVisuallyHidden), {
  49577. id: vue.unref(contentId),
  49578. role: "tooltip"
  49579. }, {
  49580. default: vue.withCtx(() => [
  49581. _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  49582. vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1)
  49583. ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
  49584. ]),
  49585. _: 3
  49586. }, 8, ["id"]),
  49587. vue.renderSlot(_ctx.$slots, "arrow", {
  49588. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  49589. side: vue.unref(side)
  49590. })
  49591. ], 10, ["data-side"])) : vue.createCommentVNode("v-if", true)
  49592. ], 4);
  49593. };
  49594. }
  49595. });
  49596. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "content.vue"]]);
  49597. const forwardRefProps = buildProps({
  49598. setRef: {
  49599. type: definePropType(Function),
  49600. required: true
  49601. },
  49602. onlyChild: Boolean
  49603. });
  49604. var ForwardRef = vue.defineComponent({
  49605. props: forwardRefProps,
  49606. setup(props, {
  49607. slots
  49608. }) {
  49609. const fragmentRef = vue.ref();
  49610. const setRef = composeRefs(fragmentRef, (el) => {
  49611. if (el) {
  49612. props.setRef(el.nextElementSibling);
  49613. } else {
  49614. props.setRef(null);
  49615. }
  49616. });
  49617. return () => {
  49618. var _a;
  49619. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  49620. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  49621. return vue.createVNode(vue.Fragment, {
  49622. "ref": setRef
  49623. }, [child]);
  49624. };
  49625. }
  49626. });
  49627. const __default__$l = vue.defineComponent({
  49628. name: "ElTooltipV2Trigger"
  49629. });
  49630. const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
  49631. ...__default__$l,
  49632. props: {
  49633. ...tooltipV2CommonProps,
  49634. ...tooltipV2TriggerProps
  49635. },
  49636. setup(__props) {
  49637. const props = __props;
  49638. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  49639. let isMousedown = false;
  49640. const setTriggerRef = (el) => {
  49641. triggerRef.value = el;
  49642. };
  49643. const onMouseup = () => {
  49644. isMousedown = false;
  49645. };
  49646. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  49647. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  49648. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  49649. onClose();
  49650. isMousedown = true;
  49651. document.addEventListener("mouseup", onMouseup, { once: true });
  49652. });
  49653. const onFocus = composeEventHandlers(props.onFocus, () => {
  49654. if (!isMousedown)
  49655. onOpen();
  49656. });
  49657. const onBlur = composeEventHandlers(props.onBlur, onClose);
  49658. const onClick = composeEventHandlers(props.onClick, (e) => {
  49659. if (e.detail === 0)
  49660. onClose();
  49661. });
  49662. const events = {
  49663. blur: onBlur,
  49664. click: onClick,
  49665. focus: onFocus,
  49666. mousedown: onMousedown,
  49667. mouseenter: onMouseenter,
  49668. mouseleave: onMouseleave
  49669. };
  49670. const setEvents = (el, events2, type) => {
  49671. if (el) {
  49672. Object.entries(events2).forEach(([name, handler]) => {
  49673. el[type](name, handler);
  49674. });
  49675. }
  49676. };
  49677. vue.watch(triggerRef, (triggerEl, previousTriggerEl) => {
  49678. setEvents(triggerEl, events, "addEventListener");
  49679. setEvents(previousTriggerEl, events, "removeEventListener");
  49680. if (triggerEl) {
  49681. triggerEl.setAttribute("aria-describedby", contentId.value);
  49682. }
  49683. });
  49684. vue.onBeforeUnmount(() => {
  49685. setEvents(triggerRef.value, events, "removeEventListener");
  49686. document.removeEventListener("mouseup", onMouseup);
  49687. });
  49688. return (_ctx, _cache) => {
  49689. return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), {
  49690. key: 0,
  49691. "set-ref": setTriggerRef,
  49692. "only-child": ""
  49693. }, {
  49694. default: vue.withCtx(() => [
  49695. vue.renderSlot(_ctx.$slots, "default")
  49696. ]),
  49697. _: 3
  49698. })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
  49699. key: 1,
  49700. ref_key: "triggerRef",
  49701. ref: triggerRef
  49702. }, _ctx.$attrs), [
  49703. vue.renderSlot(_ctx.$slots, "default")
  49704. ], 16));
  49705. };
  49706. }
  49707. });
  49708. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "trigger.vue"]]);
  49709. const __default__$k = vue.defineComponent({
  49710. name: "ElTooltipV2"
  49711. });
  49712. const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
  49713. ...__default__$k,
  49714. props: tooltipV2Props,
  49715. setup(__props) {
  49716. const props = __props;
  49717. const refedProps = vue.toRefs(props);
  49718. const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  49719. const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  49720. const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  49721. const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  49722. return (_ctx, _cache) => {
  49723. return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), {
  49724. default: vue.withCtx(({ open }) => [
  49725. vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), {
  49726. default: vue.withCtx(() => [
  49727. vue.renderSlot(_ctx.$slots, "trigger")
  49728. ]),
  49729. _: 3
  49730. }, 16),
  49731. vue.createVNode(vue.unref(ElTeleport$1), {
  49732. to: _ctx.to,
  49733. disabled: !_ctx.teleported
  49734. }, {
  49735. default: vue.withCtx(() => [
  49736. _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), {
  49737. default: vue.withCtx(() => [
  49738. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  49739. arrow: vue.withCtx(({ style, side }) => [
  49740. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  49741. style,
  49742. side
  49743. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  49744. ]),
  49745. default: vue.withCtx(() => [
  49746. vue.renderSlot(_ctx.$slots, "default")
  49747. ]),
  49748. _: 3
  49749. }, 16)) : vue.createCommentVNode("v-if", true)
  49750. ]),
  49751. _: 2
  49752. }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  49753. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  49754. arrow: vue.withCtx(({ style, side }) => [
  49755. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  49756. style,
  49757. side
  49758. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  49759. ]),
  49760. default: vue.withCtx(() => [
  49761. vue.renderSlot(_ctx.$slots, "default")
  49762. ]),
  49763. _: 3
  49764. }, 16)) : vue.createCommentVNode("v-if", true)
  49765. ], 64))
  49766. ]),
  49767. _: 2
  49768. }, 1032, ["to", "disabled"])
  49769. ]),
  49770. _: 3
  49771. }, 16);
  49772. };
  49773. }
  49774. });
  49775. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tooltip.vue"]]);
  49776. const ElTooltipV2 = withInstall(TooltipV2);
  49777. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  49778. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  49779. const transferProps = buildProps({
  49780. data: {
  49781. type: definePropType(Array),
  49782. default: () => []
  49783. },
  49784. titles: {
  49785. type: definePropType(Array),
  49786. default: () => []
  49787. },
  49788. buttonTexts: {
  49789. type: definePropType(Array),
  49790. default: () => []
  49791. },
  49792. filterPlaceholder: String,
  49793. filterMethod: {
  49794. type: definePropType(Function)
  49795. },
  49796. leftDefaultChecked: {
  49797. type: definePropType(Array),
  49798. default: () => []
  49799. },
  49800. rightDefaultChecked: {
  49801. type: definePropType(Array),
  49802. default: () => []
  49803. },
  49804. renderContent: {
  49805. type: definePropType(Function)
  49806. },
  49807. modelValue: {
  49808. type: definePropType(Array),
  49809. default: () => []
  49810. },
  49811. format: {
  49812. type: definePropType(Object),
  49813. default: () => ({})
  49814. },
  49815. filterable: Boolean,
  49816. props: {
  49817. type: definePropType(Object),
  49818. default: () => mutable({
  49819. label: "label",
  49820. key: "key",
  49821. disabled: "disabled"
  49822. })
  49823. },
  49824. targetOrder: {
  49825. type: String,
  49826. values: ["original", "push", "unshift"],
  49827. default: "original"
  49828. },
  49829. validateEvent: {
  49830. type: Boolean,
  49831. default: true
  49832. }
  49833. });
  49834. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  49835. const transferEmits = {
  49836. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  49837. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  49838. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  49839. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  49840. };
  49841. const CHECKED_CHANGE_EVENT = "checked-change";
  49842. const transferPanelProps = buildProps({
  49843. data: transferProps.data,
  49844. optionRender: {
  49845. type: definePropType(Function)
  49846. },
  49847. placeholder: String,
  49848. title: String,
  49849. filterable: Boolean,
  49850. format: transferProps.format,
  49851. filterMethod: transferProps.filterMethod,
  49852. defaultChecked: transferProps.leftDefaultChecked,
  49853. props: transferProps.props
  49854. });
  49855. const transferPanelEmits = {
  49856. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  49857. };
  49858. const usePropsAlias = (props) => {
  49859. const initProps = {
  49860. label: "label",
  49861. key: "key",
  49862. disabled: "disabled"
  49863. };
  49864. return vue.computed(() => ({
  49865. ...initProps,
  49866. ...props.props
  49867. }));
  49868. };
  49869. const useCheck$1 = (props, panelState, emit) => {
  49870. const propsAlias = usePropsAlias(props);
  49871. const filteredData = vue.computed(() => {
  49872. return props.data.filter((item) => {
  49873. if (isFunction$1(props.filterMethod)) {
  49874. return props.filterMethod(panelState.query, item);
  49875. } else {
  49876. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  49877. return label.toLowerCase().includes(panelState.query.toLowerCase());
  49878. }
  49879. });
  49880. });
  49881. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  49882. const checkedSummary = vue.computed(() => {
  49883. const checkedLength = panelState.checked.length;
  49884. const dataLength = props.data.length;
  49885. const { noChecked, hasChecked } = props.format;
  49886. if (noChecked && hasChecked) {
  49887. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  49888. } else {
  49889. return `${checkedLength}/${dataLength}`;
  49890. }
  49891. });
  49892. const isIndeterminate = vue.computed(() => {
  49893. const checkedLength = panelState.checked.length;
  49894. return checkedLength > 0 && checkedLength < checkableData.value.length;
  49895. });
  49896. const updateAllChecked = () => {
  49897. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  49898. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  49899. };
  49900. const handleAllCheckedChange = (value) => {
  49901. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  49902. };
  49903. vue.watch(() => panelState.checked, (val, oldVal) => {
  49904. updateAllChecked();
  49905. if (panelState.checkChangeByUser) {
  49906. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  49907. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  49908. } else {
  49909. emit(CHECKED_CHANGE_EVENT, val);
  49910. panelState.checkChangeByUser = true;
  49911. }
  49912. });
  49913. vue.watch(checkableData, () => {
  49914. updateAllChecked();
  49915. });
  49916. vue.watch(() => props.data, () => {
  49917. const checked = [];
  49918. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  49919. panelState.checked.forEach((item) => {
  49920. if (filteredDataKeys.includes(item)) {
  49921. checked.push(item);
  49922. }
  49923. });
  49924. panelState.checkChangeByUser = false;
  49925. panelState.checked = checked;
  49926. });
  49927. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  49928. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  49929. return;
  49930. const checked = [];
  49931. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  49932. val.forEach((item) => {
  49933. if (checkableDataKeys.includes(item)) {
  49934. checked.push(item);
  49935. }
  49936. });
  49937. panelState.checkChangeByUser = false;
  49938. panelState.checked = checked;
  49939. }, {
  49940. immediate: true
  49941. });
  49942. return {
  49943. filteredData,
  49944. checkableData,
  49945. checkedSummary,
  49946. isIndeterminate,
  49947. updateAllChecked,
  49948. handleAllCheckedChange
  49949. };
  49950. };
  49951. const useCheckedChange = (checkedState, emit) => {
  49952. const onSourceCheckedChange = (val, movedKeys) => {
  49953. checkedState.leftChecked = val;
  49954. if (!movedKeys)
  49955. return;
  49956. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  49957. };
  49958. const onTargetCheckedChange = (val, movedKeys) => {
  49959. checkedState.rightChecked = val;
  49960. if (!movedKeys)
  49961. return;
  49962. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  49963. };
  49964. return {
  49965. onSourceCheckedChange,
  49966. onTargetCheckedChange
  49967. };
  49968. };
  49969. const useComputedData = (props) => {
  49970. const propsAlias = usePropsAlias(props);
  49971. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  49972. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  49973. const targetData = vue.computed(() => {
  49974. if (props.targetOrder === "original") {
  49975. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  49976. } else {
  49977. return props.modelValue.reduce((arr, cur) => {
  49978. const val = dataObj.value[cur];
  49979. if (val) {
  49980. arr.push(val);
  49981. }
  49982. return arr;
  49983. }, []);
  49984. }
  49985. });
  49986. return {
  49987. sourceData,
  49988. targetData
  49989. };
  49990. };
  49991. const useMove = (props, checkedState, emit) => {
  49992. const propsAlias = usePropsAlias(props);
  49993. const _emit = (value, direction, movedKeys) => {
  49994. emit(UPDATE_MODEL_EVENT, value);
  49995. emit(CHANGE_EVENT, value, direction, movedKeys);
  49996. };
  49997. const addToLeft = () => {
  49998. const currentValue = props.modelValue.slice();
  49999. checkedState.rightChecked.forEach((item) => {
  50000. const index = currentValue.indexOf(item);
  50001. if (index > -1) {
  50002. currentValue.splice(index, 1);
  50003. }
  50004. });
  50005. _emit(currentValue, "left", checkedState.rightChecked);
  50006. };
  50007. const addToRight = () => {
  50008. let currentValue = props.modelValue.slice();
  50009. const itemsToBeMoved = props.data.filter((item) => {
  50010. const itemKey = item[propsAlias.value.key];
  50011. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  50012. }).map((item) => item[propsAlias.value.key]);
  50013. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  50014. if (props.targetOrder === "original") {
  50015. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  50016. }
  50017. _emit(currentValue, "right", checkedState.leftChecked);
  50018. };
  50019. return {
  50020. addToLeft,
  50021. addToRight
  50022. };
  50023. };
  50024. const __default__$j = vue.defineComponent({
  50025. name: "ElTransferPanel"
  50026. });
  50027. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  50028. ...__default__$j,
  50029. props: transferPanelProps,
  50030. emits: transferPanelEmits,
  50031. setup(__props, { expose, emit }) {
  50032. const props = __props;
  50033. const slots = vue.useSlots();
  50034. const OptionContent = ({ option }) => option;
  50035. const { t } = useLocale();
  50036. const ns = useNamespace("transfer");
  50037. const panelState = vue.reactive({
  50038. checked: [],
  50039. allChecked: false,
  50040. query: "",
  50041. checkChangeByUser: true
  50042. });
  50043. const propsAlias = usePropsAlias(props);
  50044. const {
  50045. filteredData,
  50046. checkedSummary,
  50047. isIndeterminate,
  50048. handleAllCheckedChange
  50049. } = useCheck$1(props, panelState, emit);
  50050. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  50051. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  50052. const { checked, allChecked, query } = vue.toRefs(panelState);
  50053. expose({
  50054. query
  50055. });
  50056. return (_ctx, _cache) => {
  50057. return vue.openBlock(), vue.createElementBlock("div", {
  50058. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  50059. }, [
  50060. vue.createElementVNode("p", {
  50061. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  50062. }, [
  50063. vue.createVNode(vue.unref(ElCheckbox), {
  50064. modelValue: vue.unref(allChecked),
  50065. "onUpdate:modelValue": ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null,
  50066. indeterminate: vue.unref(isIndeterminate),
  50067. "validate-event": false,
  50068. onChange: vue.unref(handleAllCheckedChange)
  50069. }, {
  50070. default: vue.withCtx(() => [
  50071. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  50072. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  50073. ]),
  50074. _: 1
  50075. }, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "onChange"])
  50076. ], 2),
  50077. vue.createElementVNode("div", {
  50078. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  50079. }, [
  50080. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  50081. key: 0,
  50082. modelValue: vue.unref(query),
  50083. "onUpdate:modelValue": ($event) => vue.isRef(query) ? query.value = $event : null,
  50084. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  50085. size: "default",
  50086. placeholder: _ctx.placeholder,
  50087. "prefix-icon": vue.unref(search_default),
  50088. clearable: "",
  50089. "validate-event": false
  50090. }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  50091. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  50092. modelValue: vue.unref(checked),
  50093. "onUpdate:modelValue": ($event) => vue.isRef(checked) ? checked.value = $event : null,
  50094. "validate-event": false,
  50095. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  50096. }, {
  50097. default: vue.withCtx(() => [
  50098. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  50099. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  50100. key: item[vue.unref(propsAlias).key],
  50101. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  50102. value: item[vue.unref(propsAlias).key],
  50103. disabled: item[vue.unref(propsAlias).disabled],
  50104. "validate-event": false
  50105. }, {
  50106. default: vue.withCtx(() => {
  50107. var _a;
  50108. return [
  50109. vue.createVNode(OptionContent, {
  50110. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  50111. }, null, 8, ["option"])
  50112. ];
  50113. }),
  50114. _: 2
  50115. }, 1032, ["class", "value", "disabled"]);
  50116. }), 128))
  50117. ]),
  50118. _: 1
  50119. }, 8, ["modelValue", "onUpdate:modelValue", "class"]), [
  50120. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  50121. ]),
  50122. vue.withDirectives(vue.createElementVNode("p", {
  50123. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  50124. }, vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 3), [
  50125. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  50126. ])
  50127. ], 2),
  50128. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  50129. key: 0,
  50130. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  50131. }, [
  50132. vue.renderSlot(_ctx.$slots, "default")
  50133. ], 2)) : vue.createCommentVNode("v-if", true)
  50134. ], 2);
  50135. };
  50136. }
  50137. });
  50138. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "transfer-panel.vue"]]);
  50139. const __default__$i = vue.defineComponent({
  50140. name: "ElTransfer"
  50141. });
  50142. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  50143. ...__default__$i,
  50144. props: transferProps,
  50145. emits: transferEmits,
  50146. setup(__props, { expose, emit }) {
  50147. const props = __props;
  50148. const slots = vue.useSlots();
  50149. const { t } = useLocale();
  50150. const ns = useNamespace("transfer");
  50151. const { formItem } = useFormItem();
  50152. const checkedState = vue.reactive({
  50153. leftChecked: [],
  50154. rightChecked: []
  50155. });
  50156. const propsAlias = usePropsAlias(props);
  50157. const { sourceData, targetData } = useComputedData(props);
  50158. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  50159. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  50160. const leftPanel = vue.ref();
  50161. const rightPanel = vue.ref();
  50162. const clearQuery = (which) => {
  50163. switch (which) {
  50164. case "left":
  50165. leftPanel.value.query = "";
  50166. break;
  50167. case "right":
  50168. rightPanel.value.query = "";
  50169. break;
  50170. }
  50171. };
  50172. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  50173. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  50174. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  50175. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  50176. vue.watch(() => props.modelValue, () => {
  50177. var _a;
  50178. if (props.validateEvent) {
  50179. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  50180. }
  50181. });
  50182. const optionRender = vue.computed(() => (option) => {
  50183. if (props.renderContent)
  50184. return props.renderContent(vue.h, option);
  50185. if (slots.default)
  50186. return slots.default({ option });
  50187. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  50188. });
  50189. expose({
  50190. clearQuery,
  50191. leftPanel,
  50192. rightPanel
  50193. });
  50194. return (_ctx, _cache) => {
  50195. return vue.openBlock(), vue.createElementBlock("div", {
  50196. class: vue.normalizeClass(vue.unref(ns).b())
  50197. }, [
  50198. vue.createVNode(TransferPanel, {
  50199. ref_key: "leftPanel",
  50200. ref: leftPanel,
  50201. data: vue.unref(sourceData),
  50202. "option-render": vue.unref(optionRender),
  50203. placeholder: vue.unref(panelFilterPlaceholder),
  50204. title: vue.unref(leftPanelTitle),
  50205. filterable: _ctx.filterable,
  50206. format: _ctx.format,
  50207. "filter-method": _ctx.filterMethod,
  50208. "default-checked": _ctx.leftDefaultChecked,
  50209. props: props.props,
  50210. onCheckedChange: vue.unref(onSourceCheckedChange)
  50211. }, {
  50212. default: vue.withCtx(() => [
  50213. vue.renderSlot(_ctx.$slots, "left-footer")
  50214. ]),
  50215. _: 3
  50216. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  50217. vue.createElementVNode("div", {
  50218. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  50219. }, [
  50220. vue.createVNode(vue.unref(ElButton), {
  50221. type: "primary",
  50222. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  50223. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  50224. onClick: vue.unref(addToLeft)
  50225. }, {
  50226. default: vue.withCtx(() => [
  50227. vue.createVNode(vue.unref(ElIcon), null, {
  50228. default: vue.withCtx(() => [
  50229. vue.createVNode(vue.unref(arrow_left_default))
  50230. ]),
  50231. _: 1
  50232. }),
  50233. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  50234. ]),
  50235. _: 1
  50236. }, 8, ["class", "disabled", "onClick"]),
  50237. vue.createVNode(vue.unref(ElButton), {
  50238. type: "primary",
  50239. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  50240. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  50241. onClick: vue.unref(addToRight)
  50242. }, {
  50243. default: vue.withCtx(() => [
  50244. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  50245. vue.createVNode(vue.unref(ElIcon), null, {
  50246. default: vue.withCtx(() => [
  50247. vue.createVNode(vue.unref(arrow_right_default))
  50248. ]),
  50249. _: 1
  50250. })
  50251. ]),
  50252. _: 1
  50253. }, 8, ["class", "disabled", "onClick"])
  50254. ], 2),
  50255. vue.createVNode(TransferPanel, {
  50256. ref_key: "rightPanel",
  50257. ref: rightPanel,
  50258. data: vue.unref(targetData),
  50259. "option-render": vue.unref(optionRender),
  50260. placeholder: vue.unref(panelFilterPlaceholder),
  50261. filterable: _ctx.filterable,
  50262. format: _ctx.format,
  50263. "filter-method": _ctx.filterMethod,
  50264. title: vue.unref(rightPanelTitle),
  50265. "default-checked": _ctx.rightDefaultChecked,
  50266. props: props.props,
  50267. onCheckedChange: vue.unref(onTargetCheckedChange)
  50268. }, {
  50269. default: vue.withCtx(() => [
  50270. vue.renderSlot(_ctx.$slots, "right-footer")
  50271. ]),
  50272. _: 3
  50273. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  50274. ], 2);
  50275. };
  50276. }
  50277. });
  50278. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "transfer.vue"]]);
  50279. const ElTransfer = withInstall(Transfer);
  50280. const NODE_KEY = "$treeNodeId";
  50281. const markNodeData = function(node, data) {
  50282. if (!data || data[NODE_KEY])
  50283. return;
  50284. Object.defineProperty(data, NODE_KEY, {
  50285. value: node.id,
  50286. enumerable: false,
  50287. configurable: false,
  50288. writable: false
  50289. });
  50290. };
  50291. const getNodeKey = function(key, data) {
  50292. if (!key)
  50293. return data[NODE_KEY];
  50294. return data[key];
  50295. };
  50296. const handleCurrentChange = (store, emit, setCurrent) => {
  50297. const preCurrentNode = store.value.currentNode;
  50298. setCurrent();
  50299. const currentNode = store.value.currentNode;
  50300. if (preCurrentNode === currentNode)
  50301. return;
  50302. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  50303. };
  50304. const getChildState = (node) => {
  50305. let all = true;
  50306. let none = true;
  50307. let allWithoutDisable = true;
  50308. for (let i = 0, j = node.length; i < j; i++) {
  50309. const n = node[i];
  50310. if (n.checked !== true || n.indeterminate) {
  50311. all = false;
  50312. if (!n.disabled) {
  50313. allWithoutDisable = false;
  50314. }
  50315. }
  50316. if (n.checked !== false || n.indeterminate) {
  50317. none = false;
  50318. }
  50319. }
  50320. return { all, none, allWithoutDisable, half: !all && !none };
  50321. };
  50322. const reInitChecked = function(node) {
  50323. if (node.childNodes.length === 0 || node.loading)
  50324. return;
  50325. const { all, none, half } = getChildState(node.childNodes);
  50326. if (all) {
  50327. node.checked = true;
  50328. node.indeterminate = false;
  50329. } else if (half) {
  50330. node.checked = false;
  50331. node.indeterminate = true;
  50332. } else if (none) {
  50333. node.checked = false;
  50334. node.indeterminate = false;
  50335. }
  50336. const parent = node.parent;
  50337. if (!parent || parent.level === 0)
  50338. return;
  50339. if (!node.store.checkStrictly) {
  50340. reInitChecked(parent);
  50341. }
  50342. };
  50343. const getPropertyFromData = function(node, prop) {
  50344. const props = node.store.props;
  50345. const data = node.data || {};
  50346. const config = props[prop];
  50347. if (typeof config === "function") {
  50348. return config(data, node);
  50349. } else if (typeof config === "string") {
  50350. return data[config];
  50351. } else if (typeof config === "undefined") {
  50352. const dataProp = data[prop];
  50353. return dataProp === void 0 ? "" : dataProp;
  50354. }
  50355. };
  50356. let nodeIdSeed = 0;
  50357. class Node {
  50358. constructor(options) {
  50359. this.id = nodeIdSeed++;
  50360. this.text = null;
  50361. this.checked = false;
  50362. this.indeterminate = false;
  50363. this.data = null;
  50364. this.expanded = false;
  50365. this.parent = null;
  50366. this.visible = true;
  50367. this.isCurrent = false;
  50368. this.canFocus = false;
  50369. for (const name in options) {
  50370. if (hasOwn(options, name)) {
  50371. this[name] = options[name];
  50372. }
  50373. }
  50374. this.level = 0;
  50375. this.loaded = false;
  50376. this.childNodes = [];
  50377. this.loading = false;
  50378. if (this.parent) {
  50379. this.level = this.parent.level + 1;
  50380. }
  50381. }
  50382. initialize() {
  50383. const store = this.store;
  50384. if (!store) {
  50385. throw new Error("[Node]store is required!");
  50386. }
  50387. store.registerNode(this);
  50388. const props = store.props;
  50389. if (props && typeof props.isLeaf !== "undefined") {
  50390. const isLeaf = getPropertyFromData(this, "isLeaf");
  50391. if (typeof isLeaf === "boolean") {
  50392. this.isLeafByUser = isLeaf;
  50393. }
  50394. }
  50395. if (store.lazy !== true && this.data) {
  50396. this.setData(this.data);
  50397. if (store.defaultExpandAll) {
  50398. this.expanded = true;
  50399. this.canFocus = true;
  50400. }
  50401. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
  50402. this.expand();
  50403. }
  50404. if (!Array.isArray(this.data)) {
  50405. markNodeData(this, this.data);
  50406. }
  50407. if (!this.data)
  50408. return;
  50409. const defaultExpandedKeys = store.defaultExpandedKeys;
  50410. const key = store.key;
  50411. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  50412. this.expand(null, store.autoExpandParent);
  50413. }
  50414. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  50415. store.currentNode = this;
  50416. store.currentNode.isCurrent = true;
  50417. }
  50418. if (store.lazy) {
  50419. store._initDefaultCheckedNode(this);
  50420. }
  50421. this.updateLeafState();
  50422. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  50423. this.canFocus = true;
  50424. }
  50425. setData(data) {
  50426. if (!Array.isArray(data)) {
  50427. markNodeData(this, data);
  50428. }
  50429. this.data = data;
  50430. this.childNodes = [];
  50431. let children;
  50432. if (this.level === 0 && Array.isArray(this.data)) {
  50433. children = this.data;
  50434. } else {
  50435. children = getPropertyFromData(this, "children") || [];
  50436. }
  50437. for (let i = 0, j = children.length; i < j; i++) {
  50438. this.insertChild({ data: children[i] });
  50439. }
  50440. }
  50441. get label() {
  50442. return getPropertyFromData(this, "label");
  50443. }
  50444. get key() {
  50445. const nodeKey = this.store.key;
  50446. if (this.data)
  50447. return this.data[nodeKey];
  50448. return null;
  50449. }
  50450. get disabled() {
  50451. return getPropertyFromData(this, "disabled");
  50452. }
  50453. get nextSibling() {
  50454. const parent = this.parent;
  50455. if (parent) {
  50456. const index = parent.childNodes.indexOf(this);
  50457. if (index > -1) {
  50458. return parent.childNodes[index + 1];
  50459. }
  50460. }
  50461. return null;
  50462. }
  50463. get previousSibling() {
  50464. const parent = this.parent;
  50465. if (parent) {
  50466. const index = parent.childNodes.indexOf(this);
  50467. if (index > -1) {
  50468. return index > 0 ? parent.childNodes[index - 1] : null;
  50469. }
  50470. }
  50471. return null;
  50472. }
  50473. contains(target, deep = true) {
  50474. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  50475. }
  50476. remove() {
  50477. const parent = this.parent;
  50478. if (parent) {
  50479. parent.removeChild(this);
  50480. }
  50481. }
  50482. insertChild(child, index, batch) {
  50483. if (!child)
  50484. throw new Error("InsertChild error: child is required.");
  50485. if (!(child instanceof Node)) {
  50486. if (!batch) {
  50487. const children = this.getChildren(true);
  50488. if (!children.includes(child.data)) {
  50489. if (typeof index === "undefined" || index < 0) {
  50490. children.push(child.data);
  50491. } else {
  50492. children.splice(index, 0, child.data);
  50493. }
  50494. }
  50495. }
  50496. Object.assign(child, {
  50497. parent: this,
  50498. store: this.store
  50499. });
  50500. child = vue.reactive(new Node(child));
  50501. if (child instanceof Node) {
  50502. child.initialize();
  50503. }
  50504. }
  50505. child.level = this.level + 1;
  50506. if (typeof index === "undefined" || index < 0) {
  50507. this.childNodes.push(child);
  50508. } else {
  50509. this.childNodes.splice(index, 0, child);
  50510. }
  50511. this.updateLeafState();
  50512. }
  50513. insertBefore(child, ref) {
  50514. let index;
  50515. if (ref) {
  50516. index = this.childNodes.indexOf(ref);
  50517. }
  50518. this.insertChild(child, index);
  50519. }
  50520. insertAfter(child, ref) {
  50521. let index;
  50522. if (ref) {
  50523. index = this.childNodes.indexOf(ref);
  50524. if (index !== -1)
  50525. index += 1;
  50526. }
  50527. this.insertChild(child, index);
  50528. }
  50529. removeChild(child) {
  50530. const children = this.getChildren() || [];
  50531. const dataIndex = children.indexOf(child.data);
  50532. if (dataIndex > -1) {
  50533. children.splice(dataIndex, 1);
  50534. }
  50535. const index = this.childNodes.indexOf(child);
  50536. if (index > -1) {
  50537. this.store && this.store.deregisterNode(child);
  50538. child.parent = null;
  50539. this.childNodes.splice(index, 1);
  50540. }
  50541. this.updateLeafState();
  50542. }
  50543. removeChildByData(data) {
  50544. let targetNode = null;
  50545. for (let i = 0; i < this.childNodes.length; i++) {
  50546. if (this.childNodes[i].data === data) {
  50547. targetNode = this.childNodes[i];
  50548. break;
  50549. }
  50550. }
  50551. if (targetNode) {
  50552. this.removeChild(targetNode);
  50553. }
  50554. }
  50555. expand(callback, expandParent) {
  50556. const done = () => {
  50557. if (expandParent) {
  50558. let parent = this.parent;
  50559. while (parent.level > 0) {
  50560. parent.expanded = true;
  50561. parent = parent.parent;
  50562. }
  50563. }
  50564. this.expanded = true;
  50565. if (callback)
  50566. callback();
  50567. this.childNodes.forEach((item) => {
  50568. item.canFocus = true;
  50569. });
  50570. };
  50571. if (this.shouldLoadData()) {
  50572. this.loadData((data) => {
  50573. if (Array.isArray(data)) {
  50574. if (this.checked) {
  50575. this.setChecked(true, true);
  50576. } else if (!this.store.checkStrictly) {
  50577. reInitChecked(this);
  50578. }
  50579. done();
  50580. }
  50581. });
  50582. } else {
  50583. done();
  50584. }
  50585. }
  50586. doCreateChildren(array, defaultProps = {}) {
  50587. array.forEach((item) => {
  50588. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  50589. });
  50590. }
  50591. collapse() {
  50592. this.expanded = false;
  50593. this.childNodes.forEach((item) => {
  50594. item.canFocus = false;
  50595. });
  50596. }
  50597. shouldLoadData() {
  50598. return this.store.lazy === true && this.store.load && !this.loaded;
  50599. }
  50600. updateLeafState() {
  50601. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  50602. this.isLeaf = this.isLeafByUser;
  50603. return;
  50604. }
  50605. const childNodes = this.childNodes;
  50606. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  50607. this.isLeaf = !childNodes || childNodes.length === 0;
  50608. return;
  50609. }
  50610. this.isLeaf = false;
  50611. }
  50612. setChecked(value, deep, recursion, passValue) {
  50613. this.indeterminate = value === "half";
  50614. this.checked = value === true;
  50615. if (this.store.checkStrictly)
  50616. return;
  50617. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  50618. const { all, allWithoutDisable } = getChildState(this.childNodes);
  50619. if (!this.isLeaf && !all && allWithoutDisable) {
  50620. this.checked = false;
  50621. value = false;
  50622. }
  50623. const handleDescendants = () => {
  50624. if (deep) {
  50625. const childNodes = this.childNodes;
  50626. for (let i = 0, j = childNodes.length; i < j; i++) {
  50627. const child = childNodes[i];
  50628. passValue = passValue || value !== false;
  50629. const isCheck = child.disabled ? child.checked : passValue;
  50630. child.setChecked(isCheck, deep, true, passValue);
  50631. }
  50632. const { half, all: all2 } = getChildState(childNodes);
  50633. if (!all2) {
  50634. this.checked = all2;
  50635. this.indeterminate = half;
  50636. }
  50637. }
  50638. };
  50639. if (this.shouldLoadData()) {
  50640. this.loadData(() => {
  50641. handleDescendants();
  50642. reInitChecked(this);
  50643. }, {
  50644. checked: value !== false
  50645. });
  50646. return;
  50647. } else {
  50648. handleDescendants();
  50649. }
  50650. }
  50651. const parent = this.parent;
  50652. if (!parent || parent.level === 0)
  50653. return;
  50654. if (!recursion) {
  50655. reInitChecked(parent);
  50656. }
  50657. }
  50658. getChildren(forceInit = false) {
  50659. if (this.level === 0)
  50660. return this.data;
  50661. const data = this.data;
  50662. if (!data)
  50663. return null;
  50664. const props = this.store.props;
  50665. let children = "children";
  50666. if (props) {
  50667. children = props.children || "children";
  50668. }
  50669. if (data[children] === void 0) {
  50670. data[children] = null;
  50671. }
  50672. if (forceInit && !data[children]) {
  50673. data[children] = [];
  50674. }
  50675. return data[children];
  50676. }
  50677. updateChildren() {
  50678. const newData = this.getChildren() || [];
  50679. const oldData = this.childNodes.map((node) => node.data);
  50680. const newDataMap = {};
  50681. const newNodes = [];
  50682. newData.forEach((item, index) => {
  50683. const key = item[NODE_KEY];
  50684. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  50685. if (isNodeExists) {
  50686. newDataMap[key] = { index, data: item };
  50687. } else {
  50688. newNodes.push({ index, data: item });
  50689. }
  50690. });
  50691. if (!this.store.lazy) {
  50692. oldData.forEach((item) => {
  50693. if (!newDataMap[item[NODE_KEY]])
  50694. this.removeChildByData(item);
  50695. });
  50696. }
  50697. newNodes.forEach(({ index, data }) => {
  50698. this.insertChild({ data }, index);
  50699. });
  50700. this.updateLeafState();
  50701. }
  50702. loadData(callback, defaultProps = {}) {
  50703. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  50704. this.loading = true;
  50705. const resolve = (children) => {
  50706. this.childNodes = [];
  50707. this.doCreateChildren(children, defaultProps);
  50708. this.loaded = true;
  50709. this.loading = false;
  50710. this.updateLeafState();
  50711. if (callback) {
  50712. callback.call(this, children);
  50713. }
  50714. };
  50715. const reject = () => {
  50716. this.loading = false;
  50717. };
  50718. this.store.load(this, resolve, reject);
  50719. } else {
  50720. if (callback) {
  50721. callback.call(this);
  50722. }
  50723. }
  50724. }
  50725. eachNode(callback) {
  50726. const arr = [this];
  50727. while (arr.length) {
  50728. const node = arr.shift();
  50729. arr.unshift(...node.childNodes);
  50730. callback(node);
  50731. }
  50732. }
  50733. reInitChecked() {
  50734. if (this.store.checkStrictly)
  50735. return;
  50736. reInitChecked(this);
  50737. }
  50738. }
  50739. var Node$1 = Node;
  50740. class TreeStore {
  50741. constructor(options) {
  50742. this.currentNode = null;
  50743. this.currentNodeKey = null;
  50744. for (const option in options) {
  50745. if (hasOwn(options, option)) {
  50746. this[option] = options[option];
  50747. }
  50748. }
  50749. this.nodesMap = {};
  50750. }
  50751. initialize() {
  50752. this.root = new Node$1({
  50753. data: this.data,
  50754. store: this
  50755. });
  50756. this.root.initialize();
  50757. if (this.lazy && this.load) {
  50758. const loadFn = this.load;
  50759. loadFn(this.root, (data) => {
  50760. this.root.doCreateChildren(data);
  50761. this._initDefaultCheckedNodes();
  50762. });
  50763. } else {
  50764. this._initDefaultCheckedNodes();
  50765. }
  50766. }
  50767. filter(value) {
  50768. const filterNodeMethod = this.filterNodeMethod;
  50769. const lazy = this.lazy;
  50770. const traverse = function(node) {
  50771. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  50772. childNodes.forEach((child) => {
  50773. child.visible = filterNodeMethod.call(child, value, child.data, child);
  50774. traverse(child);
  50775. });
  50776. if (!node.visible && childNodes.length) {
  50777. let allHidden = true;
  50778. allHidden = !childNodes.some((child) => child.visible);
  50779. if (node.root) {
  50780. node.root.visible = allHidden === false;
  50781. } else {
  50782. node.visible = allHidden === false;
  50783. }
  50784. }
  50785. if (!value)
  50786. return;
  50787. if (node.visible && !node.isLeaf) {
  50788. if (!lazy || node.loaded) {
  50789. node.expand();
  50790. }
  50791. }
  50792. };
  50793. traverse(this);
  50794. }
  50795. setData(newVal) {
  50796. const instanceChanged = newVal !== this.root.data;
  50797. if (instanceChanged) {
  50798. this.nodesMap = {};
  50799. this.root.setData(newVal);
  50800. this._initDefaultCheckedNodes();
  50801. } else {
  50802. this.root.updateChildren();
  50803. }
  50804. }
  50805. getNode(data) {
  50806. if (data instanceof Node$1)
  50807. return data;
  50808. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  50809. return this.nodesMap[key] || null;
  50810. }
  50811. insertBefore(data, refData) {
  50812. const refNode = this.getNode(refData);
  50813. refNode.parent.insertBefore({ data }, refNode);
  50814. }
  50815. insertAfter(data, refData) {
  50816. const refNode = this.getNode(refData);
  50817. refNode.parent.insertAfter({ data }, refNode);
  50818. }
  50819. remove(data) {
  50820. const node = this.getNode(data);
  50821. if (node && node.parent) {
  50822. if (node === this.currentNode) {
  50823. this.currentNode = null;
  50824. }
  50825. node.parent.removeChild(node);
  50826. }
  50827. }
  50828. append(data, parentData) {
  50829. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  50830. if (parentNode) {
  50831. parentNode.insertChild({ data });
  50832. }
  50833. }
  50834. _initDefaultCheckedNodes() {
  50835. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  50836. const nodesMap = this.nodesMap;
  50837. defaultCheckedKeys.forEach((checkedKey) => {
  50838. const node = nodesMap[checkedKey];
  50839. if (node) {
  50840. node.setChecked(true, !this.checkStrictly);
  50841. }
  50842. });
  50843. }
  50844. _initDefaultCheckedNode(node) {
  50845. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  50846. if (defaultCheckedKeys.includes(node.key)) {
  50847. node.setChecked(true, !this.checkStrictly);
  50848. }
  50849. }
  50850. setDefaultCheckedKey(newVal) {
  50851. if (newVal !== this.defaultCheckedKeys) {
  50852. this.defaultCheckedKeys = newVal;
  50853. this._initDefaultCheckedNodes();
  50854. }
  50855. }
  50856. registerNode(node) {
  50857. const key = this.key;
  50858. if (!node || !node.data)
  50859. return;
  50860. if (!key) {
  50861. this.nodesMap[node.id] = node;
  50862. } else {
  50863. const nodeKey = node.key;
  50864. if (nodeKey !== void 0)
  50865. this.nodesMap[node.key] = node;
  50866. }
  50867. }
  50868. deregisterNode(node) {
  50869. const key = this.key;
  50870. if (!key || !node || !node.data)
  50871. return;
  50872. node.childNodes.forEach((child) => {
  50873. this.deregisterNode(child);
  50874. });
  50875. delete this.nodesMap[node.key];
  50876. }
  50877. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  50878. const checkedNodes = [];
  50879. const traverse = function(node) {
  50880. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  50881. childNodes.forEach((child) => {
  50882. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  50883. checkedNodes.push(child.data);
  50884. }
  50885. traverse(child);
  50886. });
  50887. };
  50888. traverse(this);
  50889. return checkedNodes;
  50890. }
  50891. getCheckedKeys(leafOnly = false) {
  50892. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  50893. }
  50894. getHalfCheckedNodes() {
  50895. const nodes = [];
  50896. const traverse = function(node) {
  50897. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  50898. childNodes.forEach((child) => {
  50899. if (child.indeterminate) {
  50900. nodes.push(child.data);
  50901. }
  50902. traverse(child);
  50903. });
  50904. };
  50905. traverse(this);
  50906. return nodes;
  50907. }
  50908. getHalfCheckedKeys() {
  50909. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  50910. }
  50911. _getAllNodes() {
  50912. const allNodes = [];
  50913. const nodesMap = this.nodesMap;
  50914. for (const nodeKey in nodesMap) {
  50915. if (hasOwn(nodesMap, nodeKey)) {
  50916. allNodes.push(nodesMap[nodeKey]);
  50917. }
  50918. }
  50919. return allNodes;
  50920. }
  50921. updateChildren(key, data) {
  50922. const node = this.nodesMap[key];
  50923. if (!node)
  50924. return;
  50925. const childNodes = node.childNodes;
  50926. for (let i = childNodes.length - 1; i >= 0; i--) {
  50927. const child = childNodes[i];
  50928. this.remove(child.data);
  50929. }
  50930. for (let i = 0, j = data.length; i < j; i++) {
  50931. const child = data[i];
  50932. this.append(child, node.data);
  50933. }
  50934. }
  50935. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  50936. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  50937. const cache = /* @__PURE__ */ Object.create(null);
  50938. const keys = Object.keys(checkedKeys);
  50939. allNodes.forEach((node) => node.setChecked(false, false));
  50940. const cacheCheckedChild = (node) => {
  50941. node.childNodes.forEach((child) => {
  50942. var _a;
  50943. cache[child.data[key]] = true;
  50944. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  50945. cacheCheckedChild(child);
  50946. }
  50947. });
  50948. };
  50949. for (let i = 0, j = allNodes.length; i < j; i++) {
  50950. const node = allNodes[i];
  50951. const nodeKey = node.data[key].toString();
  50952. const checked = keys.includes(nodeKey);
  50953. if (!checked) {
  50954. if (node.checked && !cache[nodeKey]) {
  50955. node.setChecked(false, false);
  50956. }
  50957. continue;
  50958. }
  50959. if (node.childNodes.length) {
  50960. cacheCheckedChild(node);
  50961. }
  50962. if (node.isLeaf || this.checkStrictly) {
  50963. node.setChecked(true, false);
  50964. continue;
  50965. }
  50966. node.setChecked(true, true);
  50967. if (leafOnly) {
  50968. node.setChecked(false, false);
  50969. const traverse = function(node2) {
  50970. const childNodes = node2.childNodes;
  50971. childNodes.forEach((child) => {
  50972. if (!child.isLeaf) {
  50973. child.setChecked(false, false);
  50974. }
  50975. traverse(child);
  50976. });
  50977. };
  50978. traverse(node);
  50979. }
  50980. }
  50981. }
  50982. setCheckedNodes(array, leafOnly = false) {
  50983. const key = this.key;
  50984. const checkedKeys = {};
  50985. array.forEach((item) => {
  50986. checkedKeys[(item || {})[key]] = true;
  50987. });
  50988. this._setCheckedKeys(key, leafOnly, checkedKeys);
  50989. }
  50990. setCheckedKeys(keys, leafOnly = false) {
  50991. this.defaultCheckedKeys = keys;
  50992. const key = this.key;
  50993. const checkedKeys = {};
  50994. keys.forEach((key2) => {
  50995. checkedKeys[key2] = true;
  50996. });
  50997. this._setCheckedKeys(key, leafOnly, checkedKeys);
  50998. }
  50999. setDefaultExpandedKeys(keys) {
  51000. keys = keys || [];
  51001. this.defaultExpandedKeys = keys;
  51002. keys.forEach((key) => {
  51003. const node = this.getNode(key);
  51004. if (node)
  51005. node.expand(null, this.autoExpandParent);
  51006. });
  51007. }
  51008. setChecked(data, checked, deep) {
  51009. const node = this.getNode(data);
  51010. if (node) {
  51011. node.setChecked(!!checked, deep);
  51012. }
  51013. }
  51014. getCurrentNode() {
  51015. return this.currentNode;
  51016. }
  51017. setCurrentNode(currentNode) {
  51018. const prevCurrentNode = this.currentNode;
  51019. if (prevCurrentNode) {
  51020. prevCurrentNode.isCurrent = false;
  51021. }
  51022. this.currentNode = currentNode;
  51023. this.currentNode.isCurrent = true;
  51024. }
  51025. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  51026. const key = node[this.key];
  51027. const currNode = this.nodesMap[key];
  51028. this.setCurrentNode(currNode);
  51029. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  51030. this.currentNode.parent.expand(null, true);
  51031. }
  51032. }
  51033. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  51034. if (key === null || key === void 0) {
  51035. this.currentNode && (this.currentNode.isCurrent = false);
  51036. this.currentNode = null;
  51037. return;
  51038. }
  51039. const node = this.getNode(key);
  51040. if (node) {
  51041. this.setCurrentNode(node);
  51042. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  51043. this.currentNode.parent.expand(null, true);
  51044. }
  51045. }
  51046. }
  51047. }
  51048. const _sfc_main$m = vue.defineComponent({
  51049. name: "ElTreeNodeContent",
  51050. props: {
  51051. node: {
  51052. type: Object,
  51053. required: true
  51054. },
  51055. renderContent: Function
  51056. },
  51057. setup(props) {
  51058. const ns = useNamespace("tree");
  51059. const nodeInstance = vue.inject("NodeInstance");
  51060. const tree = vue.inject("RootTree");
  51061. return () => {
  51062. const node = props.node;
  51063. const { data, store } = node;
  51064. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : vue.renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  51065. vue.h("span", { class: ns.be("node", "label") }, [node.label])
  51066. ]);
  51067. };
  51068. }
  51069. });
  51070. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "tree-node-content.vue"]]);
  51071. function useNodeExpandEventBroadcast(props) {
  51072. const parentNodeMap = vue.inject("TreeNodeMap", null);
  51073. const currentNodeMap = {
  51074. treeNodeExpand: (node) => {
  51075. if (props.node !== node) {
  51076. props.node.collapse();
  51077. }
  51078. },
  51079. children: []
  51080. };
  51081. if (parentNodeMap) {
  51082. parentNodeMap.children.push(currentNodeMap);
  51083. }
  51084. vue.provide("TreeNodeMap", currentNodeMap);
  51085. return {
  51086. broadcastExpanded: (node) => {
  51087. if (!props.accordion)
  51088. return;
  51089. for (const childNode of currentNodeMap.children) {
  51090. childNode.treeNodeExpand(node);
  51091. }
  51092. }
  51093. };
  51094. }
  51095. const dragEventsKey = Symbol("dragEvents");
  51096. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  51097. const ns = useNamespace("tree");
  51098. const dragState = vue.ref({
  51099. showDropIndicator: false,
  51100. draggingNode: null,
  51101. dropNode: null,
  51102. allowDrop: true,
  51103. dropType: null
  51104. });
  51105. const treeNodeDragStart = ({ event, treeNode }) => {
  51106. if (typeof props.allowDrag === "function" && !props.allowDrag(treeNode.node)) {
  51107. event.preventDefault();
  51108. return false;
  51109. }
  51110. event.dataTransfer.effectAllowed = "move";
  51111. try {
  51112. event.dataTransfer.setData("text/plain", "");
  51113. } catch (e) {
  51114. }
  51115. dragState.value.draggingNode = treeNode;
  51116. ctx.emit("node-drag-start", treeNode.node, event);
  51117. };
  51118. const treeNodeDragOver = ({ event, treeNode }) => {
  51119. const dropNode = treeNode;
  51120. const oldDropNode = dragState.value.dropNode;
  51121. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  51122. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  51123. }
  51124. const draggingNode = dragState.value.draggingNode;
  51125. if (!draggingNode || !dropNode)
  51126. return;
  51127. let dropPrev = true;
  51128. let dropInner = true;
  51129. let dropNext = true;
  51130. let userAllowDropInner = true;
  51131. if (typeof props.allowDrop === "function") {
  51132. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  51133. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  51134. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  51135. }
  51136. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  51137. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  51138. if (oldDropNode) {
  51139. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  51140. }
  51141. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  51142. }
  51143. if (dropPrev || dropInner || dropNext) {
  51144. dragState.value.dropNode = dropNode;
  51145. } else {
  51146. dragState.value.dropNode = null;
  51147. }
  51148. if (dropNode.node.nextSibling === draggingNode.node) {
  51149. dropNext = false;
  51150. }
  51151. if (dropNode.node.previousSibling === draggingNode.node) {
  51152. dropPrev = false;
  51153. }
  51154. if (dropNode.node.contains(draggingNode.node, false)) {
  51155. dropInner = false;
  51156. }
  51157. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  51158. dropPrev = false;
  51159. dropInner = false;
  51160. dropNext = false;
  51161. }
  51162. const targetPosition = dropNode.$el.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  51163. const treePosition = el$.value.getBoundingClientRect();
  51164. let dropType;
  51165. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  51166. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  51167. let indicatorTop = -9999;
  51168. const distance = event.clientY - targetPosition.top;
  51169. if (distance < targetPosition.height * prevPercent) {
  51170. dropType = "before";
  51171. } else if (distance > targetPosition.height * nextPercent) {
  51172. dropType = "after";
  51173. } else if (dropInner) {
  51174. dropType = "inner";
  51175. } else {
  51176. dropType = "none";
  51177. }
  51178. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  51179. const dropIndicator = dropIndicator$.value;
  51180. if (dropType === "before") {
  51181. indicatorTop = iconPosition.top - treePosition.top;
  51182. } else if (dropType === "after") {
  51183. indicatorTop = iconPosition.bottom - treePosition.top;
  51184. }
  51185. dropIndicator.style.top = `${indicatorTop}px`;
  51186. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  51187. if (dropType === "inner") {
  51188. addClass(dropNode.$el, ns.is("drop-inner"));
  51189. } else {
  51190. removeClass(dropNode.$el, ns.is("drop-inner"));
  51191. }
  51192. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  51193. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  51194. dragState.value.dropType = dropType;
  51195. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  51196. };
  51197. const treeNodeDragEnd = (event) => {
  51198. const { draggingNode, dropType, dropNode } = dragState.value;
  51199. event.preventDefault();
  51200. if (event.dataTransfer) {
  51201. event.dataTransfer.dropEffect = "move";
  51202. }
  51203. if (draggingNode && dropNode) {
  51204. const draggingNodeCopy = { data: draggingNode.node.data };
  51205. if (dropType !== "none") {
  51206. draggingNode.node.remove();
  51207. }
  51208. if (dropType === "before") {
  51209. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  51210. } else if (dropType === "after") {
  51211. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  51212. } else if (dropType === "inner") {
  51213. dropNode.node.insertChild(draggingNodeCopy);
  51214. }
  51215. if (dropType !== "none") {
  51216. store.value.registerNode(draggingNodeCopy);
  51217. if (store.value.key) {
  51218. draggingNode.node.eachNode((node) => {
  51219. var _a;
  51220. (_a = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a.setChecked(node.checked, !store.value.checkStrictly);
  51221. });
  51222. }
  51223. }
  51224. removeClass(dropNode.$el, ns.is("drop-inner"));
  51225. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  51226. if (dropType !== "none") {
  51227. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  51228. }
  51229. }
  51230. if (draggingNode && !dropNode) {
  51231. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  51232. }
  51233. dragState.value.showDropIndicator = false;
  51234. dragState.value.draggingNode = null;
  51235. dragState.value.dropNode = null;
  51236. dragState.value.allowDrop = true;
  51237. };
  51238. vue.provide(dragEventsKey, {
  51239. treeNodeDragStart,
  51240. treeNodeDragOver,
  51241. treeNodeDragEnd
  51242. });
  51243. return {
  51244. dragState
  51245. };
  51246. }
  51247. const _sfc_main$l = vue.defineComponent({
  51248. name: "ElTreeNode",
  51249. components: {
  51250. ElCollapseTransition,
  51251. ElCheckbox,
  51252. NodeContent,
  51253. ElIcon,
  51254. Loading: loading_default
  51255. },
  51256. props: {
  51257. node: {
  51258. type: Node$1,
  51259. default: () => ({})
  51260. },
  51261. props: {
  51262. type: Object,
  51263. default: () => ({})
  51264. },
  51265. accordion: Boolean,
  51266. renderContent: Function,
  51267. renderAfterExpand: Boolean,
  51268. showCheckbox: {
  51269. type: Boolean,
  51270. default: false
  51271. }
  51272. },
  51273. emits: ["node-expand"],
  51274. setup(props, ctx) {
  51275. const ns = useNamespace("tree");
  51276. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  51277. const tree = vue.inject("RootTree");
  51278. const expanded = vue.ref(false);
  51279. const childNodeRendered = vue.ref(false);
  51280. const oldChecked = vue.ref(null);
  51281. const oldIndeterminate = vue.ref(null);
  51282. const node$ = vue.ref(null);
  51283. const dragEvents = vue.inject(dragEventsKey);
  51284. const instance = vue.getCurrentInstance();
  51285. vue.provide("NodeInstance", instance);
  51286. if (props.node.expanded) {
  51287. expanded.value = true;
  51288. childNodeRendered.value = true;
  51289. }
  51290. const childrenKey = tree.props.props["children"] || "children";
  51291. vue.watch(() => {
  51292. const children = props.node.data[childrenKey];
  51293. return children && [...children];
  51294. }, () => {
  51295. props.node.updateChildren();
  51296. });
  51297. vue.watch(() => props.node.indeterminate, (val) => {
  51298. handleSelectChange(props.node.checked, val);
  51299. });
  51300. vue.watch(() => props.node.checked, (val) => {
  51301. handleSelectChange(val, props.node.indeterminate);
  51302. });
  51303. vue.watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  51304. vue.watch(() => props.node.expanded, (val) => {
  51305. vue.nextTick(() => expanded.value = val);
  51306. if (val) {
  51307. childNodeRendered.value = true;
  51308. }
  51309. });
  51310. const getNodeKey$1 = (node) => {
  51311. return getNodeKey(tree.props.nodeKey, node.data);
  51312. };
  51313. const getNodeClass = (node) => {
  51314. const nodeClassFunc = props.props.class;
  51315. if (!nodeClassFunc) {
  51316. return {};
  51317. }
  51318. let className;
  51319. if (isFunction$1(nodeClassFunc)) {
  51320. const { data } = node;
  51321. className = nodeClassFunc(data, node);
  51322. } else {
  51323. className = nodeClassFunc;
  51324. }
  51325. if (isString$1(className)) {
  51326. return { [className]: true };
  51327. } else {
  51328. return className;
  51329. }
  51330. };
  51331. const handleSelectChange = (checked, indeterminate) => {
  51332. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  51333. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  51334. }
  51335. oldChecked.value = checked;
  51336. oldIndeterminate.value = indeterminate;
  51337. };
  51338. const handleClick = (e) => {
  51339. handleCurrentChange(tree.store, tree.ctx.emit, () => tree.store.value.setCurrentNode(props.node));
  51340. tree.currentNode.value = props.node;
  51341. if (tree.props.expandOnClickNode) {
  51342. handleExpandIconClick();
  51343. }
  51344. if (tree.props.checkOnClickNode && !props.node.disabled) {
  51345. handleCheckChange(null, {
  51346. target: { checked: !props.node.checked }
  51347. });
  51348. }
  51349. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  51350. };
  51351. const handleContextMenu = (event) => {
  51352. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  51353. event.stopPropagation();
  51354. event.preventDefault();
  51355. }
  51356. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  51357. };
  51358. const handleExpandIconClick = () => {
  51359. if (props.node.isLeaf)
  51360. return;
  51361. if (expanded.value) {
  51362. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  51363. props.node.collapse();
  51364. } else {
  51365. props.node.expand(() => {
  51366. ctx.emit("node-expand", props.node.data, props.node, instance);
  51367. });
  51368. }
  51369. };
  51370. const handleCheckChange = (value, ev) => {
  51371. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  51372. vue.nextTick(() => {
  51373. const store = tree.store.value;
  51374. tree.ctx.emit("check", props.node.data, {
  51375. checkedNodes: store.getCheckedNodes(),
  51376. checkedKeys: store.getCheckedKeys(),
  51377. halfCheckedNodes: store.getHalfCheckedNodes(),
  51378. halfCheckedKeys: store.getHalfCheckedKeys()
  51379. });
  51380. });
  51381. };
  51382. const handleChildNodeExpand = (nodeData, node, instance2) => {
  51383. broadcastExpanded(node);
  51384. tree.ctx.emit("node-expand", nodeData, node, instance2);
  51385. };
  51386. const handleDragStart = (event) => {
  51387. if (!tree.props.draggable)
  51388. return;
  51389. dragEvents.treeNodeDragStart({ event, treeNode: props });
  51390. };
  51391. const handleDragOver = (event) => {
  51392. event.preventDefault();
  51393. if (!tree.props.draggable)
  51394. return;
  51395. dragEvents.treeNodeDragOver({
  51396. event,
  51397. treeNode: { $el: node$.value, node: props.node }
  51398. });
  51399. };
  51400. const handleDrop = (event) => {
  51401. event.preventDefault();
  51402. };
  51403. const handleDragEnd = (event) => {
  51404. if (!tree.props.draggable)
  51405. return;
  51406. dragEvents.treeNodeDragEnd(event);
  51407. };
  51408. return {
  51409. ns,
  51410. node$,
  51411. tree,
  51412. expanded,
  51413. childNodeRendered,
  51414. oldChecked,
  51415. oldIndeterminate,
  51416. getNodeKey: getNodeKey$1,
  51417. getNodeClass,
  51418. handleSelectChange,
  51419. handleClick,
  51420. handleContextMenu,
  51421. handleExpandIconClick,
  51422. handleCheckChange,
  51423. handleChildNodeExpand,
  51424. handleDragStart,
  51425. handleDragOver,
  51426. handleDrop,
  51427. handleDragEnd,
  51428. CaretRight: caret_right_default
  51429. };
  51430. }
  51431. });
  51432. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  51433. const _component_el_icon = vue.resolveComponent("el-icon");
  51434. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  51435. const _component_loading = vue.resolveComponent("loading");
  51436. const _component_node_content = vue.resolveComponent("node-content");
  51437. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  51438. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  51439. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  51440. ref: "node$",
  51441. class: vue.normalizeClass([
  51442. _ctx.ns.b("node"),
  51443. _ctx.ns.is("expanded", _ctx.expanded),
  51444. _ctx.ns.is("current", _ctx.node.isCurrent),
  51445. _ctx.ns.is("hidden", !_ctx.node.visible),
  51446. _ctx.ns.is("focusable", !_ctx.node.disabled),
  51447. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  51448. _ctx.getNodeClass(_ctx.node)
  51449. ]),
  51450. role: "treeitem",
  51451. tabindex: "-1",
  51452. "aria-expanded": _ctx.expanded,
  51453. "aria-disabled": _ctx.node.disabled,
  51454. "aria-checked": _ctx.node.checked,
  51455. draggable: _ctx.tree.props.draggable,
  51456. "data-key": _ctx.getNodeKey(_ctx.node),
  51457. onClick: vue.withModifiers(_ctx.handleClick, ["stop"]),
  51458. onContextmenu: _ctx.handleContextMenu,
  51459. onDragstart: vue.withModifiers(_ctx.handleDragStart, ["stop"]),
  51460. onDragover: vue.withModifiers(_ctx.handleDragOver, ["stop"]),
  51461. onDragend: vue.withModifiers(_ctx.handleDragEnd, ["stop"]),
  51462. onDrop: vue.withModifiers(_ctx.handleDrop, ["stop"])
  51463. }, [
  51464. vue.createElementVNode("div", {
  51465. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  51466. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  51467. }, [
  51468. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  51469. key: 0,
  51470. class: vue.normalizeClass([
  51471. _ctx.ns.be("node", "expand-icon"),
  51472. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  51473. {
  51474. expanded: !_ctx.node.isLeaf && _ctx.expanded
  51475. }
  51476. ]),
  51477. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  51478. }, {
  51479. default: vue.withCtx(() => [
  51480. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  51481. ]),
  51482. _: 1
  51483. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  51484. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  51485. key: 1,
  51486. "model-value": _ctx.node.checked,
  51487. indeterminate: _ctx.node.indeterminate,
  51488. disabled: !!_ctx.node.disabled,
  51489. onClick: vue.withModifiers(() => {
  51490. }, ["stop"]),
  51491. onChange: _ctx.handleCheckChange
  51492. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : vue.createCommentVNode("v-if", true),
  51493. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  51494. key: 2,
  51495. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  51496. }, {
  51497. default: vue.withCtx(() => [
  51498. vue.createVNode(_component_loading)
  51499. ]),
  51500. _: 1
  51501. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  51502. vue.createVNode(_component_node_content, {
  51503. node: _ctx.node,
  51504. "render-content": _ctx.renderContent
  51505. }, null, 8, ["node", "render-content"])
  51506. ], 6),
  51507. vue.createVNode(_component_el_collapse_transition, null, {
  51508. default: vue.withCtx(() => [
  51509. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  51510. key: 0,
  51511. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  51512. role: "group",
  51513. "aria-expanded": _ctx.expanded
  51514. }, [
  51515. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  51516. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  51517. key: _ctx.getNodeKey(child),
  51518. "render-content": _ctx.renderContent,
  51519. "render-after-expand": _ctx.renderAfterExpand,
  51520. "show-checkbox": _ctx.showCheckbox,
  51521. node: child,
  51522. accordion: _ctx.accordion,
  51523. props: _ctx.props,
  51524. onNodeExpand: _ctx.handleChildNodeExpand
  51525. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  51526. }), 128))
  51527. ], 10, ["aria-expanded"])), [
  51528. [vue.vShow, _ctx.expanded]
  51529. ]) : vue.createCommentVNode("v-if", true)
  51530. ]),
  51531. _: 1
  51532. })
  51533. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
  51534. [vue.vShow, _ctx.node.visible]
  51535. ]);
  51536. }
  51537. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  51538. function useKeydown({ el$ }, store) {
  51539. const ns = useNamespace("tree");
  51540. const treeItems = vue.shallowRef([]);
  51541. const checkboxItems = vue.shallowRef([]);
  51542. vue.onMounted(() => {
  51543. initTabIndex();
  51544. });
  51545. vue.onUpdated(() => {
  51546. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  51547. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  51548. });
  51549. vue.watch(checkboxItems, (val) => {
  51550. val.forEach((checkbox) => {
  51551. checkbox.setAttribute("tabindex", "-1");
  51552. });
  51553. });
  51554. const handleKeydown = (ev) => {
  51555. const currentItem = ev.target;
  51556. if (!currentItem.className.includes(ns.b("node")))
  51557. return;
  51558. const code = ev.code;
  51559. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  51560. const currentIndex = treeItems.value.indexOf(currentItem);
  51561. let nextIndex;
  51562. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  51563. ev.preventDefault();
  51564. if (code === EVENT_CODE.up) {
  51565. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  51566. const startIndex = nextIndex;
  51567. while (true) {
  51568. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  51569. break;
  51570. nextIndex--;
  51571. if (nextIndex === startIndex) {
  51572. nextIndex = -1;
  51573. break;
  51574. }
  51575. if (nextIndex < 0) {
  51576. nextIndex = treeItems.value.length - 1;
  51577. }
  51578. }
  51579. } else {
  51580. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  51581. const startIndex = nextIndex;
  51582. while (true) {
  51583. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  51584. break;
  51585. nextIndex++;
  51586. if (nextIndex === startIndex) {
  51587. nextIndex = -1;
  51588. break;
  51589. }
  51590. if (nextIndex >= treeItems.value.length) {
  51591. nextIndex = 0;
  51592. }
  51593. }
  51594. }
  51595. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  51596. }
  51597. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  51598. ev.preventDefault();
  51599. currentItem.click();
  51600. }
  51601. const hasInput = currentItem.querySelector('[type="checkbox"]');
  51602. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && hasInput) {
  51603. ev.preventDefault();
  51604. hasInput.click();
  51605. }
  51606. };
  51607. useEventListener(el$, "keydown", handleKeydown);
  51608. const initTabIndex = () => {
  51609. var _a;
  51610. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  51611. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  51612. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  51613. if (checkedItem.length) {
  51614. checkedItem[0].setAttribute("tabindex", "0");
  51615. return;
  51616. }
  51617. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  51618. };
  51619. }
  51620. const _sfc_main$k = vue.defineComponent({
  51621. name: "ElTree",
  51622. components: { ElTreeNode: ElTreeNode$1 },
  51623. props: {
  51624. data: {
  51625. type: Array,
  51626. default: () => []
  51627. },
  51628. emptyText: {
  51629. type: String
  51630. },
  51631. renderAfterExpand: {
  51632. type: Boolean,
  51633. default: true
  51634. },
  51635. nodeKey: String,
  51636. checkStrictly: Boolean,
  51637. defaultExpandAll: Boolean,
  51638. expandOnClickNode: {
  51639. type: Boolean,
  51640. default: true
  51641. },
  51642. checkOnClickNode: Boolean,
  51643. checkDescendants: {
  51644. type: Boolean,
  51645. default: false
  51646. },
  51647. autoExpandParent: {
  51648. type: Boolean,
  51649. default: true
  51650. },
  51651. defaultCheckedKeys: Array,
  51652. defaultExpandedKeys: Array,
  51653. currentNodeKey: [String, Number],
  51654. renderContent: Function,
  51655. showCheckbox: {
  51656. type: Boolean,
  51657. default: false
  51658. },
  51659. draggable: {
  51660. type: Boolean,
  51661. default: false
  51662. },
  51663. allowDrag: Function,
  51664. allowDrop: Function,
  51665. props: {
  51666. type: Object,
  51667. default: () => ({
  51668. children: "children",
  51669. label: "label",
  51670. disabled: "disabled"
  51671. })
  51672. },
  51673. lazy: {
  51674. type: Boolean,
  51675. default: false
  51676. },
  51677. highlightCurrent: Boolean,
  51678. load: Function,
  51679. filterNodeMethod: Function,
  51680. accordion: Boolean,
  51681. indent: {
  51682. type: Number,
  51683. default: 18
  51684. },
  51685. icon: {
  51686. type: iconPropType
  51687. }
  51688. },
  51689. emits: [
  51690. "check-change",
  51691. "current-change",
  51692. "node-click",
  51693. "node-contextmenu",
  51694. "node-collapse",
  51695. "node-expand",
  51696. "check",
  51697. "node-drag-start",
  51698. "node-drag-end",
  51699. "node-drop",
  51700. "node-drag-leave",
  51701. "node-drag-enter",
  51702. "node-drag-over"
  51703. ],
  51704. setup(props, ctx) {
  51705. const { t } = useLocale();
  51706. const ns = useNamespace("tree");
  51707. const selectInfo = vue.inject(selectKey, null);
  51708. const store = vue.ref(new TreeStore({
  51709. key: props.nodeKey,
  51710. data: props.data,
  51711. lazy: props.lazy,
  51712. props: props.props,
  51713. load: props.load,
  51714. currentNodeKey: props.currentNodeKey,
  51715. checkStrictly: props.checkStrictly,
  51716. checkDescendants: props.checkDescendants,
  51717. defaultCheckedKeys: props.defaultCheckedKeys,
  51718. defaultExpandedKeys: props.defaultExpandedKeys,
  51719. autoExpandParent: props.autoExpandParent,
  51720. defaultExpandAll: props.defaultExpandAll,
  51721. filterNodeMethod: props.filterNodeMethod
  51722. }));
  51723. store.value.initialize();
  51724. const root = vue.ref(store.value.root);
  51725. const currentNode = vue.ref(null);
  51726. const el$ = vue.ref(null);
  51727. const dropIndicator$ = vue.ref(null);
  51728. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  51729. const { dragState } = useDragNodeHandler({
  51730. props,
  51731. ctx,
  51732. el$,
  51733. dropIndicator$,
  51734. store
  51735. });
  51736. useKeydown({ el$ }, store);
  51737. const isEmpty = vue.computed(() => {
  51738. const { childNodes } = root.value;
  51739. const hasFilteredOptions = selectInfo ? selectInfo.hasFilteredOptions !== 0 : false;
  51740. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !hasFilteredOptions;
  51741. });
  51742. vue.watch(() => props.currentNodeKey, (newVal) => {
  51743. store.value.setCurrentNodeKey(newVal);
  51744. });
  51745. vue.watch(() => props.defaultCheckedKeys, (newVal) => {
  51746. store.value.setDefaultCheckedKey(newVal);
  51747. });
  51748. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  51749. store.value.setDefaultExpandedKeys(newVal);
  51750. });
  51751. vue.watch(() => props.data, (newVal) => {
  51752. store.value.setData(newVal);
  51753. }, { deep: true });
  51754. vue.watch(() => props.checkStrictly, (newVal) => {
  51755. store.value.checkStrictly = newVal;
  51756. });
  51757. const filter = (value) => {
  51758. if (!props.filterNodeMethod)
  51759. throw new Error("[Tree] filterNodeMethod is required when filter");
  51760. store.value.filter(value);
  51761. };
  51762. const getNodeKey$1 = (node) => {
  51763. return getNodeKey(props.nodeKey, node.data);
  51764. };
  51765. const getNodePath = (data) => {
  51766. if (!props.nodeKey)
  51767. throw new Error("[Tree] nodeKey is required in getNodePath");
  51768. const node = store.value.getNode(data);
  51769. if (!node)
  51770. return [];
  51771. const path = [node.data];
  51772. let parent = node.parent;
  51773. while (parent && parent !== root.value) {
  51774. path.push(parent.data);
  51775. parent = parent.parent;
  51776. }
  51777. return path.reverse();
  51778. };
  51779. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  51780. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  51781. };
  51782. const getCheckedKeys = (leafOnly) => {
  51783. return store.value.getCheckedKeys(leafOnly);
  51784. };
  51785. const getCurrentNode = () => {
  51786. const currentNode2 = store.value.getCurrentNode();
  51787. return currentNode2 ? currentNode2.data : null;
  51788. };
  51789. const getCurrentKey = () => {
  51790. if (!props.nodeKey)
  51791. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  51792. const currentNode2 = getCurrentNode();
  51793. return currentNode2 ? currentNode2[props.nodeKey] : null;
  51794. };
  51795. const setCheckedNodes = (nodes, leafOnly) => {
  51796. if (!props.nodeKey)
  51797. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  51798. store.value.setCheckedNodes(nodes, leafOnly);
  51799. };
  51800. const setCheckedKeys = (keys, leafOnly) => {
  51801. if (!props.nodeKey)
  51802. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  51803. store.value.setCheckedKeys(keys, leafOnly);
  51804. };
  51805. const setChecked = (data, checked, deep) => {
  51806. store.value.setChecked(data, checked, deep);
  51807. };
  51808. const getHalfCheckedNodes = () => {
  51809. return store.value.getHalfCheckedNodes();
  51810. };
  51811. const getHalfCheckedKeys = () => {
  51812. return store.value.getHalfCheckedKeys();
  51813. };
  51814. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  51815. if (!props.nodeKey)
  51816. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  51817. handleCurrentChange(store, ctx.emit, () => {
  51818. broadcastExpanded(node);
  51819. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  51820. });
  51821. };
  51822. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  51823. if (!props.nodeKey)
  51824. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  51825. handleCurrentChange(store, ctx.emit, () => {
  51826. broadcastExpanded();
  51827. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  51828. });
  51829. };
  51830. const getNode = (data) => {
  51831. return store.value.getNode(data);
  51832. };
  51833. const remove = (data) => {
  51834. store.value.remove(data);
  51835. };
  51836. const append = (data, parentNode) => {
  51837. store.value.append(data, parentNode);
  51838. };
  51839. const insertBefore = (data, refNode) => {
  51840. store.value.insertBefore(data, refNode);
  51841. };
  51842. const insertAfter = (data, refNode) => {
  51843. store.value.insertAfter(data, refNode);
  51844. };
  51845. const handleNodeExpand = (nodeData, node, instance) => {
  51846. broadcastExpanded(node);
  51847. ctx.emit("node-expand", nodeData, node, instance);
  51848. };
  51849. const updateKeyChildren = (key, data) => {
  51850. if (!props.nodeKey)
  51851. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  51852. store.value.updateChildren(key, data);
  51853. };
  51854. vue.provide("RootTree", {
  51855. ctx,
  51856. props,
  51857. store,
  51858. root,
  51859. currentNode,
  51860. instance: vue.getCurrentInstance()
  51861. });
  51862. vue.provide(formItemContextKey, void 0);
  51863. return {
  51864. ns,
  51865. store,
  51866. root,
  51867. currentNode,
  51868. dragState,
  51869. el$,
  51870. dropIndicator$,
  51871. isEmpty,
  51872. filter,
  51873. getNodeKey: getNodeKey$1,
  51874. getNodePath,
  51875. getCheckedNodes,
  51876. getCheckedKeys,
  51877. getCurrentNode,
  51878. getCurrentKey,
  51879. setCheckedNodes,
  51880. setCheckedKeys,
  51881. setChecked,
  51882. getHalfCheckedNodes,
  51883. getHalfCheckedKeys,
  51884. setCurrentNode,
  51885. setCurrentKey,
  51886. t,
  51887. getNode,
  51888. remove,
  51889. append,
  51890. insertBefore,
  51891. insertAfter,
  51892. handleNodeExpand,
  51893. updateKeyChildren
  51894. };
  51895. }
  51896. });
  51897. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  51898. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  51899. return vue.openBlock(), vue.createElementBlock("div", {
  51900. ref: "el$",
  51901. class: vue.normalizeClass([
  51902. _ctx.ns.b(),
  51903. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  51904. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  51905. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  51906. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  51907. ]),
  51908. role: "tree"
  51909. }, [
  51910. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  51911. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  51912. key: _ctx.getNodeKey(child),
  51913. node: child,
  51914. props: _ctx.props,
  51915. accordion: _ctx.accordion,
  51916. "render-after-expand": _ctx.renderAfterExpand,
  51917. "show-checkbox": _ctx.showCheckbox,
  51918. "render-content": _ctx.renderContent,
  51919. onNodeExpand: _ctx.handleNodeExpand
  51920. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  51921. }), 128)),
  51922. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  51923. key: 0,
  51924. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  51925. }, [
  51926. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  51927. var _a;
  51928. return [
  51929. vue.createElementVNode("span", {
  51930. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  51931. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  51932. ];
  51933. })
  51934. ], 2)) : vue.createCommentVNode("v-if", true),
  51935. vue.withDirectives(vue.createElementVNode("div", {
  51936. ref: "dropIndicator$",
  51937. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  51938. }, null, 2), [
  51939. [vue.vShow, _ctx.dragState.showDropIndicator]
  51940. ])
  51941. ], 2);
  51942. }
  51943. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  51944. const ElTree = withInstall(Tree);
  51945. const useSelect = (props, { attrs, emit }, {
  51946. select,
  51947. tree,
  51948. key
  51949. }) => {
  51950. const ns = useNamespace("tree-select");
  51951. vue.watch(() => props.data, () => {
  51952. if (props.filterable) {
  51953. vue.nextTick(() => {
  51954. var _a, _b;
  51955. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  51956. });
  51957. }
  51958. }, { flush: "post" });
  51959. const result = {
  51960. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  51961. ...attrs,
  51962. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  51963. valueKey: key,
  51964. popperClass: vue.computed(() => {
  51965. const classes = [ns.e("popper")];
  51966. if (props.popperClass)
  51967. classes.push(props.popperClass);
  51968. return classes.join(" ");
  51969. }),
  51970. filterMethod: (keyword = "") => {
  51971. var _a;
  51972. if (props.filterMethod) {
  51973. props.filterMethod(keyword);
  51974. } else if (props.remoteMethod) {
  51975. props.remoteMethod(keyword);
  51976. } else {
  51977. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  51978. }
  51979. }
  51980. };
  51981. return result;
  51982. };
  51983. const component = vue.defineComponent({
  51984. extends: ElOption,
  51985. setup(props, ctx) {
  51986. const result = ElOption.setup(props, ctx);
  51987. delete result.selectOptionClick;
  51988. const vm = vue.getCurrentInstance().proxy;
  51989. vue.nextTick(() => {
  51990. if (!result.select.states.cachedOptions.get(vm.value)) {
  51991. result.select.onOptionCreate(vm);
  51992. }
  51993. });
  51994. vue.watch(() => ctx.attrs.visible, (val) => {
  51995. result.states.visible = val;
  51996. }, {
  51997. immediate: true
  51998. });
  51999. return result;
  52000. },
  52001. methods: {
  52002. selectOptionClick() {
  52003. this.$el.parentElement.click();
  52004. }
  52005. }
  52006. });
  52007. var TreeSelectOption = component;
  52008. function isValidValue(val) {
  52009. return val || val === 0;
  52010. }
  52011. function isValidArray(val) {
  52012. return Array.isArray(val) && val.length;
  52013. }
  52014. function toValidArray(val) {
  52015. return Array.isArray(val) ? val : isValidValue(val) ? [val] : [];
  52016. }
  52017. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  52018. for (let i = 0; i < treeData.length; i++) {
  52019. const data = treeData[i];
  52020. if (findCallback(data, i, treeData, parent)) {
  52021. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  52022. } else {
  52023. const children = getChildren(data);
  52024. if (isValidArray(children)) {
  52025. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  52026. if (find)
  52027. return find;
  52028. }
  52029. }
  52030. }
  52031. }
  52032. function treeEach(treeData, callback, getChildren, parent) {
  52033. for (let i = 0; i < treeData.length; i++) {
  52034. const data = treeData[i];
  52035. callback(data, i, treeData, parent);
  52036. const children = getChildren(data);
  52037. if (isValidArray(children)) {
  52038. treeEach(children, callback, getChildren, data);
  52039. }
  52040. }
  52041. }
  52042. const useTree$1 = (props, { attrs, slots, emit }, {
  52043. select,
  52044. tree,
  52045. key
  52046. }) => {
  52047. vue.watch(() => props.modelValue, () => {
  52048. if (props.showCheckbox) {
  52049. vue.nextTick(() => {
  52050. const treeInstance = tree.value;
  52051. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  52052. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  52053. }
  52054. });
  52055. }
  52056. }, {
  52057. immediate: true,
  52058. deep: true
  52059. });
  52060. const propsMap = vue.computed(() => ({
  52061. value: key.value,
  52062. label: "label",
  52063. children: "children",
  52064. disabled: "disabled",
  52065. isLeaf: "isLeaf",
  52066. ...props.props
  52067. }));
  52068. const getNodeValByProp = (prop, data) => {
  52069. var _a;
  52070. const propVal = propsMap.value[prop];
  52071. if (isFunction$1(propVal)) {
  52072. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  52073. } else {
  52074. return data[propVal];
  52075. }
  52076. };
  52077. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  52078. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  52079. }).filter((item) => isValidValue(item));
  52080. const cacheOptions = vue.computed(() => {
  52081. if (!props.renderAfterExpand && !props.lazy)
  52082. return [];
  52083. const options = [];
  52084. treeEach(props.data.concat(props.cacheData), (node) => {
  52085. const value = getNodeValByProp("value", node);
  52086. options.push({
  52087. value,
  52088. currentLabel: getNodeValByProp("label", node),
  52089. isDisabled: getNodeValByProp("disabled", node)
  52090. });
  52091. }, (data) => getNodeValByProp("children", data));
  52092. return options;
  52093. });
  52094. const getChildCheckedKeys = () => {
  52095. var _a;
  52096. return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
  52097. var _a2;
  52098. const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
  52099. return !isNil(node) && isEmpty(node.childNodes);
  52100. });
  52101. };
  52102. return {
  52103. ...pick(vue.toRefs(props), Object.keys(ElTree.props)),
  52104. ...attrs,
  52105. nodeKey: key,
  52106. expandOnClickNode: vue.computed(() => {
  52107. return !props.checkStrictly && props.expandOnClickNode;
  52108. }),
  52109. defaultExpandedKeys: vue.computed(() => {
  52110. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  52111. }),
  52112. renderContent: (h, { node, data, store }) => {
  52113. return h(TreeSelectOption, {
  52114. value: getNodeValByProp("value", data),
  52115. label: getNodeValByProp("label", data),
  52116. disabled: getNodeValByProp("disabled", data),
  52117. visible: node.visible
  52118. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  52119. },
  52120. filterNodeMethod: (value, data, node) => {
  52121. if (props.filterNodeMethod)
  52122. return props.filterNodeMethod(value, data, node);
  52123. if (!value)
  52124. return true;
  52125. const regexp = new RegExp(escapeStringRegexp(value), "i");
  52126. return regexp.test(getNodeValByProp("label", data) || "");
  52127. },
  52128. onNodeClick: (data, node, e) => {
  52129. var _a, _b, _c, _d;
  52130. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  52131. if (props.showCheckbox && props.checkOnClickNode)
  52132. return;
  52133. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  52134. if (!getNodeValByProp("disabled", data)) {
  52135. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  52136. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  52137. }
  52138. } else if (props.expandOnClickNode) {
  52139. e.proxy.handleExpandIconClick();
  52140. }
  52141. (_d = select.value) == null ? void 0 : _d.focus();
  52142. },
  52143. onCheck: (data, params) => {
  52144. var _a;
  52145. if (!props.showCheckbox)
  52146. return;
  52147. const dataValue = getNodeValByProp("value", data);
  52148. const dataMap = {};
  52149. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  52150. const uncachedCheckedKeys = params.checkedKeys;
  52151. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  52152. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  52153. if (props.checkStrictly) {
  52154. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  52155. } else {
  52156. if (props.multiple) {
  52157. const childKeys = getChildCheckedKeys();
  52158. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  52159. } else {
  52160. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  52161. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  52162. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  52163. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  52164. }
  52165. }
  52166. vue.nextTick(() => {
  52167. var _a2;
  52168. const checkedKeys2 = toValidArray(props.modelValue);
  52169. tree.value.setCheckedKeys(checkedKeys2);
  52170. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  52171. checkedKeys: tree.value.getCheckedKeys(),
  52172. checkedNodes: tree.value.getCheckedNodes(),
  52173. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  52174. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  52175. });
  52176. });
  52177. (_a = select.value) == null ? void 0 : _a.focus();
  52178. },
  52179. onNodeExpand: (data, node, e) => {
  52180. var _a;
  52181. (_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
  52182. vue.nextTick(() => {
  52183. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  52184. const dataMap = {};
  52185. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  52186. treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
  52187. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  52188. const childKeys = getChildCheckedKeys();
  52189. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  52190. }
  52191. });
  52192. },
  52193. cacheOptions
  52194. };
  52195. };
  52196. var CacheOptions = vue.defineComponent({
  52197. props: {
  52198. data: {
  52199. type: Array,
  52200. default: () => []
  52201. }
  52202. },
  52203. setup(props) {
  52204. const select = vue.inject(selectKey);
  52205. vue.watch(() => props.data, () => {
  52206. var _a;
  52207. props.data.forEach((item) => {
  52208. if (!select.states.cachedOptions.has(item.value)) {
  52209. select.states.cachedOptions.set(item.value, item);
  52210. }
  52211. });
  52212. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  52213. if (isClient && !Array.from(inputs).includes(document.activeElement)) {
  52214. select.setSelected();
  52215. }
  52216. }, { flush: "post", immediate: true });
  52217. return () => void 0;
  52218. }
  52219. });
  52220. const _sfc_main$j = vue.defineComponent({
  52221. name: "ElTreeSelect",
  52222. inheritAttrs: false,
  52223. props: {
  52224. ...ElSelect.props,
  52225. ...ElTree.props,
  52226. cacheData: {
  52227. type: Array,
  52228. default: () => []
  52229. }
  52230. },
  52231. setup(props, context) {
  52232. const { slots, expose } = context;
  52233. const select = vue.ref();
  52234. const tree = vue.ref();
  52235. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  52236. const selectProps = useSelect(props, context, { select, tree, key });
  52237. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  52238. select,
  52239. tree,
  52240. key
  52241. });
  52242. const methods = vue.reactive({});
  52243. expose(methods);
  52244. vue.onMounted(() => {
  52245. Object.assign(methods, {
  52246. ...pick(tree.value, [
  52247. "filter",
  52248. "updateKeyChildren",
  52249. "getCheckedNodes",
  52250. "setCheckedNodes",
  52251. "getCheckedKeys",
  52252. "setCheckedKeys",
  52253. "setChecked",
  52254. "getHalfCheckedNodes",
  52255. "getHalfCheckedKeys",
  52256. "getCurrentKey",
  52257. "getCurrentNode",
  52258. "setCurrentKey",
  52259. "setCurrentNode",
  52260. "getNode",
  52261. "remove",
  52262. "append",
  52263. "insertBefore",
  52264. "insertAfter"
  52265. ]),
  52266. ...pick(select.value, ["focus", "blur"])
  52267. });
  52268. });
  52269. return () => vue.h(ElSelect, vue.reactive({
  52270. ...selectProps,
  52271. ref: (ref2) => select.value = ref2
  52272. }), {
  52273. ...slots,
  52274. default: () => [
  52275. vue.h(CacheOptions, { data: cacheOptions.value }),
  52276. vue.h(ElTree, vue.reactive({
  52277. ...treeProps,
  52278. ref: (ref2) => tree.value = ref2
  52279. }))
  52280. ]
  52281. });
  52282. }
  52283. });
  52284. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "tree-select.vue"]]);
  52285. const ElTreeSelect = withInstall(TreeSelect);
  52286. const ROOT_TREE_INJECTION_KEY = Symbol();
  52287. const EMPTY_NODE = {
  52288. key: -1,
  52289. level: -1,
  52290. data: {}
  52291. };
  52292. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  52293. TreeOptionsEnum2["KEY"] = "id";
  52294. TreeOptionsEnum2["LABEL"] = "label";
  52295. TreeOptionsEnum2["CHILDREN"] = "children";
  52296. TreeOptionsEnum2["DISABLED"] = "disabled";
  52297. return TreeOptionsEnum2;
  52298. })(TreeOptionsEnum || {});
  52299. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  52300. SetOperationEnum2["ADD"] = "add";
  52301. SetOperationEnum2["DELETE"] = "delete";
  52302. return SetOperationEnum2;
  52303. })(SetOperationEnum || {});
  52304. const itemSize = {
  52305. type: Number,
  52306. default: 26
  52307. };
  52308. const treeProps = buildProps({
  52309. data: {
  52310. type: definePropType(Array),
  52311. default: () => mutable([])
  52312. },
  52313. emptyText: {
  52314. type: String
  52315. },
  52316. height: {
  52317. type: Number,
  52318. default: 200
  52319. },
  52320. props: {
  52321. type: definePropType(Object),
  52322. default: () => mutable({
  52323. children: "children" /* CHILDREN */,
  52324. label: "label" /* LABEL */,
  52325. disabled: "disabled" /* DISABLED */,
  52326. value: "id" /* KEY */
  52327. })
  52328. },
  52329. highlightCurrent: {
  52330. type: Boolean,
  52331. default: false
  52332. },
  52333. showCheckbox: {
  52334. type: Boolean,
  52335. default: false
  52336. },
  52337. defaultCheckedKeys: {
  52338. type: definePropType(Array),
  52339. default: () => mutable([])
  52340. },
  52341. checkStrictly: {
  52342. type: Boolean,
  52343. default: false
  52344. },
  52345. defaultExpandedKeys: {
  52346. type: definePropType(Array),
  52347. default: () => mutable([])
  52348. },
  52349. indent: {
  52350. type: Number,
  52351. default: 16
  52352. },
  52353. itemSize,
  52354. icon: {
  52355. type: iconPropType
  52356. },
  52357. expandOnClickNode: {
  52358. type: Boolean,
  52359. default: true
  52360. },
  52361. checkOnClickNode: {
  52362. type: Boolean,
  52363. default: false
  52364. },
  52365. currentNodeKey: {
  52366. type: definePropType([String, Number])
  52367. },
  52368. accordion: {
  52369. type: Boolean,
  52370. default: false
  52371. },
  52372. filterMethod: {
  52373. type: definePropType(Function)
  52374. },
  52375. perfMode: {
  52376. type: Boolean,
  52377. default: true
  52378. }
  52379. });
  52380. const treeNodeProps = buildProps({
  52381. node: {
  52382. type: definePropType(Object),
  52383. default: () => mutable(EMPTY_NODE)
  52384. },
  52385. expanded: {
  52386. type: Boolean,
  52387. default: false
  52388. },
  52389. checked: {
  52390. type: Boolean,
  52391. default: false
  52392. },
  52393. indeterminate: {
  52394. type: Boolean,
  52395. default: false
  52396. },
  52397. showCheckbox: {
  52398. type: Boolean,
  52399. default: false
  52400. },
  52401. disabled: {
  52402. type: Boolean,
  52403. default: false
  52404. },
  52405. current: {
  52406. type: Boolean,
  52407. default: false
  52408. },
  52409. hiddenExpandIcon: {
  52410. type: Boolean,
  52411. default: false
  52412. },
  52413. itemSize
  52414. });
  52415. const treeNodeContentProps = buildProps({
  52416. node: {
  52417. type: definePropType(Object),
  52418. required: true
  52419. }
  52420. });
  52421. const NODE_CLICK = "node-click";
  52422. const NODE_EXPAND = "node-expand";
  52423. const NODE_COLLAPSE = "node-collapse";
  52424. const CURRENT_CHANGE = "current-change";
  52425. const NODE_CHECK = "check";
  52426. const NODE_CHECK_CHANGE = "check-change";
  52427. const NODE_CONTEXTMENU = "node-contextmenu";
  52428. const treeEmits = {
  52429. [NODE_CLICK]: (data, node, e) => data && node && e,
  52430. [NODE_EXPAND]: (data, node) => data && node,
  52431. [NODE_COLLAPSE]: (data, node) => data && node,
  52432. [CURRENT_CHANGE]: (data, node) => data && node,
  52433. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  52434. [NODE_CHECK_CHANGE]: (data, checked) => data && typeof checked === "boolean",
  52435. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  52436. };
  52437. const treeNodeEmits = {
  52438. click: (node, e) => !!(node && e),
  52439. toggle: (node) => !!node,
  52440. check: (node, checked) => node && typeof checked === "boolean"
  52441. };
  52442. function useCheck(props, tree) {
  52443. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  52444. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  52445. const { emit } = vue.getCurrentInstance();
  52446. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  52447. return vue.nextTick(() => {
  52448. _setCheckedKeys(props.defaultCheckedKeys);
  52449. });
  52450. }, {
  52451. immediate: true
  52452. });
  52453. const updateCheckedKeys = () => {
  52454. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  52455. return;
  52456. }
  52457. const { levelTreeNodeMap, maxLevel } = tree.value;
  52458. const checkedKeySet = checkedKeys.value;
  52459. const indeterminateKeySet = /* @__PURE__ */ new Set();
  52460. for (let level = maxLevel - 1; level >= 1; --level) {
  52461. const nodes = levelTreeNodeMap.get(level);
  52462. if (!nodes)
  52463. continue;
  52464. nodes.forEach((node) => {
  52465. const children = node.children;
  52466. if (children) {
  52467. let allChecked = true;
  52468. let hasChecked = false;
  52469. for (const childNode of children) {
  52470. const key = childNode.key;
  52471. if (checkedKeySet.has(key)) {
  52472. hasChecked = true;
  52473. } else if (indeterminateKeySet.has(key)) {
  52474. allChecked = false;
  52475. hasChecked = true;
  52476. break;
  52477. } else {
  52478. allChecked = false;
  52479. }
  52480. }
  52481. if (allChecked) {
  52482. checkedKeySet.add(node.key);
  52483. } else if (hasChecked) {
  52484. indeterminateKeySet.add(node.key);
  52485. checkedKeySet.delete(node.key);
  52486. } else {
  52487. checkedKeySet.delete(node.key);
  52488. indeterminateKeySet.delete(node.key);
  52489. }
  52490. }
  52491. });
  52492. }
  52493. indeterminateKeys.value = indeterminateKeySet;
  52494. };
  52495. const isChecked = (node) => checkedKeys.value.has(node.key);
  52496. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  52497. const toggleCheckbox = (node, isChecked2, nodeClick = true) => {
  52498. const checkedKeySet = checkedKeys.value;
  52499. const toggle = (node2, checked) => {
  52500. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  52501. const children = node2.children;
  52502. if (!props.checkStrictly && children) {
  52503. children.forEach((childNode) => {
  52504. if (!childNode.disabled) {
  52505. toggle(childNode, checked);
  52506. }
  52507. });
  52508. }
  52509. };
  52510. toggle(node, isChecked2);
  52511. updateCheckedKeys();
  52512. if (nodeClick) {
  52513. afterNodeCheck(node, isChecked2);
  52514. }
  52515. };
  52516. const afterNodeCheck = (node, checked) => {
  52517. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  52518. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  52519. emit(NODE_CHECK, node.data, {
  52520. checkedKeys: checkedKeys2,
  52521. checkedNodes,
  52522. halfCheckedKeys,
  52523. halfCheckedNodes
  52524. });
  52525. emit(NODE_CHECK_CHANGE, node.data, checked);
  52526. };
  52527. function getCheckedKeys(leafOnly = false) {
  52528. return getChecked(leafOnly).checkedKeys;
  52529. }
  52530. function getCheckedNodes(leafOnly = false) {
  52531. return getChecked(leafOnly).checkedNodes;
  52532. }
  52533. function getHalfCheckedKeys() {
  52534. return getHalfChecked().halfCheckedKeys;
  52535. }
  52536. function getHalfCheckedNodes() {
  52537. return getHalfChecked().halfCheckedNodes;
  52538. }
  52539. function getChecked(leafOnly = false) {
  52540. const checkedNodes = [];
  52541. const keys = [];
  52542. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  52543. const { treeNodeMap } = tree.value;
  52544. checkedKeys.value.forEach((key) => {
  52545. const node = treeNodeMap.get(key);
  52546. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  52547. keys.push(key);
  52548. checkedNodes.push(node.data);
  52549. }
  52550. });
  52551. }
  52552. return {
  52553. checkedKeys: keys,
  52554. checkedNodes
  52555. };
  52556. }
  52557. function getHalfChecked() {
  52558. const halfCheckedNodes = [];
  52559. const halfCheckedKeys = [];
  52560. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  52561. const { treeNodeMap } = tree.value;
  52562. indeterminateKeys.value.forEach((key) => {
  52563. const node = treeNodeMap.get(key);
  52564. if (node) {
  52565. halfCheckedKeys.push(key);
  52566. halfCheckedNodes.push(node.data);
  52567. }
  52568. });
  52569. }
  52570. return {
  52571. halfCheckedNodes,
  52572. halfCheckedKeys
  52573. };
  52574. }
  52575. function setCheckedKeys(keys) {
  52576. checkedKeys.value.clear();
  52577. indeterminateKeys.value.clear();
  52578. vue.nextTick(() => {
  52579. _setCheckedKeys(keys);
  52580. });
  52581. }
  52582. function setChecked(key, isChecked2) {
  52583. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  52584. const node = tree.value.treeNodeMap.get(key);
  52585. if (node) {
  52586. toggleCheckbox(node, isChecked2, false);
  52587. }
  52588. }
  52589. }
  52590. function _setCheckedKeys(keys) {
  52591. if (tree == null ? void 0 : tree.value) {
  52592. const { treeNodeMap } = tree.value;
  52593. if (props.showCheckbox && treeNodeMap && keys) {
  52594. for (const key of keys) {
  52595. const node = treeNodeMap.get(key);
  52596. if (node && !isChecked(node)) {
  52597. toggleCheckbox(node, true, false);
  52598. }
  52599. }
  52600. }
  52601. }
  52602. }
  52603. return {
  52604. updateCheckedKeys,
  52605. toggleCheckbox,
  52606. isChecked,
  52607. isIndeterminate,
  52608. getCheckedKeys,
  52609. getCheckedNodes,
  52610. getHalfCheckedKeys,
  52611. getHalfCheckedNodes,
  52612. setChecked,
  52613. setCheckedKeys
  52614. };
  52615. }
  52616. function useFilter(props, tree) {
  52617. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  52618. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  52619. const filterable = vue.computed(() => {
  52620. return isFunction$1(props.filterMethod);
  52621. });
  52622. function doFilter(query) {
  52623. var _a;
  52624. if (!filterable.value) {
  52625. return;
  52626. }
  52627. const expandKeySet = /* @__PURE__ */ new Set();
  52628. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  52629. const hiddenKeys = hiddenNodeKeySet.value;
  52630. const family = [];
  52631. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  52632. const filter = props.filterMethod;
  52633. hiddenKeys.clear();
  52634. function traverse(nodes2) {
  52635. nodes2.forEach((node) => {
  52636. family.push(node);
  52637. if (filter == null ? void 0 : filter(query, node.data)) {
  52638. family.forEach((member) => {
  52639. expandKeySet.add(member.key);
  52640. });
  52641. } else if (node.isLeaf) {
  52642. hiddenKeys.add(node.key);
  52643. }
  52644. const children = node.children;
  52645. if (children) {
  52646. traverse(children);
  52647. }
  52648. if (!node.isLeaf) {
  52649. if (!expandKeySet.has(node.key)) {
  52650. hiddenKeys.add(node.key);
  52651. } else if (children) {
  52652. let allHidden = true;
  52653. for (const childNode of children) {
  52654. if (!hiddenKeys.has(childNode.key)) {
  52655. allHidden = false;
  52656. break;
  52657. }
  52658. }
  52659. if (allHidden) {
  52660. hiddenExpandIconKeys.add(node.key);
  52661. } else {
  52662. hiddenExpandIconKeys.delete(node.key);
  52663. }
  52664. }
  52665. }
  52666. family.pop();
  52667. });
  52668. }
  52669. traverse(nodes);
  52670. return expandKeySet;
  52671. }
  52672. function isForceHiddenExpandIcon(node) {
  52673. return hiddenExpandIconKeySet.value.has(node.key);
  52674. }
  52675. return {
  52676. hiddenExpandIconKeySet,
  52677. hiddenNodeKeySet,
  52678. doFilter,
  52679. isForceHiddenExpandIcon
  52680. };
  52681. }
  52682. function useTree(props, emit) {
  52683. const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys));
  52684. const currentKey = vue.ref();
  52685. const tree = vue.shallowRef();
  52686. const listRef = vue.ref();
  52687. vue.watch(() => props.currentNodeKey, (key) => {
  52688. currentKey.value = key;
  52689. }, {
  52690. immediate: true
  52691. });
  52692. vue.watch(() => props.data, (data) => {
  52693. setData(data);
  52694. }, {
  52695. immediate: true
  52696. });
  52697. const {
  52698. isIndeterminate,
  52699. isChecked,
  52700. toggleCheckbox,
  52701. getCheckedKeys,
  52702. getCheckedNodes,
  52703. getHalfCheckedKeys,
  52704. getHalfCheckedNodes,
  52705. setChecked,
  52706. setCheckedKeys
  52707. } = useCheck(props, tree);
  52708. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  52709. const valueKey = vue.computed(() => {
  52710. var _a;
  52711. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  52712. });
  52713. const childrenKey = vue.computed(() => {
  52714. var _a;
  52715. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  52716. });
  52717. const disabledKey = vue.computed(() => {
  52718. var _a;
  52719. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  52720. });
  52721. const labelKey = vue.computed(() => {
  52722. var _a;
  52723. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  52724. });
  52725. const flattenTree = vue.computed(() => {
  52726. var _a;
  52727. const expandedKeys = expandedKeySet.value;
  52728. const hiddenKeys = hiddenNodeKeySet.value;
  52729. const flattenNodes = [];
  52730. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  52731. const stack = [];
  52732. for (let i = nodes.length - 1; i >= 0; --i) {
  52733. stack.push(nodes[i]);
  52734. }
  52735. while (stack.length) {
  52736. const node = stack.pop();
  52737. if (hiddenKeys.has(node.key))
  52738. continue;
  52739. flattenNodes.push(node);
  52740. if (node.children && expandedKeys.has(node.key)) {
  52741. for (let i = node.children.length - 1; i >= 0; --i) {
  52742. stack.push(node.children[i]);
  52743. }
  52744. }
  52745. }
  52746. return flattenNodes;
  52747. });
  52748. const isNotEmpty = vue.computed(() => {
  52749. return flattenTree.value.length > 0;
  52750. });
  52751. function createTree(data) {
  52752. const treeNodeMap = /* @__PURE__ */ new Map();
  52753. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  52754. let maxLevel = 1;
  52755. function traverse(nodes, level = 1, parent = void 0) {
  52756. var _a;
  52757. const siblings = [];
  52758. for (const rawNode of nodes) {
  52759. const value = getKey(rawNode);
  52760. const node = {
  52761. level,
  52762. key: value,
  52763. data: rawNode
  52764. };
  52765. node.label = getLabel(rawNode);
  52766. node.parent = parent;
  52767. const children = getChildren(rawNode);
  52768. node.disabled = getDisabled(rawNode);
  52769. node.isLeaf = !children || children.length === 0;
  52770. if (children && children.length) {
  52771. node.children = traverse(children, level + 1, node);
  52772. }
  52773. siblings.push(node);
  52774. treeNodeMap.set(value, node);
  52775. if (!levelTreeNodeMap.has(level)) {
  52776. levelTreeNodeMap.set(level, []);
  52777. }
  52778. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  52779. }
  52780. if (level > maxLevel) {
  52781. maxLevel = level;
  52782. }
  52783. return siblings;
  52784. }
  52785. const treeNodes = traverse(data);
  52786. return {
  52787. treeNodeMap,
  52788. levelTreeNodeMap,
  52789. maxLevel,
  52790. treeNodes
  52791. };
  52792. }
  52793. function filter(query) {
  52794. const keys = doFilter(query);
  52795. if (keys) {
  52796. expandedKeySet.value = keys;
  52797. }
  52798. }
  52799. function getChildren(node) {
  52800. return node[childrenKey.value];
  52801. }
  52802. function getKey(node) {
  52803. if (!node) {
  52804. return "";
  52805. }
  52806. return node[valueKey.value];
  52807. }
  52808. function getDisabled(node) {
  52809. return node[disabledKey.value];
  52810. }
  52811. function getLabel(node) {
  52812. return node[labelKey.value];
  52813. }
  52814. function toggleExpand(node) {
  52815. const expandedKeys = expandedKeySet.value;
  52816. if (expandedKeys.has(node.key)) {
  52817. collapseNode(node);
  52818. } else {
  52819. expandNode(node);
  52820. }
  52821. }
  52822. function setExpandedKeys(keys) {
  52823. const expandedKeys = /* @__PURE__ */ new Set();
  52824. const nodeMap = tree.value.treeNodeMap;
  52825. keys.forEach((k) => {
  52826. let node = nodeMap.get(k);
  52827. while (node && !expandedKeys.has(node.key)) {
  52828. expandedKeys.add(node.key);
  52829. node = node.parent;
  52830. }
  52831. });
  52832. expandedKeySet.value = expandedKeys;
  52833. }
  52834. function handleNodeClick(node, e) {
  52835. emit(NODE_CLICK, node.data, node, e);
  52836. handleCurrentChange(node);
  52837. if (props.expandOnClickNode) {
  52838. toggleExpand(node);
  52839. }
  52840. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  52841. toggleCheckbox(node, !isChecked(node), true);
  52842. }
  52843. }
  52844. function handleCurrentChange(node) {
  52845. if (!isCurrent(node)) {
  52846. currentKey.value = node.key;
  52847. emit(CURRENT_CHANGE, node.data, node);
  52848. }
  52849. }
  52850. function handleNodeCheck(node, checked) {
  52851. toggleCheckbox(node, checked);
  52852. }
  52853. function expandNode(node) {
  52854. const keySet = expandedKeySet.value;
  52855. if (tree.value && props.accordion) {
  52856. const { treeNodeMap } = tree.value;
  52857. keySet.forEach((key) => {
  52858. const treeNode = treeNodeMap.get(key);
  52859. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  52860. keySet.delete(key);
  52861. }
  52862. });
  52863. }
  52864. keySet.add(node.key);
  52865. emit(NODE_EXPAND, node.data, node);
  52866. }
  52867. function collapseNode(node) {
  52868. expandedKeySet.value.delete(node.key);
  52869. emit(NODE_COLLAPSE, node.data, node);
  52870. }
  52871. function isExpanded(node) {
  52872. return expandedKeySet.value.has(node.key);
  52873. }
  52874. function isDisabled(node) {
  52875. return !!node.disabled;
  52876. }
  52877. function isCurrent(node) {
  52878. const current = currentKey.value;
  52879. return current !== void 0 && current === node.key;
  52880. }
  52881. function getCurrentNode() {
  52882. var _a, _b;
  52883. if (!currentKey.value)
  52884. return void 0;
  52885. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  52886. }
  52887. function getCurrentKey() {
  52888. return currentKey.value;
  52889. }
  52890. function setCurrentKey(key) {
  52891. currentKey.value = key;
  52892. }
  52893. function setData(data) {
  52894. vue.nextTick(() => tree.value = createTree(data));
  52895. }
  52896. function getNode(data) {
  52897. var _a;
  52898. const key = isObject$1(data) ? getKey(data) : data;
  52899. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  52900. }
  52901. function scrollToNode(key, strategy = "auto") {
  52902. const node = getNode(key);
  52903. if (node && listRef.value) {
  52904. listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  52905. }
  52906. }
  52907. function scrollTo(offset) {
  52908. var _a;
  52909. (_a = listRef.value) == null ? void 0 : _a.scrollTo(offset);
  52910. }
  52911. return {
  52912. tree,
  52913. flattenTree,
  52914. isNotEmpty,
  52915. listRef,
  52916. getKey,
  52917. getChildren,
  52918. toggleExpand,
  52919. toggleCheckbox,
  52920. isExpanded,
  52921. isChecked,
  52922. isIndeterminate,
  52923. isDisabled,
  52924. isCurrent,
  52925. isForceHiddenExpandIcon,
  52926. handleNodeClick,
  52927. handleNodeCheck,
  52928. getCurrentNode,
  52929. getCurrentKey,
  52930. setCurrentKey,
  52931. getCheckedKeys,
  52932. getCheckedNodes,
  52933. getHalfCheckedKeys,
  52934. getHalfCheckedNodes,
  52935. setChecked,
  52936. setCheckedKeys,
  52937. filter,
  52938. setData,
  52939. getNode,
  52940. expandNode,
  52941. collapseNode,
  52942. setExpandedKeys,
  52943. scrollToNode,
  52944. scrollTo
  52945. };
  52946. }
  52947. var ElNodeContent = vue.defineComponent({
  52948. name: "ElTreeNodeContent",
  52949. props: treeNodeContentProps,
  52950. setup(props) {
  52951. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  52952. const ns = useNamespace("tree");
  52953. return () => {
  52954. const node = props.node;
  52955. const { data } = node;
  52956. 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]);
  52957. };
  52958. }
  52959. });
  52960. const __default__$h = vue.defineComponent({
  52961. name: "ElTreeNode"
  52962. });
  52963. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  52964. ...__default__$h,
  52965. props: treeNodeProps,
  52966. emits: treeNodeEmits,
  52967. setup(__props, { emit }) {
  52968. const props = __props;
  52969. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  52970. const ns = useNamespace("tree");
  52971. const indent = vue.computed(() => {
  52972. var _a;
  52973. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  52974. });
  52975. const icon = vue.computed(() => {
  52976. var _a;
  52977. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  52978. });
  52979. const handleClick = (e) => {
  52980. emit("click", props.node, e);
  52981. };
  52982. const handleExpandIconClick = () => {
  52983. emit("toggle", props.node);
  52984. };
  52985. const handleCheckChange = (value) => {
  52986. emit("check", props.node, value);
  52987. };
  52988. const handleContextMenu = (event) => {
  52989. var _a, _b, _c, _d;
  52990. 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"]) {
  52991. event.stopPropagation();
  52992. event.preventDefault();
  52993. }
  52994. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  52995. };
  52996. return (_ctx, _cache) => {
  52997. var _a, _b, _c;
  52998. return vue.openBlock(), vue.createElementBlock("div", {
  52999. ref: "node$",
  53000. class: vue.normalizeClass([
  53001. vue.unref(ns).b("node"),
  53002. vue.unref(ns).is("expanded", _ctx.expanded),
  53003. vue.unref(ns).is("current", _ctx.current),
  53004. vue.unref(ns).is("focusable", !_ctx.disabled),
  53005. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked)
  53006. ]),
  53007. role: "treeitem",
  53008. tabindex: "-1",
  53009. "aria-expanded": _ctx.expanded,
  53010. "aria-disabled": _ctx.disabled,
  53011. "aria-checked": _ctx.checked,
  53012. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  53013. onClick: vue.withModifiers(handleClick, ["stop"]),
  53014. onContextmenu: handleContextMenu
  53015. }, [
  53016. vue.createElementVNode("div", {
  53017. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  53018. style: vue.normalizeStyle({
  53019. paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px`,
  53020. height: _ctx.itemSize + "px"
  53021. })
  53022. }, [
  53023. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53024. key: 0,
  53025. class: vue.normalizeClass([
  53026. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  53027. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  53028. {
  53029. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  53030. },
  53031. vue.unref(ns).be("node", "expand-icon")
  53032. ]),
  53033. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  53034. }, {
  53035. default: vue.withCtx(() => [
  53036. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  53037. ]),
  53038. _: 1
  53039. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  53040. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  53041. key: 1,
  53042. "model-value": _ctx.checked,
  53043. indeterminate: _ctx.indeterminate,
  53044. disabled: _ctx.disabled,
  53045. onChange: handleCheckChange,
  53046. onClick: vue.withModifiers(() => {
  53047. }, ["stop"])
  53048. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  53049. vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  53050. ], 6)
  53051. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"]);
  53052. };
  53053. }
  53054. });
  53055. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "tree-node.vue"]]);
  53056. const __default__$g = vue.defineComponent({
  53057. name: "ElTreeV2"
  53058. });
  53059. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  53060. ...__default__$g,
  53061. props: treeProps,
  53062. emits: treeEmits,
  53063. setup(__props, { expose, emit }) {
  53064. const props = __props;
  53065. const slots = vue.useSlots();
  53066. const treeNodeSize = vue.computed(() => props.itemSize);
  53067. vue.provide(ROOT_TREE_INJECTION_KEY, {
  53068. ctx: {
  53069. emit,
  53070. slots
  53071. },
  53072. props,
  53073. instance: vue.getCurrentInstance()
  53074. });
  53075. vue.provide(formItemContextKey, void 0);
  53076. const { t } = useLocale();
  53077. const ns = useNamespace("tree");
  53078. const {
  53079. flattenTree,
  53080. isNotEmpty,
  53081. listRef,
  53082. toggleExpand,
  53083. isExpanded,
  53084. isIndeterminate,
  53085. isChecked,
  53086. isDisabled,
  53087. isCurrent,
  53088. isForceHiddenExpandIcon,
  53089. handleNodeClick,
  53090. handleNodeCheck,
  53091. toggleCheckbox,
  53092. getCurrentNode,
  53093. getCurrentKey,
  53094. setCurrentKey,
  53095. getCheckedKeys,
  53096. getCheckedNodes,
  53097. getHalfCheckedKeys,
  53098. getHalfCheckedNodes,
  53099. setChecked,
  53100. setCheckedKeys,
  53101. filter,
  53102. setData,
  53103. getNode,
  53104. expandNode,
  53105. collapseNode,
  53106. setExpandedKeys,
  53107. scrollToNode,
  53108. scrollTo
  53109. } = useTree(props, emit);
  53110. expose({
  53111. toggleCheckbox,
  53112. getCurrentNode,
  53113. getCurrentKey,
  53114. setCurrentKey,
  53115. getCheckedKeys,
  53116. getCheckedNodes,
  53117. getHalfCheckedKeys,
  53118. getHalfCheckedNodes,
  53119. setChecked,
  53120. setCheckedKeys,
  53121. filter,
  53122. setData,
  53123. getNode,
  53124. expandNode,
  53125. collapseNode,
  53126. setExpandedKeys,
  53127. scrollToNode,
  53128. scrollTo
  53129. });
  53130. return (_ctx, _cache) => {
  53131. var _a;
  53132. return vue.openBlock(), vue.createElementBlock("div", {
  53133. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  53134. role: "tree"
  53135. }, [
  53136. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  53137. key: 0,
  53138. ref_key: "listRef",
  53139. ref: listRef,
  53140. "class-name": vue.unref(ns).b("virtual-list"),
  53141. data: vue.unref(flattenTree),
  53142. total: vue.unref(flattenTree).length,
  53143. height: _ctx.height,
  53144. "item-size": vue.unref(treeNodeSize),
  53145. "perf-mode": _ctx.perfMode
  53146. }, {
  53147. default: vue.withCtx(({ data, index, style }) => [
  53148. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  53149. key: data[index].key,
  53150. style: vue.normalizeStyle(style),
  53151. node: data[index],
  53152. expanded: vue.unref(isExpanded)(data[index]),
  53153. "show-checkbox": _ctx.showCheckbox,
  53154. checked: vue.unref(isChecked)(data[index]),
  53155. indeterminate: vue.unref(isIndeterminate)(data[index]),
  53156. "item-size": vue.unref(treeNodeSize),
  53157. disabled: vue.unref(isDisabled)(data[index]),
  53158. current: vue.unref(isCurrent)(data[index]),
  53159. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  53160. onClick: vue.unref(handleNodeClick),
  53161. onToggle: vue.unref(toggleExpand),
  53162. onCheck: vue.unref(handleNodeCheck)
  53163. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"]))
  53164. ]),
  53165. _: 1
  53166. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", {
  53167. key: 1,
  53168. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  53169. }, [
  53170. vue.createElementVNode("span", {
  53171. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  53172. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  53173. ], 2))
  53174. ], 2);
  53175. };
  53176. }
  53177. });
  53178. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "tree.vue"]]);
  53179. const ElTreeV2 = withInstall(TreeV2);
  53180. const uploadContextKey = Symbol("uploadContextKey");
  53181. const SCOPE$2 = "ElUpload";
  53182. class UploadAjaxError extends Error {
  53183. constructor(message, status, method, url) {
  53184. super(message);
  53185. this.name = "UploadAjaxError";
  53186. this.status = status;
  53187. this.method = method;
  53188. this.url = url;
  53189. }
  53190. }
  53191. function getError(action, option, xhr) {
  53192. let msg;
  53193. if (xhr.response) {
  53194. msg = `${xhr.response.error || xhr.response}`;
  53195. } else if (xhr.responseText) {
  53196. msg = `${xhr.responseText}`;
  53197. } else {
  53198. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  53199. }
  53200. return new UploadAjaxError(msg, xhr.status, option.method, action);
  53201. }
  53202. function getBody(xhr) {
  53203. const text = xhr.responseText || xhr.response;
  53204. if (!text) {
  53205. return text;
  53206. }
  53207. try {
  53208. return JSON.parse(text);
  53209. } catch (e) {
  53210. return text;
  53211. }
  53212. }
  53213. const ajaxUpload = (option) => {
  53214. if (typeof XMLHttpRequest === "undefined")
  53215. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  53216. const xhr = new XMLHttpRequest();
  53217. const action = option.action;
  53218. if (xhr.upload) {
  53219. xhr.upload.addEventListener("progress", (evt) => {
  53220. const progressEvt = evt;
  53221. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  53222. option.onProgress(progressEvt);
  53223. });
  53224. }
  53225. const formData = new FormData();
  53226. if (option.data) {
  53227. for (const [key, value] of Object.entries(option.data)) {
  53228. if (isArray$1(value) && value.length)
  53229. formData.append(key, ...value);
  53230. else
  53231. formData.append(key, value);
  53232. }
  53233. }
  53234. formData.append(option.filename, option.file, option.file.name);
  53235. xhr.addEventListener("error", () => {
  53236. option.onError(getError(action, option, xhr));
  53237. });
  53238. xhr.addEventListener("load", () => {
  53239. if (xhr.status < 200 || xhr.status >= 300) {
  53240. return option.onError(getError(action, option, xhr));
  53241. }
  53242. option.onSuccess(getBody(xhr));
  53243. });
  53244. xhr.open(option.method, action, true);
  53245. if (option.withCredentials && "withCredentials" in xhr) {
  53246. xhr.withCredentials = true;
  53247. }
  53248. const headers = option.headers || {};
  53249. if (headers instanceof Headers) {
  53250. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  53251. } else {
  53252. for (const [key, value] of Object.entries(headers)) {
  53253. if (isNil(value))
  53254. continue;
  53255. xhr.setRequestHeader(key, String(value));
  53256. }
  53257. }
  53258. xhr.send(formData);
  53259. return xhr;
  53260. };
  53261. const uploadListTypes = ["text", "picture", "picture-card"];
  53262. let fileId = 1;
  53263. const genFileId = () => Date.now() + fileId++;
  53264. const uploadBaseProps = buildProps({
  53265. action: {
  53266. type: String,
  53267. default: "#"
  53268. },
  53269. headers: {
  53270. type: definePropType(Object)
  53271. },
  53272. method: {
  53273. type: String,
  53274. default: "post"
  53275. },
  53276. data: {
  53277. type: definePropType([Object, Function, Promise]),
  53278. default: () => mutable({})
  53279. },
  53280. multiple: Boolean,
  53281. name: {
  53282. type: String,
  53283. default: "file"
  53284. },
  53285. drag: Boolean,
  53286. withCredentials: Boolean,
  53287. showFileList: {
  53288. type: Boolean,
  53289. default: true
  53290. },
  53291. accept: {
  53292. type: String,
  53293. default: ""
  53294. },
  53295. fileList: {
  53296. type: definePropType(Array),
  53297. default: () => mutable([])
  53298. },
  53299. autoUpload: {
  53300. type: Boolean,
  53301. default: true
  53302. },
  53303. listType: {
  53304. type: String,
  53305. values: uploadListTypes,
  53306. default: "text"
  53307. },
  53308. httpRequest: {
  53309. type: definePropType(Function),
  53310. default: ajaxUpload
  53311. },
  53312. disabled: Boolean,
  53313. limit: Number
  53314. });
  53315. const uploadProps = buildProps({
  53316. ...uploadBaseProps,
  53317. beforeUpload: {
  53318. type: definePropType(Function),
  53319. default: NOOP
  53320. },
  53321. beforeRemove: {
  53322. type: definePropType(Function)
  53323. },
  53324. onRemove: {
  53325. type: definePropType(Function),
  53326. default: NOOP
  53327. },
  53328. onChange: {
  53329. type: definePropType(Function),
  53330. default: NOOP
  53331. },
  53332. onPreview: {
  53333. type: definePropType(Function),
  53334. default: NOOP
  53335. },
  53336. onSuccess: {
  53337. type: definePropType(Function),
  53338. default: NOOP
  53339. },
  53340. onProgress: {
  53341. type: definePropType(Function),
  53342. default: NOOP
  53343. },
  53344. onError: {
  53345. type: definePropType(Function),
  53346. default: NOOP
  53347. },
  53348. onExceed: {
  53349. type: definePropType(Function),
  53350. default: NOOP
  53351. },
  53352. crossorigin: {
  53353. type: definePropType(String)
  53354. }
  53355. });
  53356. const uploadListProps = buildProps({
  53357. files: {
  53358. type: definePropType(Array),
  53359. default: () => mutable([])
  53360. },
  53361. disabled: {
  53362. type: Boolean,
  53363. default: false
  53364. },
  53365. handlePreview: {
  53366. type: definePropType(Function),
  53367. default: NOOP
  53368. },
  53369. listType: {
  53370. type: String,
  53371. values: uploadListTypes,
  53372. default: "text"
  53373. },
  53374. crossorigin: {
  53375. type: definePropType(String)
  53376. }
  53377. });
  53378. const uploadListEmits = {
  53379. remove: (file) => !!file
  53380. };
  53381. const __default__$f = vue.defineComponent({
  53382. name: "ElUploadList"
  53383. });
  53384. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  53385. ...__default__$f,
  53386. props: uploadListProps,
  53387. emits: uploadListEmits,
  53388. setup(__props, { emit }) {
  53389. const props = __props;
  53390. const { t } = useLocale();
  53391. const nsUpload = useNamespace("upload");
  53392. const nsIcon = useNamespace("icon");
  53393. const nsList = useNamespace("list");
  53394. const disabled = useFormDisabled();
  53395. const focusing = vue.ref(false);
  53396. const containerKls = vue.computed(() => [
  53397. nsUpload.b("list"),
  53398. nsUpload.bm("list", props.listType),
  53399. nsUpload.is("disabled", props.disabled)
  53400. ]);
  53401. const handleRemove = (file) => {
  53402. emit("remove", file);
  53403. };
  53404. return (_ctx, _cache) => {
  53405. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  53406. tag: "ul",
  53407. class: vue.normalizeClass(vue.unref(containerKls)),
  53408. name: vue.unref(nsList).b()
  53409. }, {
  53410. default: vue.withCtx(() => [
  53411. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file, index) => {
  53412. return vue.openBlock(), vue.createElementBlock("li", {
  53413. key: file.uid || file.name,
  53414. class: vue.normalizeClass([
  53415. vue.unref(nsUpload).be("list", "item"),
  53416. vue.unref(nsUpload).is(file.status),
  53417. { focusing: focusing.value }
  53418. ]),
  53419. tabindex: "0",
  53420. onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]),
  53421. onFocus: ($event) => focusing.value = true,
  53422. onBlur: ($event) => focusing.value = false,
  53423. onClick: ($event) => focusing.value = false
  53424. }, [
  53425. vue.renderSlot(_ctx.$slots, "default", {
  53426. file,
  53427. index
  53428. }, () => [
  53429. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  53430. key: 0,
  53431. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  53432. src: file.url,
  53433. crossorigin: _ctx.crossorigin,
  53434. alt: ""
  53435. }, null, 10, ["src", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  53436. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  53437. key: 1,
  53438. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  53439. }, [
  53440. vue.createElementVNode("a", {
  53441. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  53442. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  53443. }, [
  53444. vue.createVNode(vue.unref(ElIcon), {
  53445. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  53446. }, {
  53447. default: vue.withCtx(() => [
  53448. vue.createVNode(vue.unref(document_default))
  53449. ]),
  53450. _: 1
  53451. }, 8, ["class"]),
  53452. vue.createElementVNode("span", {
  53453. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name")),
  53454. title: file.name
  53455. }, vue.toDisplayString(file.name), 11, ["title"])
  53456. ], 10, ["onClick"]),
  53457. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  53458. key: 0,
  53459. type: _ctx.listType === "picture-card" ? "circle" : "line",
  53460. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  53461. percentage: Number(file.percentage),
  53462. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  53463. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  53464. ], 2)) : vue.createCommentVNode("v-if", true),
  53465. vue.createElementVNode("label", {
  53466. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  53467. }, [
  53468. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53469. key: 0,
  53470. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  53471. }, {
  53472. default: vue.withCtx(() => [
  53473. vue.createVNode(vue.unref(circle_check_default))
  53474. ]),
  53475. _: 1
  53476. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53477. key: 1,
  53478. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  53479. }, {
  53480. default: vue.withCtx(() => [
  53481. vue.createVNode(vue.unref(check_default))
  53482. ]),
  53483. _: 1
  53484. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  53485. ], 2),
  53486. !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53487. key: 2,
  53488. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  53489. onClick: ($event) => handleRemove(file)
  53490. }, {
  53491. default: vue.withCtx(() => [
  53492. vue.createVNode(vue.unref(close_default))
  53493. ]),
  53494. _: 2
  53495. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  53496. 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"),
  53497. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  53498. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  53499. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", {
  53500. key: 3,
  53501. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  53502. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  53503. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  53504. key: 4,
  53505. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  53506. }, [
  53507. vue.createElementVNode("span", {
  53508. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  53509. onClick: ($event) => _ctx.handlePreview(file)
  53510. }, [
  53511. vue.createVNode(vue.unref(ElIcon), {
  53512. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  53513. }, {
  53514. default: vue.withCtx(() => [
  53515. vue.createVNode(vue.unref(zoom_in_default))
  53516. ]),
  53517. _: 1
  53518. }, 8, ["class"])
  53519. ], 10, ["onClick"]),
  53520. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", {
  53521. key: 0,
  53522. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  53523. onClick: ($event) => handleRemove(file)
  53524. }, [
  53525. vue.createVNode(vue.unref(ElIcon), {
  53526. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  53527. }, {
  53528. default: vue.withCtx(() => [
  53529. vue.createVNode(vue.unref(delete_default))
  53530. ]),
  53531. _: 1
  53532. }, 8, ["class"])
  53533. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  53534. ], 2)) : vue.createCommentVNode("v-if", true)
  53535. ])
  53536. ], 42, ["onKeydown", "onFocus", "onBlur", "onClick"]);
  53537. }), 128)),
  53538. vue.renderSlot(_ctx.$slots, "append")
  53539. ]),
  53540. _: 3
  53541. }, 8, ["class", "name"]);
  53542. };
  53543. }
  53544. });
  53545. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "upload-list.vue"]]);
  53546. const uploadDraggerProps = buildProps({
  53547. disabled: {
  53548. type: Boolean,
  53549. default: false
  53550. }
  53551. });
  53552. const uploadDraggerEmits = {
  53553. file: (file) => isArray$1(file)
  53554. };
  53555. const COMPONENT_NAME = "ElUploadDrag";
  53556. const __default__$e = vue.defineComponent({
  53557. name: COMPONENT_NAME
  53558. });
  53559. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  53560. ...__default__$e,
  53561. props: uploadDraggerProps,
  53562. emits: uploadDraggerEmits,
  53563. setup(__props, { emit }) {
  53564. const uploaderContext = vue.inject(uploadContextKey);
  53565. if (!uploaderContext) {
  53566. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  53567. }
  53568. const ns = useNamespace("upload");
  53569. const dragover = vue.ref(false);
  53570. const disabled = useFormDisabled();
  53571. const onDrop = (e) => {
  53572. if (disabled.value)
  53573. return;
  53574. dragover.value = false;
  53575. e.stopPropagation();
  53576. const files = Array.from(e.dataTransfer.files);
  53577. emit("file", files);
  53578. };
  53579. const onDragover = () => {
  53580. if (!disabled.value)
  53581. dragover.value = true;
  53582. };
  53583. return (_ctx, _cache) => {
  53584. return vue.openBlock(), vue.createElementBlock("div", {
  53585. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  53586. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  53587. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  53588. onDragleave: vue.withModifiers(($event) => dragover.value = false, ["prevent"])
  53589. }, [
  53590. vue.renderSlot(_ctx.$slots, "default")
  53591. ], 42, ["onDrop", "onDragover", "onDragleave"]);
  53592. };
  53593. }
  53594. });
  53595. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "upload-dragger.vue"]]);
  53596. const uploadContentProps = buildProps({
  53597. ...uploadBaseProps,
  53598. beforeUpload: {
  53599. type: definePropType(Function),
  53600. default: NOOP
  53601. },
  53602. onRemove: {
  53603. type: definePropType(Function),
  53604. default: NOOP
  53605. },
  53606. onStart: {
  53607. type: definePropType(Function),
  53608. default: NOOP
  53609. },
  53610. onSuccess: {
  53611. type: definePropType(Function),
  53612. default: NOOP
  53613. },
  53614. onProgress: {
  53615. type: definePropType(Function),
  53616. default: NOOP
  53617. },
  53618. onError: {
  53619. type: definePropType(Function),
  53620. default: NOOP
  53621. },
  53622. onExceed: {
  53623. type: definePropType(Function),
  53624. default: NOOP
  53625. }
  53626. });
  53627. const __default__$d = vue.defineComponent({
  53628. name: "ElUploadContent",
  53629. inheritAttrs: false
  53630. });
  53631. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  53632. ...__default__$d,
  53633. props: uploadContentProps,
  53634. setup(__props, { expose }) {
  53635. const props = __props;
  53636. const ns = useNamespace("upload");
  53637. const disabled = useFormDisabled();
  53638. const requests = vue.shallowRef({});
  53639. const inputRef = vue.shallowRef();
  53640. const uploadFiles = (files) => {
  53641. if (files.length === 0)
  53642. return;
  53643. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  53644. if (limit && fileList.length + files.length > limit) {
  53645. onExceed(files, fileList);
  53646. return;
  53647. }
  53648. if (!multiple) {
  53649. files = files.slice(0, 1);
  53650. }
  53651. for (const file of files) {
  53652. const rawFile = file;
  53653. rawFile.uid = genFileId();
  53654. onStart(rawFile);
  53655. if (autoUpload)
  53656. upload(rawFile);
  53657. }
  53658. };
  53659. const upload = async (rawFile) => {
  53660. inputRef.value.value = "";
  53661. if (!props.beforeUpload) {
  53662. return doUpload(rawFile);
  53663. }
  53664. let hookResult;
  53665. let beforeData = {};
  53666. try {
  53667. const originData = props.data;
  53668. const beforeUploadPromise = props.beforeUpload(rawFile);
  53669. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  53670. hookResult = await beforeUploadPromise;
  53671. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  53672. beforeData = cloneDeep(props.data);
  53673. }
  53674. } catch (e) {
  53675. hookResult = false;
  53676. }
  53677. if (hookResult === false) {
  53678. props.onRemove(rawFile);
  53679. return;
  53680. }
  53681. let file = rawFile;
  53682. if (hookResult instanceof Blob) {
  53683. if (hookResult instanceof File) {
  53684. file = hookResult;
  53685. } else {
  53686. file = new File([hookResult], rawFile.name, {
  53687. type: rawFile.type
  53688. });
  53689. }
  53690. }
  53691. doUpload(Object.assign(file, {
  53692. uid: rawFile.uid
  53693. }), beforeData);
  53694. };
  53695. const resolveData = async (data, rawFile) => {
  53696. if (isFunction$1(data)) {
  53697. return data(rawFile);
  53698. }
  53699. return data;
  53700. };
  53701. const doUpload = async (rawFile, beforeData) => {
  53702. const {
  53703. headers,
  53704. data,
  53705. method,
  53706. withCredentials,
  53707. name: filename,
  53708. action,
  53709. onProgress,
  53710. onSuccess,
  53711. onError,
  53712. httpRequest
  53713. } = props;
  53714. try {
  53715. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  53716. } catch (e) {
  53717. props.onRemove(rawFile);
  53718. return;
  53719. }
  53720. const { uid } = rawFile;
  53721. const options = {
  53722. headers: headers || {},
  53723. withCredentials,
  53724. file: rawFile,
  53725. data: beforeData,
  53726. method,
  53727. filename,
  53728. action,
  53729. onProgress: (evt) => {
  53730. onProgress(evt, rawFile);
  53731. },
  53732. onSuccess: (res) => {
  53733. onSuccess(res, rawFile);
  53734. delete requests.value[uid];
  53735. },
  53736. onError: (err) => {
  53737. onError(err, rawFile);
  53738. delete requests.value[uid];
  53739. }
  53740. };
  53741. const request = httpRequest(options);
  53742. requests.value[uid] = request;
  53743. if (request instanceof Promise) {
  53744. request.then(options.onSuccess, options.onError);
  53745. }
  53746. };
  53747. const handleChange = (e) => {
  53748. const files = e.target.files;
  53749. if (!files)
  53750. return;
  53751. uploadFiles(Array.from(files));
  53752. };
  53753. const handleClick = () => {
  53754. if (!disabled.value) {
  53755. inputRef.value.value = "";
  53756. inputRef.value.click();
  53757. }
  53758. };
  53759. const handleKeydown = () => {
  53760. handleClick();
  53761. };
  53762. const abort = (file) => {
  53763. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  53764. _reqs.forEach(([uid, req]) => {
  53765. if (req instanceof XMLHttpRequest)
  53766. req.abort();
  53767. delete requests.value[uid];
  53768. });
  53769. };
  53770. expose({
  53771. abort,
  53772. upload
  53773. });
  53774. return (_ctx, _cache) => {
  53775. return vue.openBlock(), vue.createElementBlock("div", {
  53776. class: vue.normalizeClass([
  53777. vue.unref(ns).b(),
  53778. vue.unref(ns).m(_ctx.listType),
  53779. vue.unref(ns).is("drag", _ctx.drag),
  53780. vue.unref(ns).is("disabled", vue.unref(disabled))
  53781. ]),
  53782. tabindex: vue.unref(disabled) ? "-1" : "0",
  53783. onClick: handleClick,
  53784. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  53785. }, [
  53786. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  53787. key: 0,
  53788. disabled: vue.unref(disabled),
  53789. onFile: uploadFiles
  53790. }, {
  53791. default: vue.withCtx(() => [
  53792. vue.renderSlot(_ctx.$slots, "default")
  53793. ]),
  53794. _: 3
  53795. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  53796. vue.createElementVNode("input", {
  53797. ref_key: "inputRef",
  53798. ref: inputRef,
  53799. class: vue.normalizeClass(vue.unref(ns).e("input")),
  53800. name: _ctx.name,
  53801. disabled: vue.unref(disabled),
  53802. multiple: _ctx.multiple,
  53803. accept: _ctx.accept,
  53804. type: "file",
  53805. onChange: handleChange,
  53806. onClick: vue.withModifiers(() => {
  53807. }, ["stop"])
  53808. }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
  53809. ], 42, ["tabindex", "onKeydown"]);
  53810. };
  53811. }
  53812. });
  53813. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "upload-content.vue"]]);
  53814. const SCOPE$1 = "ElUpload";
  53815. const revokeFileObjectURL = (file) => {
  53816. var _a;
  53817. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  53818. URL.revokeObjectURL(file.url);
  53819. }
  53820. };
  53821. const useHandlers = (props, uploadRef) => {
  53822. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  53823. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  53824. function abort(file) {
  53825. var _a;
  53826. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  53827. }
  53828. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  53829. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  53830. }
  53831. function removeFile(file) {
  53832. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile !== file);
  53833. }
  53834. const handleError = (err, rawFile) => {
  53835. const file = getFile(rawFile);
  53836. if (!file)
  53837. return;
  53838. console.error(err);
  53839. file.status = "fail";
  53840. removeFile(file);
  53841. props.onError(err, file, uploadFiles.value);
  53842. props.onChange(file, uploadFiles.value);
  53843. };
  53844. const handleProgress = (evt, rawFile) => {
  53845. const file = getFile(rawFile);
  53846. if (!file)
  53847. return;
  53848. props.onProgress(evt, file, uploadFiles.value);
  53849. file.status = "uploading";
  53850. file.percentage = Math.round(evt.percent);
  53851. };
  53852. const handleSuccess = (response, rawFile) => {
  53853. const file = getFile(rawFile);
  53854. if (!file)
  53855. return;
  53856. file.status = "success";
  53857. file.response = response;
  53858. props.onSuccess(response, file, uploadFiles.value);
  53859. props.onChange(file, uploadFiles.value);
  53860. };
  53861. const handleStart = (file) => {
  53862. if (isNil(file.uid))
  53863. file.uid = genFileId();
  53864. const uploadFile = {
  53865. name: file.name,
  53866. percentage: 0,
  53867. status: "ready",
  53868. size: file.size,
  53869. raw: file,
  53870. uid: file.uid
  53871. };
  53872. if (props.listType === "picture-card" || props.listType === "picture") {
  53873. try {
  53874. uploadFile.url = URL.createObjectURL(file);
  53875. } catch (err) {
  53876. debugWarn(SCOPE$1, err.message);
  53877. props.onError(err, uploadFile, uploadFiles.value);
  53878. }
  53879. }
  53880. uploadFiles.value = [...uploadFiles.value, uploadFile];
  53881. props.onChange(uploadFile, uploadFiles.value);
  53882. };
  53883. const handleRemove = async (file) => {
  53884. const uploadFile = file instanceof File ? getFile(file) : file;
  53885. if (!uploadFile)
  53886. throwError(SCOPE$1, "file to be removed not found");
  53887. const doRemove = (file2) => {
  53888. abort(file2);
  53889. removeFile(file2);
  53890. props.onRemove(file2, uploadFiles.value);
  53891. revokeFileObjectURL(file2);
  53892. };
  53893. if (props.beforeRemove) {
  53894. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  53895. if (before !== false)
  53896. doRemove(uploadFile);
  53897. } else {
  53898. doRemove(uploadFile);
  53899. }
  53900. };
  53901. function submit() {
  53902. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  53903. var _a;
  53904. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  53905. });
  53906. }
  53907. vue.watch(() => props.listType, (val) => {
  53908. if (val !== "picture-card" && val !== "picture") {
  53909. return;
  53910. }
  53911. uploadFiles.value = uploadFiles.value.map((file) => {
  53912. const { raw, url } = file;
  53913. if (!url && raw) {
  53914. try {
  53915. file.url = URL.createObjectURL(raw);
  53916. } catch (err) {
  53917. props.onError(err, file, uploadFiles.value);
  53918. }
  53919. }
  53920. return file;
  53921. });
  53922. });
  53923. vue.watch(uploadFiles, (files) => {
  53924. for (const file of files) {
  53925. file.uid || (file.uid = genFileId());
  53926. file.status || (file.status = "success");
  53927. }
  53928. }, { immediate: true, deep: true });
  53929. return {
  53930. uploadFiles,
  53931. abort,
  53932. clearFiles,
  53933. handleError,
  53934. handleProgress,
  53935. handleStart,
  53936. handleSuccess,
  53937. handleRemove,
  53938. submit,
  53939. revokeFileObjectURL
  53940. };
  53941. };
  53942. const __default__$c = vue.defineComponent({
  53943. name: "ElUpload"
  53944. });
  53945. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  53946. ...__default__$c,
  53947. props: uploadProps,
  53948. setup(__props, { expose }) {
  53949. const props = __props;
  53950. const disabled = useFormDisabled();
  53951. const uploadRef = vue.shallowRef();
  53952. const {
  53953. abort,
  53954. submit,
  53955. clearFiles,
  53956. uploadFiles,
  53957. handleStart,
  53958. handleError,
  53959. handleRemove,
  53960. handleSuccess,
  53961. handleProgress,
  53962. revokeFileObjectURL
  53963. } = useHandlers(props, uploadRef);
  53964. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  53965. const uploadContentProps = vue.computed(() => ({
  53966. ...props,
  53967. fileList: uploadFiles.value,
  53968. onStart: handleStart,
  53969. onProgress: handleProgress,
  53970. onSuccess: handleSuccess,
  53971. onError: handleError,
  53972. onRemove: handleRemove
  53973. }));
  53974. vue.onBeforeUnmount(() => {
  53975. uploadFiles.value.forEach(revokeFileObjectURL);
  53976. });
  53977. vue.provide(uploadContextKey, {
  53978. accept: vue.toRef(props, "accept")
  53979. });
  53980. expose({
  53981. abort,
  53982. submit,
  53983. clearFiles,
  53984. handleStart,
  53985. handleRemove
  53986. });
  53987. return (_ctx, _cache) => {
  53988. return vue.openBlock(), vue.createElementBlock("div", null, [
  53989. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  53990. key: 0,
  53991. disabled: vue.unref(disabled),
  53992. "list-type": _ctx.listType,
  53993. files: vue.unref(uploadFiles),
  53994. crossorigin: _ctx.crossorigin,
  53995. "handle-preview": _ctx.onPreview,
  53996. onRemove: vue.unref(handleRemove)
  53997. }, vue.createSlots({
  53998. append: vue.withCtx(() => [
  53999. vue.createVNode(UploadContent, vue.mergeProps({
  54000. ref_key: "uploadRef",
  54001. ref: uploadRef
  54002. }, vue.unref(uploadContentProps)), {
  54003. default: vue.withCtx(() => [
  54004. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  54005. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  54006. ]),
  54007. _: 3
  54008. }, 16)
  54009. ]),
  54010. _: 2
  54011. }, [
  54012. _ctx.$slots.file ? {
  54013. name: "default",
  54014. fn: vue.withCtx(({ file, index }) => [
  54015. vue.renderSlot(_ctx.$slots, "file", {
  54016. file,
  54017. index
  54018. })
  54019. ])
  54020. } : void 0
  54021. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  54022. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  54023. key: 1,
  54024. ref_key: "uploadRef",
  54025. ref: uploadRef
  54026. }, vue.unref(uploadContentProps)), {
  54027. default: vue.withCtx(() => [
  54028. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  54029. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  54030. ]),
  54031. _: 3
  54032. }, 16)) : vue.createCommentVNode("v-if", true),
  54033. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  54034. vue.renderSlot(_ctx.$slots, "tip"),
  54035. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  54036. key: 3,
  54037. disabled: vue.unref(disabled),
  54038. "list-type": _ctx.listType,
  54039. files: vue.unref(uploadFiles),
  54040. crossorigin: _ctx.crossorigin,
  54041. "handle-preview": _ctx.onPreview,
  54042. onRemove: vue.unref(handleRemove)
  54043. }, vue.createSlots({ _: 2 }, [
  54044. _ctx.$slots.file ? {
  54045. name: "default",
  54046. fn: vue.withCtx(({ file, index }) => [
  54047. vue.renderSlot(_ctx.$slots, "file", {
  54048. file,
  54049. index
  54050. })
  54051. ])
  54052. } : void 0
  54053. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  54054. ]);
  54055. };
  54056. }
  54057. });
  54058. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "upload.vue"]]);
  54059. const ElUpload = withInstall(Upload);
  54060. const watermarkProps = buildProps({
  54061. zIndex: {
  54062. type: Number,
  54063. default: 9
  54064. },
  54065. rotate: {
  54066. type: Number,
  54067. default: -22
  54068. },
  54069. width: Number,
  54070. height: Number,
  54071. image: String,
  54072. content: {
  54073. type: definePropType([String, Array]),
  54074. default: "Element Plus"
  54075. },
  54076. font: {
  54077. type: definePropType(Object)
  54078. },
  54079. gap: {
  54080. type: definePropType(Array),
  54081. default: () => [100, 100]
  54082. },
  54083. offset: {
  54084. type: definePropType(Array)
  54085. }
  54086. });
  54087. function toLowercaseSeparator(key) {
  54088. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  54089. }
  54090. function getStyleStr(style) {
  54091. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  54092. }
  54093. function getPixelRatio() {
  54094. return window.devicePixelRatio || 1;
  54095. }
  54096. const reRendering = (mutation, watermarkElement) => {
  54097. let flag = false;
  54098. if (mutation.removedNodes.length && watermarkElement) {
  54099. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  54100. }
  54101. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  54102. flag = true;
  54103. }
  54104. return flag;
  54105. };
  54106. const FontGap = 3;
  54107. function prepareCanvas(width, height, ratio = 1) {
  54108. const canvas = document.createElement("canvas");
  54109. const ctx = canvas.getContext("2d");
  54110. const realWidth = width * ratio;
  54111. const realHeight = height * ratio;
  54112. canvas.setAttribute("width", `${realWidth}px`);
  54113. canvas.setAttribute("height", `${realHeight}px`);
  54114. ctx.save();
  54115. return [ctx, canvas, realWidth, realHeight];
  54116. }
  54117. function useClips() {
  54118. function getClips(content, rotate, ratio, width, height, font, gapX, gapY) {
  54119. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  54120. if (content instanceof HTMLImageElement) {
  54121. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  54122. } else {
  54123. const {
  54124. color,
  54125. fontSize,
  54126. fontStyle,
  54127. fontWeight,
  54128. fontFamily,
  54129. textAlign,
  54130. textBaseline
  54131. } = font;
  54132. const mergedFontSize = Number(fontSize) * ratio;
  54133. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  54134. ctx.fillStyle = color;
  54135. ctx.textAlign = textAlign;
  54136. ctx.textBaseline = textBaseline;
  54137. const contents = Array.isArray(content) ? content : [content];
  54138. contents == null ? void 0 : contents.forEach((item, index) => {
  54139. ctx.fillText(item != null ? item : "", contentWidth / 2, index * (mergedFontSize + FontGap * ratio));
  54140. });
  54141. }
  54142. const angle = Math.PI / 180 * Number(rotate);
  54143. const maxSize = Math.max(width, height);
  54144. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  54145. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  54146. rCtx.rotate(angle);
  54147. if (contentWidth > 0 && contentHeight > 0) {
  54148. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  54149. }
  54150. function getRotatePos(x, y) {
  54151. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  54152. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  54153. return [targetX, targetY];
  54154. }
  54155. let left = 0;
  54156. let right = 0;
  54157. let top = 0;
  54158. let bottom = 0;
  54159. const halfWidth = contentWidth / 2;
  54160. const halfHeight = contentHeight / 2;
  54161. const points = [
  54162. [0 - halfWidth, 0 - halfHeight],
  54163. [0 + halfWidth, 0 - halfHeight],
  54164. [0 + halfWidth, 0 + halfHeight],
  54165. [0 - halfWidth, 0 + halfHeight]
  54166. ];
  54167. points.forEach(([x, y]) => {
  54168. const [targetX, targetY] = getRotatePos(x, y);
  54169. left = Math.min(left, targetX);
  54170. right = Math.max(right, targetX);
  54171. top = Math.min(top, targetY);
  54172. bottom = Math.max(bottom, targetY);
  54173. });
  54174. const cutLeft = left + realMaxSize / 2;
  54175. const cutTop = top + realMaxSize / 2;
  54176. const cutWidth = right - left;
  54177. const cutHeight = bottom - top;
  54178. const realGapX = gapX * ratio;
  54179. const realGapY = gapY * ratio;
  54180. const filledWidth = (cutWidth + realGapX) * 2;
  54181. const filledHeight = cutHeight + realGapY;
  54182. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  54183. function drawImg(targetX = 0, targetY = 0) {
  54184. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  54185. }
  54186. drawImg();
  54187. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  54188. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  54189. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  54190. }
  54191. return getClips;
  54192. }
  54193. const __default__$b = vue.defineComponent({
  54194. name: "ElWatermark"
  54195. });
  54196. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  54197. ...__default__$b,
  54198. props: watermarkProps,
  54199. setup(__props) {
  54200. const props = __props;
  54201. const style = {
  54202. position: "relative"
  54203. };
  54204. const color = vue.computed(() => {
  54205. var _a, _b;
  54206. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  54207. });
  54208. const fontSize = vue.computed(() => {
  54209. var _a, _b;
  54210. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  54211. });
  54212. const fontWeight = vue.computed(() => {
  54213. var _a, _b;
  54214. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  54215. });
  54216. const fontStyle = vue.computed(() => {
  54217. var _a, _b;
  54218. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  54219. });
  54220. const fontFamily = vue.computed(() => {
  54221. var _a, _b;
  54222. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  54223. });
  54224. const textAlign = vue.computed(() => {
  54225. var _a, _b;
  54226. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  54227. });
  54228. const textBaseline = vue.computed(() => {
  54229. var _a, _b;
  54230. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  54231. });
  54232. const gapX = vue.computed(() => props.gap[0]);
  54233. const gapY = vue.computed(() => props.gap[1]);
  54234. const gapXCenter = vue.computed(() => gapX.value / 2);
  54235. const gapYCenter = vue.computed(() => gapY.value / 2);
  54236. const offsetLeft = vue.computed(() => {
  54237. var _a, _b;
  54238. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  54239. });
  54240. const offsetTop = vue.computed(() => {
  54241. var _a, _b;
  54242. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  54243. });
  54244. const getMarkStyle = () => {
  54245. const markStyle = {
  54246. zIndex: props.zIndex,
  54247. position: "absolute",
  54248. left: 0,
  54249. top: 0,
  54250. width: "100%",
  54251. height: "100%",
  54252. pointerEvents: "none",
  54253. backgroundRepeat: "repeat"
  54254. };
  54255. let positionLeft = offsetLeft.value - gapXCenter.value;
  54256. let positionTop = offsetTop.value - gapYCenter.value;
  54257. if (positionLeft > 0) {
  54258. markStyle.left = `${positionLeft}px`;
  54259. markStyle.width = `calc(100% - ${positionLeft}px)`;
  54260. positionLeft = 0;
  54261. }
  54262. if (positionTop > 0) {
  54263. markStyle.top = `${positionTop}px`;
  54264. markStyle.height = `calc(100% - ${positionTop}px)`;
  54265. positionTop = 0;
  54266. }
  54267. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  54268. return markStyle;
  54269. };
  54270. const containerRef = vue.shallowRef(null);
  54271. const watermarkRef = vue.shallowRef();
  54272. const stopObservation = vue.ref(false);
  54273. const destroyWatermark = () => {
  54274. if (watermarkRef.value) {
  54275. watermarkRef.value.remove();
  54276. watermarkRef.value = void 0;
  54277. }
  54278. };
  54279. const appendWatermark = (base64Url, markWidth) => {
  54280. var _a;
  54281. if (containerRef.value && watermarkRef.value) {
  54282. stopObservation.value = true;
  54283. watermarkRef.value.setAttribute("style", getStyleStr({
  54284. ...getMarkStyle(),
  54285. backgroundImage: `url('${base64Url}')`,
  54286. backgroundSize: `${Math.floor(markWidth)}px`
  54287. }));
  54288. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  54289. setTimeout(() => {
  54290. stopObservation.value = false;
  54291. });
  54292. }
  54293. };
  54294. const getMarkSize = (ctx) => {
  54295. let defaultWidth = 120;
  54296. let defaultHeight = 64;
  54297. const image = props.image;
  54298. const content = props.content;
  54299. const width = props.width;
  54300. const height = props.height;
  54301. if (!image && ctx.measureText) {
  54302. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  54303. const contents = Array.isArray(content) ? content : [content];
  54304. const sizes = contents.map((item) => {
  54305. const metrics = ctx.measureText(item);
  54306. return [
  54307. metrics.width,
  54308. metrics.fontBoundingBoxAscent !== void 0 ? metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent : metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent
  54309. ];
  54310. });
  54311. defaultWidth = Math.ceil(Math.max(...sizes.map((size) => size[0])));
  54312. defaultHeight = Math.ceil(Math.max(...sizes.map((size) => size[1]))) * contents.length + (contents.length - 1) * FontGap;
  54313. }
  54314. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
  54315. };
  54316. const getClips = useClips();
  54317. const renderWatermark = () => {
  54318. const canvas = document.createElement("canvas");
  54319. const ctx = canvas.getContext("2d");
  54320. const image = props.image;
  54321. const content = props.content;
  54322. const rotate = props.rotate;
  54323. if (ctx) {
  54324. if (!watermarkRef.value) {
  54325. watermarkRef.value = document.createElement("div");
  54326. }
  54327. const ratio = getPixelRatio();
  54328. const [markWidth, markHeight] = getMarkSize(ctx);
  54329. const drawCanvas = (drawContent) => {
  54330. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  54331. color: color.value,
  54332. fontSize: fontSize.value,
  54333. fontStyle: fontStyle.value,
  54334. fontWeight: fontWeight.value,
  54335. fontFamily: fontFamily.value,
  54336. textAlign: textAlign.value,
  54337. textBaseline: textBaseline.value
  54338. }, gapX.value, gapY.value);
  54339. appendWatermark(textClips, clipWidth);
  54340. };
  54341. if (image) {
  54342. const img = new Image();
  54343. img.onload = () => {
  54344. drawCanvas(img);
  54345. };
  54346. img.onerror = () => {
  54347. drawCanvas(content);
  54348. };
  54349. img.crossOrigin = "anonymous";
  54350. img.referrerPolicy = "no-referrer";
  54351. img.src = image;
  54352. } else {
  54353. drawCanvas(content);
  54354. }
  54355. }
  54356. };
  54357. vue.onMounted(() => {
  54358. renderWatermark();
  54359. });
  54360. vue.watch(() => props, () => {
  54361. renderWatermark();
  54362. }, {
  54363. deep: true,
  54364. flush: "post"
  54365. });
  54366. vue.onBeforeUnmount(() => {
  54367. destroyWatermark();
  54368. });
  54369. const onMutate = (mutations) => {
  54370. if (stopObservation.value) {
  54371. return;
  54372. }
  54373. mutations.forEach((mutation) => {
  54374. if (reRendering(mutation, watermarkRef.value)) {
  54375. destroyWatermark();
  54376. renderWatermark();
  54377. }
  54378. });
  54379. };
  54380. useMutationObserver(containerRef, onMutate, {
  54381. attributes: true,
  54382. subtree: true,
  54383. childList: true
  54384. });
  54385. return (_ctx, _cache) => {
  54386. return vue.openBlock(), vue.createElementBlock("div", {
  54387. ref_key: "containerRef",
  54388. ref: containerRef,
  54389. style: vue.normalizeStyle([style])
  54390. }, [
  54391. vue.renderSlot(_ctx.$slots, "default")
  54392. ], 4);
  54393. };
  54394. }
  54395. });
  54396. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "watermark.vue"]]);
  54397. const ElWatermark = withInstall(Watermark);
  54398. const maskProps = buildProps({
  54399. zIndex: {
  54400. type: Number,
  54401. default: 1001
  54402. },
  54403. visible: Boolean,
  54404. fill: {
  54405. type: String,
  54406. default: "rgba(0,0,0,0.5)"
  54407. },
  54408. pos: {
  54409. type: definePropType(Object)
  54410. },
  54411. targetAreaClickable: {
  54412. type: Boolean,
  54413. default: true
  54414. }
  54415. });
  54416. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  54417. const posInfo = vue.ref(null);
  54418. const getTargetEl = () => {
  54419. let targetEl;
  54420. if (isString$1(target.value)) {
  54421. targetEl = document.querySelector(target.value);
  54422. } else if (isFunction$1(target.value)) {
  54423. targetEl = target.value();
  54424. } else {
  54425. targetEl = target.value;
  54426. }
  54427. return targetEl;
  54428. };
  54429. const updatePosInfo = () => {
  54430. const targetEl = getTargetEl();
  54431. if (!targetEl || !open.value) {
  54432. posInfo.value = null;
  54433. return;
  54434. }
  54435. if (!isInViewPort(targetEl) && open.value) {
  54436. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  54437. }
  54438. const { left, top, width, height } = targetEl.getBoundingClientRect();
  54439. posInfo.value = {
  54440. left,
  54441. top,
  54442. width,
  54443. height,
  54444. radius: 0
  54445. };
  54446. };
  54447. vue.onMounted(() => {
  54448. vue.watch([open, target], () => {
  54449. updatePosInfo();
  54450. }, {
  54451. immediate: true
  54452. });
  54453. window.addEventListener("resize", updatePosInfo);
  54454. });
  54455. vue.onBeforeUnmount(() => {
  54456. window.removeEventListener("resize", updatePosInfo);
  54457. });
  54458. const getGapOffset = (index) => {
  54459. var _a;
  54460. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  54461. };
  54462. const mergedPosInfo = vue.computed(() => {
  54463. var _a;
  54464. if (!posInfo.value)
  54465. return posInfo.value;
  54466. const gapOffsetX = getGapOffset(0);
  54467. const gapOffsetY = getGapOffset(1);
  54468. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  54469. return {
  54470. left: posInfo.value.left - gapOffsetX,
  54471. top: posInfo.value.top - gapOffsetY,
  54472. width: posInfo.value.width + gapOffsetX * 2,
  54473. height: posInfo.value.height + gapOffsetY * 2,
  54474. radius: gapRadius
  54475. };
  54476. });
  54477. const triggerTarget = vue.computed(() => {
  54478. const targetEl = getTargetEl();
  54479. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  54480. return targetEl || void 0;
  54481. }
  54482. return {
  54483. getBoundingClientRect() {
  54484. var _a, _b, _c, _d;
  54485. return window.DOMRect.fromRect({
  54486. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  54487. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  54488. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  54489. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  54490. });
  54491. }
  54492. };
  54493. });
  54494. return {
  54495. mergedPosInfo,
  54496. triggerTarget
  54497. };
  54498. };
  54499. const tourKey = Symbol("ElTour");
  54500. function isInViewPort(element) {
  54501. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  54502. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  54503. const { top, right, bottom, left } = element.getBoundingClientRect();
  54504. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  54505. }
  54506. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  54507. const x = vue.ref();
  54508. const y = vue.ref();
  54509. const middlewareData = vue.ref({});
  54510. const states = {
  54511. x,
  54512. y,
  54513. placement,
  54514. strategy,
  54515. middlewareData
  54516. };
  54517. const middleware = vue.computed(() => {
  54518. const _middleware = [
  54519. offset(vue.unref(offset$1)),
  54520. flip(),
  54521. shift(),
  54522. overflowMiddleware()
  54523. ];
  54524. if (vue.unref(showArrow) && vue.unref(arrowRef)) {
  54525. _middleware.push(arrow({
  54526. element: vue.unref(arrowRef)
  54527. }));
  54528. }
  54529. return _middleware;
  54530. });
  54531. const update = async () => {
  54532. if (!isClient)
  54533. return;
  54534. const referenceEl = vue.unref(referenceRef);
  54535. const contentEl = vue.unref(contentRef);
  54536. if (!referenceEl || !contentEl)
  54537. return;
  54538. const data = await computePosition(referenceEl, contentEl, {
  54539. placement: vue.unref(placement),
  54540. strategy: vue.unref(strategy),
  54541. middleware: vue.unref(middleware)
  54542. });
  54543. keysOf(states).forEach((key) => {
  54544. states[key].value = data[key];
  54545. });
  54546. };
  54547. const contentStyle = vue.computed(() => {
  54548. if (!vue.unref(referenceRef)) {
  54549. return {
  54550. position: "fixed",
  54551. top: "50%",
  54552. left: "50%",
  54553. transform: "translate3d(-50%, -50%, 0)",
  54554. maxWidth: "100vw",
  54555. zIndex: vue.unref(zIndex)
  54556. };
  54557. }
  54558. const { overflow } = vue.unref(middlewareData);
  54559. return {
  54560. position: vue.unref(strategy),
  54561. zIndex: vue.unref(zIndex),
  54562. top: vue.unref(y) != null ? `${vue.unref(y)}px` : "",
  54563. left: vue.unref(x) != null ? `${vue.unref(x)}px` : "",
  54564. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  54565. };
  54566. });
  54567. const arrowStyle = vue.computed(() => {
  54568. if (!vue.unref(showArrow))
  54569. return {};
  54570. const { arrow: arrow2 } = vue.unref(middlewareData);
  54571. return {
  54572. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  54573. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  54574. };
  54575. });
  54576. let cleanup;
  54577. vue.onMounted(() => {
  54578. const referenceEl = vue.unref(referenceRef);
  54579. const contentEl = vue.unref(contentRef);
  54580. if (referenceEl && contentEl) {
  54581. cleanup = autoUpdate(referenceEl, contentEl, update);
  54582. }
  54583. vue.watchEffect(() => {
  54584. update();
  54585. });
  54586. });
  54587. vue.onBeforeUnmount(() => {
  54588. cleanup && cleanup();
  54589. });
  54590. return {
  54591. update,
  54592. contentStyle,
  54593. arrowStyle
  54594. };
  54595. };
  54596. const overflowMiddleware = () => {
  54597. return {
  54598. name: "overflow",
  54599. async fn(state) {
  54600. const overflow = await detectOverflow(state);
  54601. let overWidth = 0;
  54602. if (overflow.left > 0)
  54603. overWidth = overflow.left;
  54604. if (overflow.right > 0)
  54605. overWidth = overflow.right;
  54606. const floatingWidth = state.rects.floating.width;
  54607. return {
  54608. data: {
  54609. maxWidth: floatingWidth - overWidth
  54610. }
  54611. };
  54612. }
  54613. };
  54614. };
  54615. const __default__$a = vue.defineComponent({
  54616. name: "ElTourMask",
  54617. inheritAttrs: false
  54618. });
  54619. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  54620. ...__default__$a,
  54621. props: maskProps,
  54622. setup(__props) {
  54623. const props = __props;
  54624. const { ns } = vue.inject(tourKey);
  54625. const radius = vue.computed(() => {
  54626. var _a, _b;
  54627. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  54628. });
  54629. const roundInfo = vue.computed(() => {
  54630. const v = radius.value;
  54631. const baseInfo = `a${v},${v} 0 0 1`;
  54632. return {
  54633. topRight: `${baseInfo} ${v},${v}`,
  54634. bottomRight: `${baseInfo} ${-v},${v}`,
  54635. bottomLeft: `${baseInfo} ${-v},${-v}`,
  54636. topLeft: `${baseInfo} ${v},${-v}`
  54637. };
  54638. });
  54639. const path = vue.computed(() => {
  54640. const width = window.innerWidth;
  54641. const height = window.innerHeight;
  54642. const info = roundInfo.value;
  54643. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  54644. const _radius = radius.value;
  54645. return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
  54646. });
  54647. const pathStyle = vue.computed(() => {
  54648. return {
  54649. fill: props.fill,
  54650. pointerEvents: "auto",
  54651. cursor: "auto"
  54652. };
  54653. });
  54654. useLockscreen(vue.toRef(props, "visible"), {
  54655. ns
  54656. });
  54657. return (_ctx, _cache) => {
  54658. return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  54659. key: 0,
  54660. class: vue.unref(ns).e("mask"),
  54661. style: {
  54662. position: "fixed",
  54663. left: 0,
  54664. right: 0,
  54665. top: 0,
  54666. bottom: 0,
  54667. zIndex: _ctx.zIndex,
  54668. pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
  54669. }
  54670. }, _ctx.$attrs), [
  54671. (vue.openBlock(), vue.createElementBlock("svg", { style: {
  54672. width: "100%",
  54673. height: "100%"
  54674. } }, [
  54675. vue.createElementVNode("path", {
  54676. class: vue.normalizeClass(vue.unref(ns).e("hollow")),
  54677. style: vue.normalizeStyle(vue.unref(pathStyle)),
  54678. d: vue.unref(path)
  54679. }, null, 14, ["d"])
  54680. ]))
  54681. ], 16)) : vue.createCommentVNode("v-if", true);
  54682. };
  54683. }
  54684. });
  54685. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "mask.vue"]]);
  54686. const tourStrategies = ["absolute", "fixed"];
  54687. const tourPlacements = [
  54688. "top-start",
  54689. "top-end",
  54690. "top",
  54691. "bottom-start",
  54692. "bottom-end",
  54693. "bottom",
  54694. "left-start",
  54695. "left-end",
  54696. "left",
  54697. "right-start",
  54698. "right-end",
  54699. "right"
  54700. ];
  54701. const tourContentProps = buildProps({
  54702. placement: {
  54703. type: definePropType(String),
  54704. values: tourPlacements,
  54705. default: "bottom"
  54706. },
  54707. reference: {
  54708. type: definePropType(Object),
  54709. default: null
  54710. },
  54711. strategy: {
  54712. type: definePropType(String),
  54713. values: tourStrategies,
  54714. default: "absolute"
  54715. },
  54716. offset: {
  54717. type: Number,
  54718. default: 10
  54719. },
  54720. showArrow: Boolean,
  54721. zIndex: {
  54722. type: Number,
  54723. default: 2001
  54724. }
  54725. });
  54726. const tourContentEmits = {
  54727. close: () => true
  54728. };
  54729. const __default__$9 = vue.defineComponent({
  54730. name: "ElTourContent"
  54731. });
  54732. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  54733. ...__default__$9,
  54734. props: tourContentProps,
  54735. emits: tourContentEmits,
  54736. setup(__props, { emit }) {
  54737. const props = __props;
  54738. const placement = vue.ref(props.placement);
  54739. const strategy = vue.ref(props.strategy);
  54740. const contentRef = vue.ref(null);
  54741. const arrowRef = vue.ref(null);
  54742. vue.watch(() => props.placement, () => {
  54743. placement.value = props.placement;
  54744. });
  54745. const { contentStyle, arrowStyle } = useFloating(vue.toRef(props, "reference"), contentRef, arrowRef, placement, strategy, vue.toRef(props, "offset"), vue.toRef(props, "zIndex"), vue.toRef(props, "showArrow"));
  54746. const side = vue.computed(() => {
  54747. return placement.value.split("-")[0];
  54748. });
  54749. const { ns } = vue.inject(tourKey);
  54750. const onCloseRequested = () => {
  54751. emit("close");
  54752. };
  54753. const onFocusoutPrevented = (event) => {
  54754. if (event.detail.focusReason === "pointer") {
  54755. event.preventDefault();
  54756. }
  54757. };
  54758. return (_ctx, _cache) => {
  54759. return vue.openBlock(), vue.createElementBlock("div", {
  54760. ref_key: "contentRef",
  54761. ref: contentRef,
  54762. style: vue.normalizeStyle(vue.unref(contentStyle)),
  54763. class: vue.normalizeClass(vue.unref(ns).e("content")),
  54764. "data-side": vue.unref(side),
  54765. tabindex: "-1"
  54766. }, [
  54767. vue.createVNode(vue.unref(ElFocusTrap), {
  54768. loop: "",
  54769. trapped: "",
  54770. "focus-start-el": "container",
  54771. "focus-trap-el": contentRef.value || void 0,
  54772. onReleaseRequested: onCloseRequested,
  54773. onFocusoutPrevented
  54774. }, {
  54775. default: vue.withCtx(() => [
  54776. vue.renderSlot(_ctx.$slots, "default")
  54777. ]),
  54778. _: 3
  54779. }, 8, ["focus-trap-el"]),
  54780. _ctx.showArrow ? (vue.openBlock(), vue.createElementBlock("span", {
  54781. key: 0,
  54782. ref_key: "arrowRef",
  54783. ref: arrowRef,
  54784. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  54785. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  54786. }, null, 6)) : vue.createCommentVNode("v-if", true)
  54787. ], 14, ["data-side"]);
  54788. };
  54789. }
  54790. });
  54791. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "content.vue"]]);
  54792. var ElTourSteps = vue.defineComponent({
  54793. name: "ElTourSteps",
  54794. props: {
  54795. current: {
  54796. type: Number,
  54797. default: 0
  54798. }
  54799. },
  54800. emits: ["update-total"],
  54801. setup(props, { slots, emit }) {
  54802. let cacheTotal = 0;
  54803. return () => {
  54804. var _a, _b;
  54805. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  54806. const result = [];
  54807. let total = 0;
  54808. function filterSteps(children2) {
  54809. if (!isArray$1(children2))
  54810. return;
  54811. children2.forEach((item) => {
  54812. var _a2;
  54813. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  54814. if (name === "ElTourStep") {
  54815. result.push(item);
  54816. total += 1;
  54817. }
  54818. });
  54819. }
  54820. if (children.length) {
  54821. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  54822. }
  54823. if (cacheTotal !== total) {
  54824. cacheTotal = total;
  54825. emit("update-total", total);
  54826. }
  54827. if (result.length) {
  54828. return result[props.current];
  54829. }
  54830. return null;
  54831. };
  54832. }
  54833. });
  54834. const tourProps = buildProps({
  54835. modelValue: Boolean,
  54836. current: {
  54837. type: Number,
  54838. default: 0
  54839. },
  54840. showArrow: {
  54841. type: Boolean,
  54842. default: true
  54843. },
  54844. showClose: {
  54845. type: Boolean,
  54846. default: true
  54847. },
  54848. closeIcon: {
  54849. type: iconPropType
  54850. },
  54851. placement: tourContentProps.placement,
  54852. contentStyle: {
  54853. type: definePropType([Object])
  54854. },
  54855. mask: {
  54856. type: definePropType([Boolean, Object]),
  54857. default: true
  54858. },
  54859. gap: {
  54860. type: definePropType(Object),
  54861. default: () => ({
  54862. offset: 6,
  54863. radius: 2
  54864. })
  54865. },
  54866. zIndex: {
  54867. type: Number
  54868. },
  54869. scrollIntoViewOptions: {
  54870. type: definePropType([Boolean, Object]),
  54871. default: () => ({
  54872. block: "center"
  54873. })
  54874. },
  54875. type: {
  54876. type: definePropType(String)
  54877. },
  54878. appendTo: {
  54879. type: definePropType([String, Object]),
  54880. default: "body"
  54881. },
  54882. closeOnPressEscape: {
  54883. type: Boolean,
  54884. default: true
  54885. },
  54886. targetAreaClickable: {
  54887. type: Boolean,
  54888. default: true
  54889. }
  54890. });
  54891. const tourEmits = {
  54892. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  54893. ["update:current"]: (current) => isNumber(current),
  54894. close: (current) => isNumber(current),
  54895. finish: () => true,
  54896. change: (current) => isNumber(current)
  54897. };
  54898. const __default__$8 = vue.defineComponent({
  54899. name: "ElTour"
  54900. });
  54901. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  54902. ...__default__$8,
  54903. props: tourProps,
  54904. emits: tourEmits,
  54905. setup(__props, { emit }) {
  54906. const props = __props;
  54907. const ns = useNamespace("tour");
  54908. const total = vue.ref(0);
  54909. const currentStep = vue.ref();
  54910. const current = useVModel(props, "current", emit, {
  54911. passive: true
  54912. });
  54913. const currentTarget = vue.computed(() => {
  54914. var _a;
  54915. return (_a = currentStep.value) == null ? void 0 : _a.target;
  54916. });
  54917. const kls = vue.computed(() => [
  54918. ns.b(),
  54919. mergedType.value === "primary" ? ns.m("primary") : ""
  54920. ]);
  54921. const mergedPlacement = vue.computed(() => {
  54922. var _a;
  54923. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  54924. });
  54925. const mergedContentStyle = vue.computed(() => {
  54926. var _a, _b;
  54927. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  54928. });
  54929. const mergedMask = vue.computed(() => {
  54930. var _a, _b;
  54931. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  54932. });
  54933. const mergedShowMask = vue.computed(() => !!mergedMask.value && props.modelValue);
  54934. const mergedMaskStyle = vue.computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  54935. const mergedShowArrow = vue.computed(() => {
  54936. var _a, _b;
  54937. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  54938. });
  54939. const mergedScrollIntoViewOptions = vue.computed(() => {
  54940. var _a, _b;
  54941. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  54942. });
  54943. const mergedType = vue.computed(() => {
  54944. var _a, _b;
  54945. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  54946. });
  54947. const { nextZIndex } = useZIndex();
  54948. const nowZIndex = nextZIndex();
  54949. const mergedZIndex = vue.computed(() => {
  54950. var _a;
  54951. return (_a = props.zIndex) != null ? _a : nowZIndex;
  54952. });
  54953. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, vue.toRef(props, "modelValue"), vue.toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  54954. vue.watch(() => props.modelValue, (val) => {
  54955. if (!val) {
  54956. current.value = 0;
  54957. }
  54958. });
  54959. const onEscClose = () => {
  54960. if (props.closeOnPressEscape) {
  54961. emit("update:modelValue", false);
  54962. emit("close", current.value);
  54963. }
  54964. };
  54965. const onUpdateTotal = (val) => {
  54966. total.value = val;
  54967. };
  54968. const slots = vue.useSlots();
  54969. vue.provide(tourKey, {
  54970. currentStep,
  54971. current,
  54972. total,
  54973. showClose: vue.toRef(props, "showClose"),
  54974. closeIcon: vue.toRef(props, "closeIcon"),
  54975. mergedType,
  54976. ns,
  54977. slots,
  54978. updateModelValue(modelValue) {
  54979. emit("update:modelValue", modelValue);
  54980. },
  54981. onClose() {
  54982. emit("close", current.value);
  54983. },
  54984. onFinish() {
  54985. emit("finish");
  54986. },
  54987. onChange() {
  54988. emit("change", current.value);
  54989. }
  54990. });
  54991. return (_ctx, _cache) => {
  54992. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  54993. vue.createVNode(vue.unref(ElTeleport$1), { to: _ctx.appendTo }, {
  54994. default: vue.withCtx(() => {
  54995. var _a, _b;
  54996. return [
  54997. vue.createElementVNode("div", vue.mergeProps({ class: vue.unref(kls) }, _ctx.$attrs), [
  54998. vue.createVNode(ElTourMask, {
  54999. visible: vue.unref(mergedShowMask),
  55000. fill: (_a = vue.unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  55001. style: vue.normalizeStyle((_b = vue.unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  55002. pos: vue.unref(pos),
  55003. "z-index": vue.unref(mergedZIndex),
  55004. "target-area-clickable": _ctx.targetAreaClickable
  55005. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  55006. _ctx.modelValue ? (vue.openBlock(), vue.createBlock(ElTourContent, {
  55007. key: vue.unref(current),
  55008. reference: vue.unref(triggerTarget),
  55009. placement: vue.unref(mergedPlacement),
  55010. "show-arrow": vue.unref(mergedShowArrow),
  55011. "z-index": vue.unref(mergedZIndex),
  55012. style: vue.normalizeStyle(vue.unref(mergedContentStyle)),
  55013. onClose: onEscClose
  55014. }, {
  55015. default: vue.withCtx(() => [
  55016. vue.createVNode(vue.unref(ElTourSteps), {
  55017. current: vue.unref(current),
  55018. onUpdateTotal
  55019. }, {
  55020. default: vue.withCtx(() => [
  55021. vue.renderSlot(_ctx.$slots, "default")
  55022. ]),
  55023. _: 3
  55024. }, 8, ["current"])
  55025. ]),
  55026. _: 3
  55027. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : vue.createCommentVNode("v-if", true)
  55028. ], 16)
  55029. ];
  55030. }),
  55031. _: 3
  55032. }, 8, ["to"]),
  55033. vue.createCommentVNode(" just for IDE "),
  55034. vue.createCommentVNode("v-if", true)
  55035. ], 64);
  55036. };
  55037. }
  55038. });
  55039. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tour.vue"]]);
  55040. const tourStepProps = buildProps({
  55041. target: {
  55042. type: definePropType([String, Object, Function])
  55043. },
  55044. title: String,
  55045. description: String,
  55046. showClose: {
  55047. type: Boolean,
  55048. default: void 0
  55049. },
  55050. closeIcon: {
  55051. type: iconPropType
  55052. },
  55053. showArrow: {
  55054. type: Boolean,
  55055. default: void 0
  55056. },
  55057. placement: tourContentProps.placement,
  55058. mask: {
  55059. type: definePropType([Boolean, Object]),
  55060. default: void 0
  55061. },
  55062. contentStyle: {
  55063. type: definePropType([Object])
  55064. },
  55065. prevButtonProps: {
  55066. type: definePropType(Object)
  55067. },
  55068. nextButtonProps: {
  55069. type: definePropType(Object)
  55070. },
  55071. scrollIntoViewOptions: {
  55072. type: definePropType([Boolean, Object]),
  55073. default: void 0
  55074. },
  55075. type: {
  55076. type: definePropType(String)
  55077. }
  55078. });
  55079. const tourStepEmits = {
  55080. close: () => true
  55081. };
  55082. const __default__$7 = vue.defineComponent({
  55083. name: "ElTourStep"
  55084. });
  55085. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  55086. ...__default__$7,
  55087. props: tourStepProps,
  55088. emits: tourStepEmits,
  55089. setup(__props, { emit }) {
  55090. const props = __props;
  55091. const { Close } = CloseComponents;
  55092. const { t } = useLocale();
  55093. const {
  55094. currentStep,
  55095. current,
  55096. total,
  55097. showClose,
  55098. closeIcon,
  55099. mergedType,
  55100. ns,
  55101. slots: tourSlots,
  55102. updateModelValue,
  55103. onClose: tourOnClose,
  55104. onFinish: tourOnFinish,
  55105. onChange
  55106. } = vue.inject(tourKey);
  55107. vue.watch(props, (val) => {
  55108. currentStep.value = val;
  55109. }, {
  55110. immediate: true
  55111. });
  55112. const mergedShowClose = vue.computed(() => {
  55113. var _a;
  55114. return (_a = props.showClose) != null ? _a : showClose.value;
  55115. });
  55116. const mergedCloseIcon = vue.computed(() => {
  55117. var _a, _b;
  55118. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  55119. });
  55120. const filterButtonProps = (btnProps) => {
  55121. if (!btnProps)
  55122. return;
  55123. return omit(btnProps, ["children", "onClick"]);
  55124. };
  55125. const onPrev = () => {
  55126. var _a, _b;
  55127. current.value -= 1;
  55128. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  55129. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  55130. }
  55131. onChange();
  55132. };
  55133. const onNext = () => {
  55134. var _a;
  55135. if (current.value >= total.value - 1) {
  55136. onFinish();
  55137. } else {
  55138. current.value += 1;
  55139. }
  55140. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  55141. props.nextButtonProps.onClick();
  55142. }
  55143. onChange();
  55144. };
  55145. const onFinish = () => {
  55146. onClose();
  55147. tourOnFinish();
  55148. };
  55149. const onClose = () => {
  55150. updateModelValue(false);
  55151. tourOnClose();
  55152. emit("close");
  55153. };
  55154. return (_ctx, _cache) => {
  55155. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  55156. vue.unref(mergedShowClose) ? (vue.openBlock(), vue.createElementBlock("button", {
  55157. key: 0,
  55158. "aria-label": "Close",
  55159. class: vue.normalizeClass(vue.unref(ns).e("closebtn")),
  55160. type: "button",
  55161. onClick: onClose
  55162. }, [
  55163. vue.createVNode(vue.unref(ElIcon), {
  55164. class: vue.normalizeClass(vue.unref(ns).e("close"))
  55165. }, {
  55166. default: vue.withCtx(() => [
  55167. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mergedCloseIcon))))
  55168. ]),
  55169. _: 1
  55170. }, 8, ["class"])
  55171. ], 2)) : vue.createCommentVNode("v-if", true),
  55172. vue.createElementVNode("header", {
  55173. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": vue.unref(showClose) }])
  55174. }, [
  55175. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  55176. vue.createElementVNode("span", {
  55177. role: "heading",
  55178. class: vue.normalizeClass(vue.unref(ns).e("title"))
  55179. }, vue.toDisplayString(_ctx.title), 3)
  55180. ])
  55181. ], 2),
  55182. vue.createElementVNode("div", {
  55183. class: vue.normalizeClass(vue.unref(ns).e("body"))
  55184. }, [
  55185. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  55186. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.description), 1)
  55187. ])
  55188. ], 2),
  55189. vue.createElementVNode("footer", {
  55190. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  55191. }, [
  55192. vue.createElementVNode("div", {
  55193. class: vue.normalizeClass(vue.unref(ns).b("indicators"))
  55194. }, [
  55195. vue.unref(tourSlots).indicators ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tourSlots).indicators), {
  55196. key: 0,
  55197. current: vue.unref(current),
  55198. total: vue.unref(total)
  55199. }, null, 8, ["current", "total"])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(total), (item, index) => {
  55200. return vue.openBlock(), vue.createElementBlock("span", {
  55201. key: item,
  55202. class: vue.normalizeClass([vue.unref(ns).b("indicator"), index === vue.unref(current) ? "is-active" : ""])
  55203. }, null, 2);
  55204. }), 128))
  55205. ], 2),
  55206. vue.createElementVNode("div", {
  55207. class: vue.normalizeClass(vue.unref(ns).b("buttons"))
  55208. }, [
  55209. vue.unref(current) > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  55210. key: 0,
  55211. size: "small",
  55212. type: vue.unref(mergedType)
  55213. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  55214. default: vue.withCtx(() => {
  55215. var _a, _b;
  55216. return [
  55217. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(t)("el.tour.previous")), 1)
  55218. ];
  55219. }),
  55220. _: 1
  55221. }, 16, ["type"])) : vue.createCommentVNode("v-if", true),
  55222. vue.unref(current) <= vue.unref(total) - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  55223. key: 1,
  55224. size: "small",
  55225. type: vue.unref(mergedType) === "primary" ? "default" : "primary"
  55226. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  55227. default: vue.withCtx(() => {
  55228. var _a, _b;
  55229. return [
  55230. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.nextButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(current) === vue.unref(total) - 1 ? vue.unref(t)("el.tour.finish") : vue.unref(t)("el.tour.next")), 1)
  55231. ];
  55232. }),
  55233. _: 1
  55234. }, 16, ["type"])) : vue.createCommentVNode("v-if", true)
  55235. ], 2)
  55236. ], 2)
  55237. ], 64);
  55238. };
  55239. }
  55240. });
  55241. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "step.vue"]]);
  55242. const ElTour = withInstall(Tour, {
  55243. TourStep
  55244. });
  55245. const ElTourStep = withNoopInstall(TourStep);
  55246. const anchorProps = buildProps({
  55247. container: {
  55248. type: definePropType([
  55249. String,
  55250. Object
  55251. ])
  55252. },
  55253. offset: {
  55254. type: Number,
  55255. default: 0
  55256. },
  55257. bound: {
  55258. type: Number,
  55259. default: 15
  55260. },
  55261. duration: {
  55262. type: Number,
  55263. default: 300
  55264. },
  55265. marker: {
  55266. type: Boolean,
  55267. default: true
  55268. },
  55269. type: {
  55270. type: definePropType(String),
  55271. default: "default"
  55272. },
  55273. direction: {
  55274. type: definePropType(String),
  55275. default: "vertical"
  55276. }
  55277. });
  55278. const anchorEmits = {
  55279. change: (href) => isString$1(href),
  55280. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  55281. };
  55282. const anchorKey = Symbol("anchor");
  55283. const __default__$6 = vue.defineComponent({
  55284. name: "ElAnchor"
  55285. });
  55286. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  55287. ...__default__$6,
  55288. props: anchorProps,
  55289. emits: anchorEmits,
  55290. setup(__props, { expose, emit }) {
  55291. const props = __props;
  55292. const currentAnchor = vue.ref("");
  55293. const anchorRef = vue.ref(null);
  55294. const markerRef = vue.ref(null);
  55295. const containerEl = vue.ref();
  55296. const links = {};
  55297. let isScrolling = false;
  55298. let currentScrollTop = 0;
  55299. const ns = useNamespace("anchor");
  55300. const cls = vue.computed(() => [
  55301. ns.b(),
  55302. props.type === "underline" ? ns.m("underline") : "",
  55303. ns.m(props.direction)
  55304. ]);
  55305. const addLink = (state) => {
  55306. links[state.href] = state.el;
  55307. };
  55308. const removeLink = (href) => {
  55309. delete links[href];
  55310. };
  55311. const setCurrentAnchor = (href) => {
  55312. const activeHref = currentAnchor.value;
  55313. if (activeHref !== href) {
  55314. currentAnchor.value = href;
  55315. emit("change", href);
  55316. }
  55317. };
  55318. let clearAnimate = null;
  55319. const scrollToAnchor = (href) => {
  55320. if (!containerEl.value)
  55321. return;
  55322. const target = getElement(href);
  55323. if (!target)
  55324. return;
  55325. if (clearAnimate)
  55326. clearAnimate();
  55327. isScrolling = true;
  55328. const scrollEle = getScrollElement(target, containerEl.value);
  55329. const distance = getOffsetTopDistance(target, scrollEle);
  55330. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  55331. const to = Math.min(distance - props.offset, max);
  55332. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  55333. setTimeout(() => {
  55334. isScrolling = false;
  55335. }, 20);
  55336. });
  55337. };
  55338. const scrollTo = (href) => {
  55339. if (href) {
  55340. setCurrentAnchor(href);
  55341. scrollToAnchor(href);
  55342. }
  55343. };
  55344. const handleClick = (e, href) => {
  55345. emit("click", e, href);
  55346. scrollTo(href);
  55347. };
  55348. const handleScroll = throttleByRaf(() => {
  55349. if (containerEl.value) {
  55350. currentScrollTop = getScrollTop(containerEl.value);
  55351. }
  55352. const currentHref = getCurrentHref();
  55353. if (isScrolling || isUndefined(currentHref))
  55354. return;
  55355. setCurrentAnchor(currentHref);
  55356. });
  55357. const getCurrentHref = () => {
  55358. if (!containerEl.value)
  55359. return;
  55360. const scrollTop = getScrollTop(containerEl.value);
  55361. const anchorTopList = [];
  55362. for (const href of Object.keys(links)) {
  55363. const target = getElement(href);
  55364. if (!target)
  55365. continue;
  55366. const scrollEle = getScrollElement(target, containerEl.value);
  55367. const distance = getOffsetTopDistance(target, scrollEle);
  55368. anchorTopList.push({
  55369. top: distance - props.offset - props.bound,
  55370. href
  55371. });
  55372. }
  55373. anchorTopList.sort((prev, next) => prev.top - next.top);
  55374. for (let i = 0; i < anchorTopList.length; i++) {
  55375. const item = anchorTopList[i];
  55376. const next = anchorTopList[i + 1];
  55377. if (i === 0 && scrollTop === 0) {
  55378. return "";
  55379. }
  55380. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  55381. return item.href;
  55382. }
  55383. }
  55384. };
  55385. const getContainer = () => {
  55386. const el = getElement(props.container);
  55387. if (!el || isWindow$1(el)) {
  55388. containerEl.value = window;
  55389. } else {
  55390. containerEl.value = el;
  55391. }
  55392. };
  55393. useEventListener(containerEl, "scroll", handleScroll);
  55394. const markerStyle = vue.computed(() => {
  55395. if (!anchorRef.value || !markerRef.value || !currentAnchor.value)
  55396. return {};
  55397. const currentLinkEl = links[currentAnchor.value];
  55398. if (!currentLinkEl)
  55399. return {};
  55400. const anchorRect = anchorRef.value.getBoundingClientRect();
  55401. const markerRect = markerRef.value.getBoundingClientRect();
  55402. const linkRect = currentLinkEl.getBoundingClientRect();
  55403. if (props.direction === "horizontal") {
  55404. const left = linkRect.left - anchorRect.left;
  55405. return {
  55406. left: `${left}px`,
  55407. width: `${linkRect.width}px`,
  55408. opacity: 1
  55409. };
  55410. } else {
  55411. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  55412. return {
  55413. top: `${top}px`,
  55414. opacity: 1
  55415. };
  55416. }
  55417. });
  55418. vue.onMounted(() => {
  55419. getContainer();
  55420. const hash = decodeURIComponent(window.location.hash);
  55421. const target = getElement(hash);
  55422. if (target) {
  55423. scrollTo(hash);
  55424. } else {
  55425. handleScroll();
  55426. }
  55427. });
  55428. vue.watch(() => props.container, () => {
  55429. getContainer();
  55430. });
  55431. vue.provide(anchorKey, {
  55432. ns,
  55433. direction: props.direction,
  55434. currentAnchor,
  55435. addLink,
  55436. removeLink,
  55437. handleClick
  55438. });
  55439. expose({
  55440. scrollTo
  55441. });
  55442. return (_ctx, _cache) => {
  55443. return vue.openBlock(), vue.createElementBlock("div", {
  55444. ref_key: "anchorRef",
  55445. ref: anchorRef,
  55446. class: vue.normalizeClass(vue.unref(cls))
  55447. }, [
  55448. _ctx.marker ? (vue.openBlock(), vue.createElementBlock("div", {
  55449. key: 0,
  55450. ref_key: "markerRef",
  55451. ref: markerRef,
  55452. class: vue.normalizeClass(vue.unref(ns).e("marker")),
  55453. style: vue.normalizeStyle(vue.unref(markerStyle))
  55454. }, null, 6)) : vue.createCommentVNode("v-if", true),
  55455. vue.createElementVNode("div", {
  55456. class: vue.normalizeClass(vue.unref(ns).e("list"))
  55457. }, [
  55458. vue.renderSlot(_ctx.$slots, "default")
  55459. ], 2)
  55460. ], 2);
  55461. };
  55462. }
  55463. });
  55464. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "anchor.vue"]]);
  55465. const anchorLinkProps = buildProps({
  55466. title: String,
  55467. href: String
  55468. });
  55469. const __default__$5 = vue.defineComponent({
  55470. name: "ElAnchorLink"
  55471. });
  55472. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  55473. ...__default__$5,
  55474. props: anchorLinkProps,
  55475. setup(__props) {
  55476. const props = __props;
  55477. const linkRef = vue.ref(null);
  55478. const {
  55479. ns,
  55480. direction,
  55481. currentAnchor,
  55482. addLink,
  55483. removeLink,
  55484. handleClick: contextHandleClick
  55485. } = vue.inject(anchorKey);
  55486. const cls = vue.computed(() => [
  55487. ns.e("link"),
  55488. ns.is("active", currentAnchor.value === props.href)
  55489. ]);
  55490. const handleClick = (e) => {
  55491. contextHandleClick(e, props.href);
  55492. };
  55493. vue.watch(() => props.href, (val, oldVal) => {
  55494. vue.nextTick(() => {
  55495. if (oldVal)
  55496. removeLink(oldVal);
  55497. if (val) {
  55498. addLink({
  55499. href: val,
  55500. el: linkRef.value
  55501. });
  55502. }
  55503. });
  55504. });
  55505. vue.onMounted(() => {
  55506. const { href } = props;
  55507. if (href) {
  55508. addLink({
  55509. href,
  55510. el: linkRef.value
  55511. });
  55512. }
  55513. });
  55514. vue.onBeforeUnmount(() => {
  55515. const { href } = props;
  55516. if (href) {
  55517. removeLink(href);
  55518. }
  55519. });
  55520. return (_ctx, _cache) => {
  55521. return vue.openBlock(), vue.createElementBlock("div", {
  55522. class: vue.normalizeClass(vue.unref(ns).e("item"))
  55523. }, [
  55524. vue.createElementVNode("a", {
  55525. ref_key: "linkRef",
  55526. ref: linkRef,
  55527. class: vue.normalizeClass(vue.unref(cls)),
  55528. href: _ctx.href,
  55529. onClick: handleClick
  55530. }, [
  55531. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  55532. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  55533. ])
  55534. ], 10, ["href"]),
  55535. _ctx.$slots["sub-link"] && vue.unref(direction) === "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  55536. key: 0,
  55537. class: vue.normalizeClass(vue.unref(ns).e("list"))
  55538. }, [
  55539. vue.renderSlot(_ctx.$slots, "sub-link")
  55540. ], 2)) : vue.createCommentVNode("v-if", true)
  55541. ], 2);
  55542. };
  55543. }
  55544. });
  55545. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "anchor-link.vue"]]);
  55546. const ElAnchor = withInstall(Anchor, {
  55547. AnchorLink
  55548. });
  55549. const ElAnchorLink = withNoopInstall(AnchorLink);
  55550. const segmentedProps = buildProps({
  55551. options: {
  55552. type: definePropType(Array),
  55553. default: () => []
  55554. },
  55555. modelValue: {
  55556. type: [String, Number, Boolean],
  55557. default: void 0
  55558. },
  55559. block: Boolean,
  55560. size: useSizeProp,
  55561. disabled: Boolean,
  55562. validateEvent: {
  55563. type: Boolean,
  55564. default: true
  55565. },
  55566. id: String,
  55567. name: String,
  55568. ...useAriaProps(["ariaLabel"])
  55569. });
  55570. const segmentedEmits = {
  55571. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  55572. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  55573. };
  55574. const __default__$4 = vue.defineComponent({
  55575. name: "ElSegmented"
  55576. });
  55577. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  55578. ...__default__$4,
  55579. props: segmentedProps,
  55580. emits: segmentedEmits,
  55581. setup(__props, { emit }) {
  55582. const props = __props;
  55583. const ns = useNamespace("segmented");
  55584. const segmentedId = useId();
  55585. const segmentedSize = useFormSize();
  55586. const _disabled = useFormDisabled();
  55587. const { formItem } = useFormItem();
  55588. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  55589. formItemContext: formItem
  55590. });
  55591. const segmentedRef = vue.ref(null);
  55592. const activeElement = useActiveElement();
  55593. const state = vue.reactive({
  55594. isInit: false,
  55595. width: 0,
  55596. translateX: 0,
  55597. focusVisible: false
  55598. });
  55599. const handleChange = (item) => {
  55600. const value = getValue(item);
  55601. emit(UPDATE_MODEL_EVENT, value);
  55602. emit(CHANGE_EVENT, value);
  55603. };
  55604. const getValue = (item) => {
  55605. return isObject$1(item) ? item.value : item;
  55606. };
  55607. const getLabel = (item) => {
  55608. return isObject$1(item) ? item.label : item;
  55609. };
  55610. const getDisabled = (item) => {
  55611. return !!(_disabled.value || (isObject$1(item) ? item.disabled : false));
  55612. };
  55613. const getSelected = (item) => {
  55614. return props.modelValue === getValue(item);
  55615. };
  55616. const getOption = (value) => {
  55617. return props.options.find((item) => getValue(item) === value);
  55618. };
  55619. const getItemCls = (item) => {
  55620. return [
  55621. ns.e("item"),
  55622. ns.is("selected", getSelected(item)),
  55623. ns.is("disabled", getDisabled(item))
  55624. ];
  55625. };
  55626. const updateSelect = () => {
  55627. if (!segmentedRef.value)
  55628. return;
  55629. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  55630. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  55631. if (!selectedItem || !selectedItemInput) {
  55632. state.width = 0;
  55633. state.translateX = 0;
  55634. state.focusVisible = false;
  55635. return;
  55636. }
  55637. const rect = selectedItem.getBoundingClientRect();
  55638. state.isInit = true;
  55639. state.width = rect.width;
  55640. state.translateX = selectedItem.offsetLeft;
  55641. try {
  55642. state.focusVisible = selectedItemInput.matches(":focus-visible");
  55643. } catch (e) {
  55644. }
  55645. };
  55646. const segmentedCls = vue.computed(() => [
  55647. ns.b(),
  55648. ns.m(segmentedSize.value),
  55649. ns.is("block", props.block)
  55650. ]);
  55651. const selectedStyle = vue.computed(() => ({
  55652. width: `${state.width}px`,
  55653. transform: `translateX(${state.translateX}px)`,
  55654. display: state.isInit ? "block" : "none"
  55655. }));
  55656. const selectedCls = vue.computed(() => [
  55657. ns.e("item-selected"),
  55658. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  55659. ns.is("focus-visible", state.focusVisible)
  55660. ]);
  55661. const name = vue.computed(() => {
  55662. return props.name || segmentedId.value;
  55663. });
  55664. useResizeObserver(segmentedRef, updateSelect);
  55665. vue.watch(activeElement, updateSelect);
  55666. vue.watch(() => props.modelValue, () => {
  55667. var _a;
  55668. updateSelect();
  55669. if (props.validateEvent) {
  55670. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  55671. }
  55672. }, {
  55673. flush: "post"
  55674. });
  55675. return (_ctx, _cache) => {
  55676. return vue.openBlock(), vue.createElementBlock("div", {
  55677. id: vue.unref(inputId),
  55678. ref_key: "segmentedRef",
  55679. ref: segmentedRef,
  55680. class: vue.normalizeClass(vue.unref(segmentedCls)),
  55681. role: "radiogroup",
  55682. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  55683. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  55684. }, [
  55685. vue.createElementVNode("div", {
  55686. class: vue.normalizeClass(vue.unref(ns).e("group"))
  55687. }, [
  55688. vue.createElementVNode("div", {
  55689. style: vue.normalizeStyle(vue.unref(selectedStyle)),
  55690. class: vue.normalizeClass(vue.unref(selectedCls))
  55691. }, null, 6),
  55692. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  55693. return vue.openBlock(), vue.createElementBlock("label", {
  55694. key: index,
  55695. class: vue.normalizeClass(getItemCls(item))
  55696. }, [
  55697. vue.createElementVNode("input", {
  55698. class: vue.normalizeClass(vue.unref(ns).e("item-input")),
  55699. type: "radio",
  55700. name: vue.unref(name),
  55701. disabled: getDisabled(item),
  55702. checked: getSelected(item),
  55703. onChange: ($event) => handleChange(item)
  55704. }, null, 42, ["name", "disabled", "checked", "onChange"]),
  55705. vue.createElementVNode("div", {
  55706. class: vue.normalizeClass(vue.unref(ns).e("item-label"))
  55707. }, [
  55708. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  55709. vue.createTextVNode(vue.toDisplayString(getLabel(item)), 1)
  55710. ])
  55711. ], 2)
  55712. ], 2);
  55713. }), 128))
  55714. ], 2)
  55715. ], 10, ["id", "aria-label", "aria-labelledby"]);
  55716. };
  55717. }
  55718. });
  55719. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "segmented.vue"]]);
  55720. const ElSegmented = withInstall(Segmented);
  55721. const filterOption = (pattern, option) => {
  55722. const lowerCase = pattern.toLowerCase();
  55723. const label = option.label || option.value;
  55724. return label.toLowerCase().includes(lowerCase);
  55725. };
  55726. const getMentionCtx = (inputEl, prefix, split) => {
  55727. const { selectionEnd } = inputEl;
  55728. if (selectionEnd === null)
  55729. return;
  55730. const inputValue = inputEl.value;
  55731. const prefixArray = castArray$1(prefix);
  55732. let splitIndex = -1;
  55733. let mentionCtx;
  55734. for (let i = selectionEnd - 1; i >= 0; --i) {
  55735. const char = inputValue[i];
  55736. if (char === split || char === "\n" || char === "\r") {
  55737. splitIndex = i;
  55738. continue;
  55739. }
  55740. if (prefixArray.includes(char)) {
  55741. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  55742. const pattern = inputValue.slice(i + 1, end);
  55743. mentionCtx = {
  55744. pattern,
  55745. start: i + 1,
  55746. end,
  55747. prefix: char,
  55748. prefixIndex: i,
  55749. splitIndex,
  55750. selectionEnd
  55751. };
  55752. break;
  55753. }
  55754. }
  55755. return mentionCtx;
  55756. };
  55757. const getCursorPosition = (element, options = {
  55758. debug: false,
  55759. useSelectionEnd: false
  55760. }) => {
  55761. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  55762. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  55763. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  55764. const properties = [
  55765. "direction",
  55766. "boxSizing",
  55767. "width",
  55768. "height",
  55769. "overflowX",
  55770. "overflowY",
  55771. "borderTopWidth",
  55772. "borderRightWidth",
  55773. "borderBottomWidth",
  55774. "borderLeftWidth",
  55775. "borderStyle",
  55776. "paddingTop",
  55777. "paddingRight",
  55778. "paddingBottom",
  55779. "paddingLeft",
  55780. "fontStyle",
  55781. "fontVariant",
  55782. "fontWeight",
  55783. "fontStretch",
  55784. "fontSize",
  55785. "fontSizeAdjust",
  55786. "lineHeight",
  55787. "fontFamily",
  55788. "textAlign",
  55789. "textTransform",
  55790. "textIndent",
  55791. "textDecoration",
  55792. "letterSpacing",
  55793. "wordSpacing",
  55794. "tabSize",
  55795. "MozTabSize"
  55796. ];
  55797. if (options.debug) {
  55798. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  55799. if (el == null ? void 0 : el.parentNode)
  55800. el.parentNode.removeChild(el);
  55801. }
  55802. const div = document.createElement("div");
  55803. div.id = "input-textarea-caret-position-mirror-div";
  55804. document.body.appendChild(div);
  55805. const style = div.style;
  55806. const computed = window.getComputedStyle(element);
  55807. const isInput = element.nodeName === "INPUT";
  55808. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  55809. if (!isInput)
  55810. style.wordWrap = "break-word";
  55811. style.position = "absolute";
  55812. if (!options.debug)
  55813. style.visibility = "hidden";
  55814. properties.forEach((prop) => {
  55815. if (isInput && prop === "lineHeight") {
  55816. if (computed.boxSizing === "border-box") {
  55817. const height = Number.parseInt(computed.height);
  55818. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  55819. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  55820. if (height > targetHeight) {
  55821. style.lineHeight = `${height - outerHeight}px`;
  55822. } else if (height === targetHeight) {
  55823. style.lineHeight = computed.lineHeight;
  55824. } else {
  55825. style.lineHeight = "0";
  55826. }
  55827. } else {
  55828. style.lineHeight = computed.height;
  55829. }
  55830. } else {
  55831. style[prop] = computed[prop];
  55832. }
  55833. });
  55834. if (isFirefox()) {
  55835. if (element.scrollHeight > Number.parseInt(computed.height)) {
  55836. style.overflowY = "scroll";
  55837. }
  55838. } else {
  55839. style.overflow = "hidden";
  55840. }
  55841. div.textContent = element.value.slice(0, Math.max(0, position));
  55842. if (isInput && div.textContent) {
  55843. div.textContent = div.textContent.replace(/\s/g, "\xA0");
  55844. }
  55845. const span = document.createElement("span");
  55846. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  55847. span.style.position = "relative";
  55848. span.style.left = `${-element.scrollLeft}px`;
  55849. span.style.top = `${-element.scrollTop}px`;
  55850. div.appendChild(span);
  55851. const relativePosition = {
  55852. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  55853. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  55854. height: Number.parseInt(computed.fontSize) * 1.5
  55855. };
  55856. if (options.debug) {
  55857. span.style.backgroundColor = "#aaa";
  55858. } else {
  55859. document.body.removeChild(div);
  55860. }
  55861. if (relativePosition.left >= element.clientWidth) {
  55862. relativePosition.left = element.clientWidth;
  55863. }
  55864. return relativePosition;
  55865. };
  55866. const mentionProps = buildProps({
  55867. ...inputProps,
  55868. options: {
  55869. type: definePropType(Array),
  55870. default: () => []
  55871. },
  55872. prefix: {
  55873. type: definePropType([String, Array]),
  55874. default: "@",
  55875. validator: (val) => {
  55876. if (isString$1(val))
  55877. return val.length === 1;
  55878. return val.every((v) => isString$1(v) && v.length === 1);
  55879. }
  55880. },
  55881. split: {
  55882. type: String,
  55883. default: " ",
  55884. validator: (val) => val.length === 1
  55885. },
  55886. filterOption: {
  55887. type: definePropType([Boolean, Function]),
  55888. default: () => filterOption,
  55889. validator: (val) => {
  55890. if (val === false)
  55891. return true;
  55892. return isFunction$1(val);
  55893. }
  55894. },
  55895. placement: {
  55896. type: definePropType(String),
  55897. default: "bottom"
  55898. },
  55899. showArrow: Boolean,
  55900. offset: {
  55901. type: Number,
  55902. default: 0
  55903. },
  55904. whole: Boolean,
  55905. checkIsWhole: {
  55906. type: definePropType(Function)
  55907. },
  55908. modelValue: String,
  55909. loading: Boolean,
  55910. popperClass: {
  55911. type: String,
  55912. default: ""
  55913. },
  55914. popperOptions: {
  55915. type: definePropType(Object),
  55916. default: () => ({})
  55917. }
  55918. });
  55919. const mentionEmits = {
  55920. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  55921. search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  55922. select: (option, prefix) => isString$1(option.value) && isString$1(prefix),
  55923. focus: (evt) => evt instanceof FocusEvent,
  55924. blur: (evt) => evt instanceof FocusEvent
  55925. };
  55926. const mentionDropdownProps = buildProps({
  55927. options: {
  55928. type: definePropType(Array),
  55929. default: () => []
  55930. },
  55931. loading: Boolean,
  55932. disabled: Boolean,
  55933. contentId: String,
  55934. ariaLabel: String
  55935. });
  55936. const mentionDropdownEmits = {
  55937. select: (option) => isString$1(option.value)
  55938. };
  55939. const __default__$3 = vue.defineComponent({
  55940. name: "ElMentionDropdown"
  55941. });
  55942. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  55943. ...__default__$3,
  55944. props: mentionDropdownProps,
  55945. emits: mentionDropdownEmits,
  55946. setup(__props, { expose, emit }) {
  55947. const props = __props;
  55948. const ns = useNamespace("mention");
  55949. const { t } = useLocale();
  55950. const hoveringIndex = vue.ref(-1);
  55951. const scrollbarRef = vue.ref();
  55952. const optionRefs = vue.ref();
  55953. const dropdownRef = vue.ref();
  55954. const optionkls = (item, index) => [
  55955. ns.be("dropdown", "item"),
  55956. ns.is("hovering", hoveringIndex.value === index),
  55957. ns.is("disabled", item.disabled || props.disabled)
  55958. ];
  55959. const handleSelect = (item) => {
  55960. if (item.disabled || props.disabled)
  55961. return;
  55962. emit("select", item);
  55963. };
  55964. const handleMouseEnter = (index) => {
  55965. hoveringIndex.value = index;
  55966. };
  55967. const filteredAllDisabled = vue.computed(() => props.disabled || props.options.every((item) => item.disabled));
  55968. const hoverOption = vue.computed(() => props.options[hoveringIndex.value]);
  55969. const selectHoverOption = () => {
  55970. if (!hoverOption.value)
  55971. return;
  55972. emit("select", hoverOption.value);
  55973. };
  55974. const navigateOptions = (direction) => {
  55975. const { options } = props;
  55976. if (options.length === 0 || filteredAllDisabled.value)
  55977. return;
  55978. if (direction === "next") {
  55979. hoveringIndex.value++;
  55980. if (hoveringIndex.value === options.length) {
  55981. hoveringIndex.value = 0;
  55982. }
  55983. } else if (direction === "prev") {
  55984. hoveringIndex.value--;
  55985. if (hoveringIndex.value < 0) {
  55986. hoveringIndex.value = options.length - 1;
  55987. }
  55988. }
  55989. const option = options[hoveringIndex.value];
  55990. if (option.disabled) {
  55991. navigateOptions(direction);
  55992. return;
  55993. }
  55994. vue.nextTick(() => scrollToOption(option));
  55995. };
  55996. const scrollToOption = (option) => {
  55997. var _a, _b, _c, _d;
  55998. const { options } = props;
  55999. const index = options.findIndex((item) => item.value === option.value);
  56000. const target = (_a = optionRefs.value) == null ? void 0 : _a[index];
  56001. if (target) {
  56002. const menu = (_c = (_b = dropdownRef.value) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, `.${ns.be("dropdown", "wrap")}`);
  56003. if (menu) {
  56004. scrollIntoView(menu, target);
  56005. }
  56006. }
  56007. (_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
  56008. };
  56009. const resetHoveringIndex = () => {
  56010. if (filteredAllDisabled.value || props.options.length === 0) {
  56011. hoveringIndex.value = -1;
  56012. } else {
  56013. hoveringIndex.value = 0;
  56014. }
  56015. };
  56016. vue.watch(() => props.options, resetHoveringIndex, {
  56017. immediate: true
  56018. });
  56019. expose({
  56020. hoveringIndex,
  56021. navigateOptions,
  56022. selectHoverOption,
  56023. hoverOption
  56024. });
  56025. return (_ctx, _cache) => {
  56026. return vue.openBlock(), vue.createElementBlock("div", {
  56027. ref_key: "dropdownRef",
  56028. ref: dropdownRef,
  56029. class: vue.normalizeClass(vue.unref(ns).b("dropdown"))
  56030. }, [
  56031. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  56032. key: 0,
  56033. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "header"))
  56034. }, [
  56035. vue.renderSlot(_ctx.$slots, "header")
  56036. ], 2)) : vue.createCommentVNode("v-if", true),
  56037. vue.withDirectives(vue.createVNode(vue.unref(ElScrollbar), {
  56038. id: _ctx.contentId,
  56039. ref_key: "scrollbarRef",
  56040. ref: scrollbarRef,
  56041. tag: "ul",
  56042. "wrap-class": vue.unref(ns).be("dropdown", "wrap"),
  56043. "view-class": vue.unref(ns).be("dropdown", "list"),
  56044. role: "listbox",
  56045. "aria-label": _ctx.ariaLabel,
  56046. "aria-orientation": "vertical"
  56047. }, {
  56048. default: vue.withCtx(() => [
  56049. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  56050. return vue.openBlock(), vue.createElementBlock("li", {
  56051. id: `${_ctx.contentId}-${index}`,
  56052. ref_for: true,
  56053. ref_key: "optionRefs",
  56054. ref: optionRefs,
  56055. key: item.value,
  56056. class: vue.normalizeClass(optionkls(item, index)),
  56057. role: "option",
  56058. "aria-disabled": item.disabled || _ctx.disabled || void 0,
  56059. "aria-selected": hoveringIndex.value === index,
  56060. onMouseenter: ($event) => handleMouseEnter(index),
  56061. onClick: vue.withModifiers(($event) => handleSelect(item), ["stop"])
  56062. }, [
  56063. vue.renderSlot(_ctx.$slots, "label", {
  56064. item,
  56065. index
  56066. }, () => {
  56067. var _a;
  56068. return [
  56069. vue.createElementVNode("span", null, vue.toDisplayString((_a = item.label) != null ? _a : item.value), 1)
  56070. ];
  56071. })
  56072. ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"]);
  56073. }), 128))
  56074. ]),
  56075. _: 3
  56076. }, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
  56077. [vue.vShow, _ctx.options.length > 0 && !_ctx.loading]
  56078. ]),
  56079. _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  56080. key: 1,
  56081. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "loading"))
  56082. }, [
  56083. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  56084. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.mention.loading")), 1)
  56085. ])
  56086. ], 2)) : vue.createCommentVNode("v-if", true),
  56087. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  56088. key: 2,
  56089. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "footer"))
  56090. }, [
  56091. vue.renderSlot(_ctx.$slots, "footer")
  56092. ], 2)) : vue.createCommentVNode("v-if", true)
  56093. ], 2);
  56094. };
  56095. }
  56096. });
  56097. var ElMentionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "mention-dropdown.vue"]]);
  56098. const __default__$2 = vue.defineComponent({
  56099. name: "ElMention"
  56100. });
  56101. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  56102. ...__default__$2,
  56103. props: mentionProps,
  56104. emits: mentionEmits,
  56105. setup(__props, { expose, emit }) {
  56106. const props = __props;
  56107. const passInputProps = vue.computed(() => pick(props, Object.keys(inputProps)));
  56108. const ns = useNamespace("mention");
  56109. const disabled = useFormDisabled();
  56110. const contentId = useId();
  56111. const elInputRef = vue.ref();
  56112. const tooltipRef = vue.ref();
  56113. const dropdownRef = vue.ref();
  56114. const visible = vue.ref(false);
  56115. const cursorStyle = vue.ref();
  56116. const mentionCtx = vue.ref();
  56117. const computedPlacement = vue.computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  56118. const computedFallbackPlacements = vue.computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  56119. const filteredOptions = vue.computed(() => {
  56120. const { filterOption, options } = props;
  56121. if (!mentionCtx.value || !filterOption)
  56122. return options;
  56123. return options.filter((option) => filterOption(mentionCtx.value.pattern, option));
  56124. });
  56125. const dropdownVisible = vue.computed(() => {
  56126. return visible.value && (!!filteredOptions.value.length || props.loading);
  56127. });
  56128. const hoveringId = vue.computed(() => {
  56129. var _a;
  56130. return `${contentId.value}-${(_a = dropdownRef.value) == null ? void 0 : _a.hoveringIndex}`;
  56131. });
  56132. const handleInputChange = (value) => {
  56133. emit("update:modelValue", value);
  56134. syncAfterCursorMove();
  56135. };
  56136. const handleInputKeyDown = (e) => {
  56137. var _a, _b, _c, _d;
  56138. if (!("key" in e))
  56139. return;
  56140. if ((_a = elInputRef.value) == null ? void 0 : _a.isComposing)
  56141. return;
  56142. if (["ArrowLeft", "ArrowRight"].includes(e.key)) {
  56143. syncAfterCursorMove();
  56144. } else if (["ArrowUp", "ArrowDown"].includes(e.key)) {
  56145. if (!visible.value)
  56146. return;
  56147. e.preventDefault();
  56148. const direction = e.key === "ArrowUp" ? "prev" : "next";
  56149. (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(direction);
  56150. } else if (["Enter"].includes(e.key)) {
  56151. if (!visible.value)
  56152. return;
  56153. e.preventDefault();
  56154. if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
  56155. (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
  56156. } else {
  56157. visible.value = false;
  56158. }
  56159. } else if (["Escape"].includes(e.key)) {
  56160. if (!visible.value)
  56161. return;
  56162. e.preventDefault();
  56163. visible.value = false;
  56164. } else if (["Backspace"].includes(e.key)) {
  56165. if (props.whole && mentionCtx.value) {
  56166. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  56167. const inputEl = getInputEl();
  56168. if (!inputEl)
  56169. return;
  56170. const inputValue = inputEl.value;
  56171. const matchOption = props.options.find((item) => item.value === pattern);
  56172. const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
  56173. if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  56174. e.preventDefault();
  56175. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  56176. emit(UPDATE_MODEL_EVENT, newValue);
  56177. const newSelectionEnd = prefixIndex;
  56178. vue.nextTick(() => {
  56179. inputEl.selectionStart = newSelectionEnd;
  56180. inputEl.selectionEnd = newSelectionEnd;
  56181. syncDropdownVisible();
  56182. });
  56183. }
  56184. }
  56185. }
  56186. };
  56187. const { wrapperRef } = useFocusController(elInputRef, {
  56188. beforeFocus() {
  56189. return disabled.value;
  56190. },
  56191. afterFocus() {
  56192. syncAfterCursorMove();
  56193. },
  56194. beforeBlur(event) {
  56195. var _a;
  56196. return (_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  56197. },
  56198. afterBlur() {
  56199. visible.value = false;
  56200. }
  56201. });
  56202. const handleInputMouseDown = () => {
  56203. syncAfterCursorMove();
  56204. };
  56205. const handleSelect = (item) => {
  56206. if (!mentionCtx.value)
  56207. return;
  56208. const inputEl = getInputEl();
  56209. if (!inputEl)
  56210. return;
  56211. const inputValue = inputEl.value;
  56212. const { split } = props;
  56213. const newEndPart = inputValue.slice(mentionCtx.value.end);
  56214. const alreadySeparated = newEndPart.startsWith(split);
  56215. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  56216. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  56217. emit(UPDATE_MODEL_EVENT, newValue);
  56218. emit("select", item, mentionCtx.value.prefix);
  56219. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  56220. vue.nextTick(() => {
  56221. inputEl.selectionStart = newSelectionEnd;
  56222. inputEl.selectionEnd = newSelectionEnd;
  56223. inputEl.focus();
  56224. syncDropdownVisible();
  56225. });
  56226. };
  56227. const getInputEl = () => {
  56228. var _a, _b;
  56229. return props.type === "textarea" ? (_a = elInputRef.value) == null ? void 0 : _a.textarea : (_b = elInputRef.value) == null ? void 0 : _b.input;
  56230. };
  56231. const syncAfterCursorMove = () => {
  56232. setTimeout(() => {
  56233. syncCursor();
  56234. syncDropdownVisible();
  56235. vue.nextTick(() => {
  56236. var _a;
  56237. return (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  56238. });
  56239. }, 0);
  56240. };
  56241. const syncCursor = () => {
  56242. const inputEl = getInputEl();
  56243. if (!inputEl)
  56244. return;
  56245. const caretPosition = getCursorPosition(inputEl);
  56246. const inputRect = inputEl.getBoundingClientRect();
  56247. const elInputRect = elInputRef.value.$el.getBoundingClientRect();
  56248. cursorStyle.value = {
  56249. position: "absolute",
  56250. width: 0,
  56251. height: `${caretPosition.height}px`,
  56252. left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,
  56253. top: `${caretPosition.top + inputRect.top - elInputRect.top}px`
  56254. };
  56255. };
  56256. const syncDropdownVisible = () => {
  56257. const inputEl = getInputEl();
  56258. if (document.activeElement !== inputEl) {
  56259. visible.value = false;
  56260. return;
  56261. }
  56262. const { prefix, split } = props;
  56263. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  56264. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  56265. visible.value = true;
  56266. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  56267. return;
  56268. }
  56269. visible.value = false;
  56270. };
  56271. expose({
  56272. input: elInputRef,
  56273. tooltip: tooltipRef
  56274. });
  56275. return (_ctx, _cache) => {
  56276. return vue.openBlock(), vue.createElementBlock("div", {
  56277. ref_key: "wrapperRef",
  56278. ref: wrapperRef,
  56279. class: vue.normalizeClass(vue.unref(ns).b())
  56280. }, [
  56281. vue.createVNode(vue.unref(ElInput), vue.mergeProps(vue.mergeProps(vue.unref(passInputProps), _ctx.$attrs), {
  56282. ref_key: "elInputRef",
  56283. ref: elInputRef,
  56284. "model-value": _ctx.modelValue,
  56285. disabled: vue.unref(disabled),
  56286. role: vue.unref(dropdownVisible) ? "combobox" : void 0,
  56287. "aria-activedescendant": vue.unref(dropdownVisible) ? vue.unref(hoveringId) || "" : void 0,
  56288. "aria-controls": vue.unref(dropdownVisible) ? vue.unref(contentId) : void 0,
  56289. "aria-expanded": vue.unref(dropdownVisible) || void 0,
  56290. "aria-label": _ctx.ariaLabel,
  56291. "aria-autocomplete": vue.unref(dropdownVisible) ? "none" : void 0,
  56292. "aria-haspopup": vue.unref(dropdownVisible) ? "listbox" : void 0,
  56293. onInput: handleInputChange,
  56294. onKeydown: handleInputKeyDown,
  56295. onMousedown: handleInputMouseDown
  56296. }), vue.createSlots({ _: 2 }, [
  56297. vue.renderList(_ctx.$slots, (_, name) => {
  56298. return {
  56299. name,
  56300. fn: vue.withCtx((slotProps) => [
  56301. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  56302. ])
  56303. };
  56304. })
  56305. ]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
  56306. vue.createVNode(vue.unref(ElTooltip), {
  56307. ref_key: "tooltipRef",
  56308. ref: tooltipRef,
  56309. visible: vue.unref(dropdownVisible),
  56310. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  56311. "popper-options": _ctx.popperOptions,
  56312. placement: vue.unref(computedPlacement),
  56313. "fallback-placements": vue.unref(computedFallbackPlacements),
  56314. effect: "light",
  56315. pure: "",
  56316. offset: _ctx.offset,
  56317. "show-arrow": _ctx.showArrow
  56318. }, {
  56319. default: vue.withCtx(() => [
  56320. vue.createElementVNode("div", {
  56321. style: vue.normalizeStyle(cursorStyle.value)
  56322. }, null, 4)
  56323. ]),
  56324. content: vue.withCtx(() => {
  56325. var _a;
  56326. return [
  56327. vue.createVNode(ElMentionDropdown, {
  56328. ref_key: "dropdownRef",
  56329. ref: dropdownRef,
  56330. options: vue.unref(filteredOptions),
  56331. disabled: vue.unref(disabled),
  56332. loading: _ctx.loading,
  56333. "content-id": vue.unref(contentId),
  56334. "aria-label": _ctx.ariaLabel,
  56335. onSelect: handleSelect,
  56336. onClick: vue.withModifiers((_a = elInputRef.value) == null ? void 0 : _a.focus, ["stop"])
  56337. }, vue.createSlots({ _: 2 }, [
  56338. vue.renderList(_ctx.$slots, (_, name) => {
  56339. return {
  56340. name,
  56341. fn: vue.withCtx((slotProps) => [
  56342. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  56343. ])
  56344. };
  56345. })
  56346. ]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
  56347. ];
  56348. }),
  56349. _: 3
  56350. }, 8, ["visible", "popper-class", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
  56351. ], 2);
  56352. };
  56353. }
  56354. });
  56355. var Mention = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "mention.vue"]]);
  56356. const ElMention = withInstall(Mention);
  56357. var Components = [
  56358. ElAffix,
  56359. ElAlert,
  56360. ElAutocomplete,
  56361. ElAutoResizer,
  56362. ElAvatar,
  56363. ElBacktop,
  56364. ElBadge,
  56365. ElBreadcrumb,
  56366. ElBreadcrumbItem,
  56367. ElButton,
  56368. ElButtonGroup$1,
  56369. ElCalendar,
  56370. ElCard,
  56371. ElCarousel,
  56372. ElCarouselItem,
  56373. ElCascader,
  56374. ElCascaderPanel,
  56375. ElCheckTag,
  56376. ElCheckbox,
  56377. ElCheckboxButton,
  56378. ElCheckboxGroup$1,
  56379. ElCol,
  56380. ElCollapse,
  56381. ElCollapseItem,
  56382. ElCollapseTransition,
  56383. ElColorPicker,
  56384. ElConfigProvider,
  56385. ElContainer,
  56386. ElAside,
  56387. ElFooter,
  56388. ElHeader,
  56389. ElMain,
  56390. ElDatePicker,
  56391. ElDescriptions,
  56392. ElDescriptionsItem,
  56393. ElDialog,
  56394. ElDivider,
  56395. ElDrawer,
  56396. ElDropdown,
  56397. ElDropdownItem,
  56398. ElDropdownMenu,
  56399. ElEmpty,
  56400. ElForm,
  56401. ElFormItem,
  56402. ElIcon,
  56403. ElImage,
  56404. ElImageViewer,
  56405. ElInput,
  56406. ElInputNumber,
  56407. ElLink,
  56408. ElMenu,
  56409. ElMenuItem,
  56410. ElMenuItemGroup,
  56411. ElSubMenu,
  56412. ElPageHeader,
  56413. ElPagination,
  56414. ElPopconfirm,
  56415. ElPopover,
  56416. ElPopper,
  56417. ElProgress,
  56418. ElRadio,
  56419. ElRadioButton,
  56420. ElRadioGroup,
  56421. ElRate,
  56422. ElResult,
  56423. ElRow,
  56424. ElScrollbar,
  56425. ElSelect,
  56426. ElOption,
  56427. ElOptionGroup,
  56428. ElSelectV2,
  56429. ElSkeleton,
  56430. ElSkeletonItem,
  56431. ElSlider,
  56432. ElSpace,
  56433. ElStatistic,
  56434. ElCountdown,
  56435. ElSteps,
  56436. ElStep,
  56437. ElSwitch,
  56438. ElTable,
  56439. ElTableColumn,
  56440. ElTableV2,
  56441. ElTabs,
  56442. ElTabPane,
  56443. ElTag,
  56444. ElText,
  56445. ElTimePicker,
  56446. ElTimeSelect,
  56447. ElTimeline,
  56448. ElTimelineItem,
  56449. ElTooltip,
  56450. ElTooltipV2,
  56451. ElTransfer,
  56452. ElTree,
  56453. ElTreeSelect,
  56454. ElTreeV2,
  56455. ElUpload,
  56456. ElWatermark,
  56457. ElTour,
  56458. ElTourStep,
  56459. ElAnchor,
  56460. ElAnchorLink,
  56461. ElSegmented,
  56462. ElMention
  56463. ];
  56464. const SCOPE = "ElInfiniteScroll";
  56465. const CHECK_INTERVAL = 50;
  56466. const DEFAULT_DELAY = 200;
  56467. const DEFAULT_DISTANCE = 0;
  56468. const attributes = {
  56469. delay: {
  56470. type: Number,
  56471. default: DEFAULT_DELAY
  56472. },
  56473. distance: {
  56474. type: Number,
  56475. default: DEFAULT_DISTANCE
  56476. },
  56477. disabled: {
  56478. type: Boolean,
  56479. default: false
  56480. },
  56481. immediate: {
  56482. type: Boolean,
  56483. default: true
  56484. }
  56485. };
  56486. const getScrollOptions = (el, instance) => {
  56487. return Object.entries(attributes).reduce((acm, [name, option]) => {
  56488. var _a, _b;
  56489. const { type, default: defaultValue } = option;
  56490. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  56491. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  56492. value = value === "false" ? false : value;
  56493. value = type(value);
  56494. acm[name] = Number.isNaN(value) ? defaultValue : value;
  56495. return acm;
  56496. }, {});
  56497. };
  56498. const destroyObserver = (el) => {
  56499. const { observer } = el[SCOPE];
  56500. if (observer) {
  56501. observer.disconnect();
  56502. delete el[SCOPE].observer;
  56503. }
  56504. };
  56505. const handleScroll = (el, cb) => {
  56506. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  56507. const { disabled, distance } = getScrollOptions(el, instance);
  56508. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  56509. const delta = scrollTop - lastScrollTop;
  56510. el[SCOPE].lastScrollTop = scrollTop;
  56511. if (observer || disabled || delta < 0)
  56512. return;
  56513. let shouldTrigger = false;
  56514. if (container === el) {
  56515. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  56516. } else {
  56517. const { clientTop, scrollHeight: height } = el;
  56518. const offsetTop = getOffsetTopDistance(el, containerEl);
  56519. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  56520. }
  56521. if (shouldTrigger) {
  56522. cb.call(instance);
  56523. }
  56524. };
  56525. function checkFull(el, cb) {
  56526. const { containerEl, instance } = el[SCOPE];
  56527. const { disabled } = getScrollOptions(el, instance);
  56528. if (disabled || containerEl.clientHeight === 0)
  56529. return;
  56530. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  56531. cb.call(instance);
  56532. } else {
  56533. destroyObserver(el);
  56534. }
  56535. }
  56536. const InfiniteScroll = {
  56537. async mounted(el, binding) {
  56538. const { instance, value: cb } = binding;
  56539. if (!isFunction$1(cb)) {
  56540. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  56541. }
  56542. await vue.nextTick();
  56543. const { delay, immediate } = getScrollOptions(el, instance);
  56544. const container = getScrollContainer(el, true);
  56545. const containerEl = container === window ? document.documentElement : container;
  56546. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  56547. if (!container)
  56548. return;
  56549. el[SCOPE] = {
  56550. instance,
  56551. container,
  56552. containerEl,
  56553. delay,
  56554. cb,
  56555. onScroll,
  56556. lastScrollTop: containerEl.scrollTop
  56557. };
  56558. if (immediate) {
  56559. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  56560. el[SCOPE].observer = observer;
  56561. observer.observe(el, { childList: true, subtree: true });
  56562. checkFull(el, cb);
  56563. }
  56564. container.addEventListener("scroll", onScroll);
  56565. },
  56566. unmounted(el) {
  56567. if (!el[SCOPE])
  56568. return;
  56569. const { container, onScroll } = el[SCOPE];
  56570. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  56571. destroyObserver(el);
  56572. },
  56573. async updated(el) {
  56574. if (!el[SCOPE]) {
  56575. await vue.nextTick();
  56576. } else {
  56577. const { containerEl, cb, observer } = el[SCOPE];
  56578. if (containerEl.clientHeight && observer) {
  56579. checkFull(el, cb);
  56580. }
  56581. }
  56582. }
  56583. };
  56584. var InfiniteScroll$1 = InfiniteScroll;
  56585. const _InfiniteScroll = InfiniteScroll$1;
  56586. _InfiniteScroll.install = (app) => {
  56587. app.directive("InfiniteScroll", _InfiniteScroll);
  56588. };
  56589. const ElInfiniteScroll = _InfiniteScroll;
  56590. function createLoadingComponent(options) {
  56591. let afterLeaveTimer;
  56592. const afterLeaveFlag = vue.ref(false);
  56593. const data = vue.reactive({
  56594. ...options,
  56595. originalPosition: "",
  56596. originalOverflow: "",
  56597. visible: false
  56598. });
  56599. function setText(text) {
  56600. data.text = text;
  56601. }
  56602. function destroySelf() {
  56603. const target = data.parent;
  56604. const ns = vm.ns;
  56605. if (!target.vLoadingAddClassList) {
  56606. let loadingNumber = target.getAttribute("loading-number");
  56607. loadingNumber = Number.parseInt(loadingNumber) - 1;
  56608. if (!loadingNumber) {
  56609. removeClass(target, ns.bm("parent", "relative"));
  56610. target.removeAttribute("loading-number");
  56611. } else {
  56612. target.setAttribute("loading-number", loadingNumber.toString());
  56613. }
  56614. removeClass(target, ns.bm("parent", "hidden"));
  56615. }
  56616. removeElLoadingChild();
  56617. loadingInstance.unmount();
  56618. }
  56619. function removeElLoadingChild() {
  56620. var _a, _b;
  56621. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  56622. }
  56623. function close() {
  56624. var _a;
  56625. if (options.beforeClose && !options.beforeClose())
  56626. return;
  56627. afterLeaveFlag.value = true;
  56628. clearTimeout(afterLeaveTimer);
  56629. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  56630. data.visible = false;
  56631. (_a = options.closed) == null ? void 0 : _a.call(options);
  56632. }
  56633. function handleAfterLeave() {
  56634. if (!afterLeaveFlag.value)
  56635. return;
  56636. const target = data.parent;
  56637. afterLeaveFlag.value = false;
  56638. target.vLoadingAddClassList = void 0;
  56639. destroySelf();
  56640. }
  56641. const elLoadingComponent = vue.defineComponent({
  56642. name: "ElLoading",
  56643. setup(_, { expose }) {
  56644. const { ns, zIndex } = useGlobalComponentSettings("loading");
  56645. expose({
  56646. ns,
  56647. zIndex
  56648. });
  56649. return () => {
  56650. const svg = data.spinner || data.svg;
  56651. const spinner = vue.h("svg", {
  56652. class: "circular",
  56653. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  56654. ...svg ? { innerHTML: svg } : {}
  56655. }, [
  56656. vue.h("circle", {
  56657. class: "path",
  56658. cx: "25",
  56659. cy: "25",
  56660. r: "20",
  56661. fill: "none"
  56662. })
  56663. ]);
  56664. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  56665. return vue.h(vue.Transition, {
  56666. name: ns.b("fade"),
  56667. onAfterLeave: handleAfterLeave
  56668. }, {
  56669. default: vue.withCtx(() => [
  56670. vue.withDirectives(vue.createVNode("div", {
  56671. style: {
  56672. backgroundColor: data.background || ""
  56673. },
  56674. class: [
  56675. ns.b("mask"),
  56676. data.customClass,
  56677. data.fullscreen ? "is-fullscreen" : ""
  56678. ]
  56679. }, [
  56680. vue.h("div", {
  56681. class: ns.b("spinner")
  56682. }, [spinner, spinnerText])
  56683. ]), [[vue.vShow, data.visible]])
  56684. ])
  56685. });
  56686. };
  56687. }
  56688. });
  56689. const loadingInstance = vue.createApp(elLoadingComponent);
  56690. const vm = loadingInstance.mount(document.createElement("div"));
  56691. return {
  56692. ...vue.toRefs(data),
  56693. setText,
  56694. removeElLoadingChild,
  56695. close,
  56696. handleAfterLeave,
  56697. vm,
  56698. get $el() {
  56699. return vm.$el;
  56700. }
  56701. };
  56702. }
  56703. let fullscreenInstance = void 0;
  56704. const Loading = function(options = {}) {
  56705. if (!isClient)
  56706. return void 0;
  56707. const resolved = resolveOptions(options);
  56708. if (resolved.fullscreen && fullscreenInstance) {
  56709. return fullscreenInstance;
  56710. }
  56711. const instance = createLoadingComponent({
  56712. ...resolved,
  56713. closed: () => {
  56714. var _a;
  56715. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  56716. if (resolved.fullscreen)
  56717. fullscreenInstance = void 0;
  56718. }
  56719. });
  56720. addStyle(resolved, resolved.parent, instance);
  56721. addClassList(resolved, resolved.parent, instance);
  56722. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  56723. let loadingNumber = resolved.parent.getAttribute("loading-number");
  56724. if (!loadingNumber) {
  56725. loadingNumber = "1";
  56726. } else {
  56727. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  56728. }
  56729. resolved.parent.setAttribute("loading-number", loadingNumber);
  56730. resolved.parent.appendChild(instance.$el);
  56731. vue.nextTick(() => instance.visible.value = resolved.visible);
  56732. if (resolved.fullscreen) {
  56733. fullscreenInstance = instance;
  56734. }
  56735. return instance;
  56736. };
  56737. const resolveOptions = (options) => {
  56738. var _a, _b, _c, _d;
  56739. let target;
  56740. if (isString$1(options.target)) {
  56741. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  56742. } else {
  56743. target = options.target || document.body;
  56744. }
  56745. return {
  56746. parent: target === document.body || options.body ? document.body : target,
  56747. background: options.background || "",
  56748. svg: options.svg || "",
  56749. svgViewBox: options.svgViewBox || "",
  56750. spinner: options.spinner || false,
  56751. text: options.text || "",
  56752. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  56753. lock: (_c = options.lock) != null ? _c : false,
  56754. customClass: options.customClass || "",
  56755. visible: (_d = options.visible) != null ? _d : true,
  56756. beforeClose: options.beforeClose,
  56757. closed: options.closed,
  56758. target
  56759. };
  56760. };
  56761. const addStyle = async (options, parent, instance) => {
  56762. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  56763. const maskStyle = {};
  56764. if (options.fullscreen) {
  56765. instance.originalPosition.value = getStyle(document.body, "position");
  56766. instance.originalOverflow.value = getStyle(document.body, "overflow");
  56767. maskStyle.zIndex = nextZIndex();
  56768. } else if (options.parent === document.body) {
  56769. instance.originalPosition.value = getStyle(document.body, "position");
  56770. await vue.nextTick();
  56771. for (const property of ["top", "left"]) {
  56772. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  56773. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  56774. }
  56775. for (const property of ["height", "width"]) {
  56776. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  56777. }
  56778. } else {
  56779. instance.originalPosition.value = getStyle(parent, "position");
  56780. }
  56781. for (const [key, value] of Object.entries(maskStyle)) {
  56782. instance.$el.style[key] = value;
  56783. }
  56784. };
  56785. const addClassList = (options, parent, instance) => {
  56786. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  56787. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  56788. addClass(parent, ns.bm("parent", "relative"));
  56789. } else {
  56790. removeClass(parent, ns.bm("parent", "relative"));
  56791. }
  56792. if (options.fullscreen && options.lock) {
  56793. addClass(parent, ns.bm("parent", "hidden"));
  56794. } else {
  56795. removeClass(parent, ns.bm("parent", "hidden"));
  56796. }
  56797. };
  56798. const INSTANCE_KEY = Symbol("ElLoading");
  56799. const createInstance = (el, binding) => {
  56800. var _a, _b, _c, _d;
  56801. const vm = binding.instance;
  56802. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  56803. const resolveExpression = (key) => {
  56804. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  56805. if (data)
  56806. return vue.ref(data);
  56807. else
  56808. return data;
  56809. };
  56810. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  56811. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  56812. const options = {
  56813. text: getProp("text"),
  56814. svg: getProp("svg"),
  56815. svgViewBox: getProp("svgViewBox"),
  56816. spinner: getProp("spinner"),
  56817. background: getProp("background"),
  56818. customClass: getProp("customClass"),
  56819. fullscreen,
  56820. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  56821. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  56822. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  56823. };
  56824. el[INSTANCE_KEY] = {
  56825. options,
  56826. instance: Loading(options)
  56827. };
  56828. };
  56829. const updateOptions = (newOptions, originalOptions) => {
  56830. for (const key of Object.keys(originalOptions)) {
  56831. if (vue.isRef(originalOptions[key]))
  56832. originalOptions[key].value = newOptions[key];
  56833. }
  56834. };
  56835. const vLoading = {
  56836. mounted(el, binding) {
  56837. if (binding.value) {
  56838. createInstance(el, binding);
  56839. }
  56840. },
  56841. updated(el, binding) {
  56842. const instance = el[INSTANCE_KEY];
  56843. if (binding.oldValue !== binding.value) {
  56844. if (binding.value && !binding.oldValue) {
  56845. createInstance(el, binding);
  56846. } else if (binding.value && binding.oldValue) {
  56847. if (isObject$1(binding.value))
  56848. updateOptions(binding.value, instance.options);
  56849. } else {
  56850. instance == null ? void 0 : instance.instance.close();
  56851. }
  56852. }
  56853. },
  56854. unmounted(el) {
  56855. var _a;
  56856. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  56857. el[INSTANCE_KEY] = null;
  56858. }
  56859. };
  56860. const ElLoading = {
  56861. install(app) {
  56862. app.directive("loading", vLoading);
  56863. app.config.globalProperties.$loading = Loading;
  56864. },
  56865. directive: vLoading,
  56866. service: Loading
  56867. };
  56868. const messageTypes = ["success", "info", "warning", "error"];
  56869. const messageDefaults = mutable({
  56870. customClass: "",
  56871. center: false,
  56872. dangerouslyUseHTMLString: false,
  56873. duration: 3e3,
  56874. icon: void 0,
  56875. id: "",
  56876. message: "",
  56877. onClose: void 0,
  56878. showClose: false,
  56879. type: "info",
  56880. plain: false,
  56881. offset: 16,
  56882. zIndex: 0,
  56883. grouping: false,
  56884. repeatNum: 1,
  56885. appendTo: isClient ? document.body : void 0
  56886. });
  56887. const messageProps = buildProps({
  56888. customClass: {
  56889. type: String,
  56890. default: messageDefaults.customClass
  56891. },
  56892. center: {
  56893. type: Boolean,
  56894. default: messageDefaults.center
  56895. },
  56896. dangerouslyUseHTMLString: {
  56897. type: Boolean,
  56898. default: messageDefaults.dangerouslyUseHTMLString
  56899. },
  56900. duration: {
  56901. type: Number,
  56902. default: messageDefaults.duration
  56903. },
  56904. icon: {
  56905. type: iconPropType,
  56906. default: messageDefaults.icon
  56907. },
  56908. id: {
  56909. type: String,
  56910. default: messageDefaults.id
  56911. },
  56912. message: {
  56913. type: definePropType([
  56914. String,
  56915. Object,
  56916. Function
  56917. ]),
  56918. default: messageDefaults.message
  56919. },
  56920. onClose: {
  56921. type: definePropType(Function),
  56922. default: messageDefaults.onClose
  56923. },
  56924. showClose: {
  56925. type: Boolean,
  56926. default: messageDefaults.showClose
  56927. },
  56928. type: {
  56929. type: String,
  56930. values: messageTypes,
  56931. default: messageDefaults.type
  56932. },
  56933. plain: {
  56934. type: Boolean,
  56935. default: messageDefaults.plain
  56936. },
  56937. offset: {
  56938. type: Number,
  56939. default: messageDefaults.offset
  56940. },
  56941. zIndex: {
  56942. type: Number,
  56943. default: messageDefaults.zIndex
  56944. },
  56945. grouping: {
  56946. type: Boolean,
  56947. default: messageDefaults.grouping
  56948. },
  56949. repeatNum: {
  56950. type: Number,
  56951. default: messageDefaults.repeatNum
  56952. }
  56953. });
  56954. const messageEmits = {
  56955. destroy: () => true
  56956. };
  56957. const instances = vue.shallowReactive([]);
  56958. const getInstance = (id) => {
  56959. const idx = instances.findIndex((instance) => instance.id === id);
  56960. const current = instances[idx];
  56961. let prev;
  56962. if (idx > 0) {
  56963. prev = instances[idx - 1];
  56964. }
  56965. return { current, prev };
  56966. };
  56967. const getLastOffset = (id) => {
  56968. const { prev } = getInstance(id);
  56969. if (!prev)
  56970. return 0;
  56971. return prev.vm.exposed.bottom.value;
  56972. };
  56973. const getOffsetOrSpace = (id, offset) => {
  56974. const idx = instances.findIndex((instance) => instance.id === id);
  56975. return idx > 0 ? 16 : offset;
  56976. };
  56977. const __default__$1 = vue.defineComponent({
  56978. name: "ElMessage"
  56979. });
  56980. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  56981. ...__default__$1,
  56982. props: messageProps,
  56983. emits: messageEmits,
  56984. setup(__props, { expose }) {
  56985. const props = __props;
  56986. const { Close } = TypeComponents;
  56987. const { ns, zIndex } = useGlobalComponentSettings("message");
  56988. const { currentZIndex, nextZIndex } = zIndex;
  56989. const messageRef = vue.ref();
  56990. const visible = vue.ref(false);
  56991. const height = vue.ref(0);
  56992. let stopTimer = void 0;
  56993. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  56994. const typeClass = vue.computed(() => {
  56995. const type = props.type;
  56996. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  56997. });
  56998. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  56999. const lastOffset = vue.computed(() => getLastOffset(props.id));
  57000. const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  57001. const bottom = vue.computed(() => height.value + offset.value);
  57002. const customStyle = vue.computed(() => ({
  57003. top: `${offset.value}px`,
  57004. zIndex: currentZIndex.value
  57005. }));
  57006. function startTimer() {
  57007. if (props.duration === 0)
  57008. return;
  57009. ({ stop: stopTimer } = useTimeoutFn(() => {
  57010. close();
  57011. }, props.duration));
  57012. }
  57013. function clearTimer() {
  57014. stopTimer == null ? void 0 : stopTimer();
  57015. }
  57016. function close() {
  57017. visible.value = false;
  57018. }
  57019. function keydown({ code }) {
  57020. if (code === EVENT_CODE.esc) {
  57021. close();
  57022. }
  57023. }
  57024. vue.onMounted(() => {
  57025. startTimer();
  57026. nextZIndex();
  57027. visible.value = true;
  57028. });
  57029. vue.watch(() => props.repeatNum, () => {
  57030. clearTimer();
  57031. startTimer();
  57032. });
  57033. useEventListener(document, "keydown", keydown);
  57034. useResizeObserver(messageRef, () => {
  57035. height.value = messageRef.value.getBoundingClientRect().height;
  57036. });
  57037. expose({
  57038. visible,
  57039. bottom,
  57040. close
  57041. });
  57042. return (_ctx, _cache) => {
  57043. return vue.openBlock(), vue.createBlock(vue.Transition, {
  57044. name: vue.unref(ns).b("fade"),
  57045. onBeforeLeave: _ctx.onClose,
  57046. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  57047. persisted: ""
  57048. }, {
  57049. default: vue.withCtx(() => [
  57050. vue.withDirectives(vue.createElementVNode("div", {
  57051. id: _ctx.id,
  57052. ref_key: "messageRef",
  57053. ref: messageRef,
  57054. class: vue.normalizeClass([
  57055. vue.unref(ns).b(),
  57056. { [vue.unref(ns).m(_ctx.type)]: _ctx.type },
  57057. vue.unref(ns).is("center", _ctx.center),
  57058. vue.unref(ns).is("closable", _ctx.showClose),
  57059. vue.unref(ns).is("plain", _ctx.plain),
  57060. _ctx.customClass
  57061. ]),
  57062. style: vue.normalizeStyle(vue.unref(customStyle)),
  57063. role: "alert",
  57064. onMouseenter: clearTimer,
  57065. onMouseleave: startTimer
  57066. }, [
  57067. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  57068. key: 0,
  57069. value: _ctx.repeatNum,
  57070. type: vue.unref(badgeType),
  57071. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  57072. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  57073. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  57074. key: 1,
  57075. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  57076. }, {
  57077. default: vue.withCtx(() => [
  57078. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  57079. ]),
  57080. _: 1
  57081. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  57082. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  57083. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  57084. key: 0,
  57085. class: vue.normalizeClass(vue.unref(ns).e("content"))
  57086. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  57087. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  57088. vue.createElementVNode("p", {
  57089. class: vue.normalizeClass(vue.unref(ns).e("content")),
  57090. innerHTML: _ctx.message
  57091. }, null, 10, ["innerHTML"])
  57092. ], 2112))
  57093. ]),
  57094. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  57095. key: 2,
  57096. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  57097. onClick: vue.withModifiers(close, ["stop"])
  57098. }, {
  57099. default: vue.withCtx(() => [
  57100. vue.createVNode(vue.unref(Close))
  57101. ]),
  57102. _: 1
  57103. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  57104. ], 46, ["id"]), [
  57105. [vue.vShow, visible.value]
  57106. ])
  57107. ]),
  57108. _: 3
  57109. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  57110. };
  57111. }
  57112. });
  57113. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  57114. let seed$1 = 1;
  57115. const normalizeOptions = (params) => {
  57116. const options = !params || isString$1(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
  57117. const normalized = {
  57118. ...messageDefaults,
  57119. ...options
  57120. };
  57121. if (!normalized.appendTo) {
  57122. normalized.appendTo = document.body;
  57123. } else if (isString$1(normalized.appendTo)) {
  57124. let appendTo = document.querySelector(normalized.appendTo);
  57125. if (!isElement$1(appendTo)) {
  57126. appendTo = document.body;
  57127. }
  57128. normalized.appendTo = appendTo;
  57129. }
  57130. if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
  57131. normalized.grouping = messageConfig.grouping;
  57132. }
  57133. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
  57134. normalized.duration = messageConfig.duration;
  57135. }
  57136. if (isNumber(messageConfig.offset) && normalized.offset === 16) {
  57137. normalized.offset = messageConfig.offset;
  57138. }
  57139. if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
  57140. normalized.showClose = messageConfig.showClose;
  57141. }
  57142. return normalized;
  57143. };
  57144. const closeMessage = (instance) => {
  57145. const idx = instances.indexOf(instance);
  57146. if (idx === -1)
  57147. return;
  57148. instances.splice(idx, 1);
  57149. const { handler } = instance;
  57150. handler.close();
  57151. };
  57152. const createMessage = ({ appendTo, ...options }, context) => {
  57153. const id = `message_${seed$1++}`;
  57154. const userOnClose = options.onClose;
  57155. const container = document.createElement("div");
  57156. const props = {
  57157. ...options,
  57158. id,
  57159. onClose: () => {
  57160. userOnClose == null ? void 0 : userOnClose();
  57161. closeMessage(instance);
  57162. },
  57163. onDestroy: () => {
  57164. vue.render(null, container);
  57165. }
  57166. };
  57167. const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  57168. default: isFunction$1(props.message) ? props.message : () => props.message
  57169. } : null);
  57170. vnode.appContext = context || message._context;
  57171. vue.render(vnode, container);
  57172. appendTo.appendChild(container.firstElementChild);
  57173. const vm = vnode.component;
  57174. const handler = {
  57175. close: () => {
  57176. vm.exposed.visible.value = false;
  57177. }
  57178. };
  57179. const instance = {
  57180. id,
  57181. vnode,
  57182. vm,
  57183. handler,
  57184. props: vnode.component.props
  57185. };
  57186. return instance;
  57187. };
  57188. const message = (options = {}, context) => {
  57189. if (!isClient)
  57190. return { close: () => void 0 };
  57191. const normalized = normalizeOptions(options);
  57192. if (normalized.grouping && instances.length) {
  57193. const instance2 = instances.find(({ vnode: vm }) => {
  57194. var _a;
  57195. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  57196. });
  57197. if (instance2) {
  57198. instance2.props.repeatNum += 1;
  57199. instance2.props.type = normalized.type;
  57200. return instance2.handler;
  57201. }
  57202. }
  57203. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  57204. return { close: () => void 0 };
  57205. }
  57206. const instance = createMessage(normalized, context);
  57207. instances.push(instance);
  57208. return instance.handler;
  57209. };
  57210. messageTypes.forEach((type) => {
  57211. message[type] = (options = {}, appContext) => {
  57212. const normalized = normalizeOptions(options);
  57213. return message({ ...normalized, type }, appContext);
  57214. };
  57215. });
  57216. function closeAll$1(type) {
  57217. for (const instance of instances) {
  57218. if (!type || type === instance.props.type) {
  57219. instance.handler.close();
  57220. }
  57221. }
  57222. }
  57223. message.closeAll = closeAll$1;
  57224. message._context = null;
  57225. var Message = message;
  57226. const ElMessage = withInstallFunction(Message, "$message");
  57227. const _sfc_main$1 = vue.defineComponent({
  57228. name: "ElMessageBox",
  57229. directives: {
  57230. TrapFocus
  57231. },
  57232. components: {
  57233. ElButton,
  57234. ElFocusTrap,
  57235. ElInput,
  57236. ElOverlay,
  57237. ElIcon,
  57238. ...TypeComponents
  57239. },
  57240. inheritAttrs: false,
  57241. props: {
  57242. buttonSize: {
  57243. type: String,
  57244. validator: isValidComponentSize
  57245. },
  57246. modal: {
  57247. type: Boolean,
  57248. default: true
  57249. },
  57250. lockScroll: {
  57251. type: Boolean,
  57252. default: true
  57253. },
  57254. showClose: {
  57255. type: Boolean,
  57256. default: true
  57257. },
  57258. closeOnClickModal: {
  57259. type: Boolean,
  57260. default: true
  57261. },
  57262. closeOnPressEscape: {
  57263. type: Boolean,
  57264. default: true
  57265. },
  57266. closeOnHashChange: {
  57267. type: Boolean,
  57268. default: true
  57269. },
  57270. center: Boolean,
  57271. draggable: Boolean,
  57272. overflow: Boolean,
  57273. roundButton: {
  57274. default: false,
  57275. type: Boolean
  57276. },
  57277. container: {
  57278. type: String,
  57279. default: "body"
  57280. },
  57281. boxType: {
  57282. type: String,
  57283. default: ""
  57284. }
  57285. },
  57286. emits: ["vanish", "action"],
  57287. setup(props, { emit }) {
  57288. const {
  57289. locale,
  57290. zIndex,
  57291. ns,
  57292. size: btnSize
  57293. } = useGlobalComponentSettings("message-box", vue.computed(() => props.buttonSize));
  57294. const { t } = locale;
  57295. const { nextZIndex } = zIndex;
  57296. const visible = vue.ref(false);
  57297. const state = vue.reactive({
  57298. autofocus: true,
  57299. beforeClose: null,
  57300. callback: null,
  57301. cancelButtonText: "",
  57302. cancelButtonClass: "",
  57303. confirmButtonText: "",
  57304. confirmButtonClass: "",
  57305. customClass: "",
  57306. customStyle: {},
  57307. dangerouslyUseHTMLString: false,
  57308. distinguishCancelAndClose: false,
  57309. icon: "",
  57310. inputPattern: null,
  57311. inputPlaceholder: "",
  57312. inputType: "text",
  57313. inputValue: null,
  57314. inputValidator: null,
  57315. inputErrorMessage: "",
  57316. message: null,
  57317. modalFade: true,
  57318. modalClass: "",
  57319. showCancelButton: false,
  57320. showConfirmButton: true,
  57321. type: "",
  57322. title: void 0,
  57323. showInput: false,
  57324. action: "",
  57325. confirmButtonLoading: false,
  57326. cancelButtonLoading: false,
  57327. confirmButtonLoadingIcon: vue.markRaw(loading_default),
  57328. cancelButtonLoadingIcon: vue.markRaw(loading_default),
  57329. confirmButtonDisabled: false,
  57330. editorErrorMessage: "",
  57331. validateError: false,
  57332. zIndex: nextZIndex()
  57333. });
  57334. const typeClass = vue.computed(() => {
  57335. const type = state.type;
  57336. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  57337. });
  57338. const contentId = useId();
  57339. const inputId = useId();
  57340. const iconComponent = vue.computed(() => state.icon || TypeComponentsMap[state.type] || "");
  57341. const hasMessage = vue.computed(() => !!state.message);
  57342. const rootRef = vue.ref();
  57343. const headerRef = vue.ref();
  57344. const focusStartRef = vue.ref();
  57345. const inputRef = vue.ref();
  57346. const confirmRef = vue.ref();
  57347. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  57348. vue.watch(() => state.inputValue, async (val) => {
  57349. await vue.nextTick();
  57350. if (props.boxType === "prompt" && val !== null) {
  57351. validate();
  57352. }
  57353. }, { immediate: true });
  57354. vue.watch(() => visible.value, (val) => {
  57355. var _a, _b;
  57356. if (val) {
  57357. if (props.boxType !== "prompt") {
  57358. if (state.autofocus) {
  57359. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  57360. } else {
  57361. focusStartRef.value = rootRef.value;
  57362. }
  57363. }
  57364. state.zIndex = nextZIndex();
  57365. }
  57366. if (props.boxType !== "prompt")
  57367. return;
  57368. if (val) {
  57369. vue.nextTick().then(() => {
  57370. var _a2;
  57371. if (inputRef.value && inputRef.value.$el) {
  57372. if (state.autofocus) {
  57373. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  57374. } else {
  57375. focusStartRef.value = rootRef.value;
  57376. }
  57377. }
  57378. });
  57379. } else {
  57380. state.editorErrorMessage = "";
  57381. state.validateError = false;
  57382. }
  57383. });
  57384. const draggable = vue.computed(() => props.draggable);
  57385. const overflow = vue.computed(() => props.overflow);
  57386. useDraggable(rootRef, headerRef, draggable, overflow);
  57387. vue.onMounted(async () => {
  57388. await vue.nextTick();
  57389. if (props.closeOnHashChange) {
  57390. window.addEventListener("hashchange", doClose);
  57391. }
  57392. });
  57393. vue.onBeforeUnmount(() => {
  57394. if (props.closeOnHashChange) {
  57395. window.removeEventListener("hashchange", doClose);
  57396. }
  57397. });
  57398. function doClose() {
  57399. if (!visible.value)
  57400. return;
  57401. visible.value = false;
  57402. vue.nextTick(() => {
  57403. if (state.action)
  57404. emit("action", state.action);
  57405. });
  57406. }
  57407. const handleWrapperClick = () => {
  57408. if (props.closeOnClickModal) {
  57409. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  57410. }
  57411. };
  57412. const overlayEvent = useSameTarget(handleWrapperClick);
  57413. const handleInputEnter = (e) => {
  57414. if (state.inputType !== "textarea") {
  57415. e.preventDefault();
  57416. return handleAction("confirm");
  57417. }
  57418. };
  57419. const handleAction = (action) => {
  57420. var _a;
  57421. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  57422. return;
  57423. }
  57424. state.action = action;
  57425. if (state.beforeClose) {
  57426. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  57427. } else {
  57428. doClose();
  57429. }
  57430. };
  57431. const validate = () => {
  57432. if (props.boxType === "prompt") {
  57433. const inputPattern = state.inputPattern;
  57434. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  57435. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  57436. state.validateError = true;
  57437. return false;
  57438. }
  57439. const inputValidator = state.inputValidator;
  57440. if (typeof inputValidator === "function") {
  57441. const validateResult = inputValidator(state.inputValue);
  57442. if (validateResult === false) {
  57443. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  57444. state.validateError = true;
  57445. return false;
  57446. }
  57447. if (typeof validateResult === "string") {
  57448. state.editorErrorMessage = validateResult;
  57449. state.validateError = true;
  57450. return false;
  57451. }
  57452. }
  57453. }
  57454. state.editorErrorMessage = "";
  57455. state.validateError = false;
  57456. return true;
  57457. };
  57458. const getInputElement = () => {
  57459. const inputRefs = inputRef.value.$refs;
  57460. return inputRefs.input || inputRefs.textarea;
  57461. };
  57462. const handleClose = () => {
  57463. handleAction("close");
  57464. };
  57465. const onCloseRequested = () => {
  57466. if (props.closeOnPressEscape) {
  57467. handleClose();
  57468. }
  57469. };
  57470. if (props.lockScroll) {
  57471. useLockscreen(visible);
  57472. }
  57473. return {
  57474. ...vue.toRefs(state),
  57475. ns,
  57476. overlayEvent,
  57477. visible,
  57478. hasMessage,
  57479. typeClass,
  57480. contentId,
  57481. inputId,
  57482. btnSize,
  57483. iconComponent,
  57484. confirmButtonClasses,
  57485. rootRef,
  57486. focusStartRef,
  57487. headerRef,
  57488. inputRef,
  57489. confirmRef,
  57490. doClose,
  57491. handleClose,
  57492. onCloseRequested,
  57493. handleWrapperClick,
  57494. handleInputEnter,
  57495. handleAction,
  57496. t
  57497. };
  57498. }
  57499. });
  57500. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  57501. const _component_el_icon = vue.resolveComponent("el-icon");
  57502. const _component_close = vue.resolveComponent("close");
  57503. const _component_el_input = vue.resolveComponent("el-input");
  57504. const _component_el_button = vue.resolveComponent("el-button");
  57505. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  57506. const _component_el_overlay = vue.resolveComponent("el-overlay");
  57507. return vue.openBlock(), vue.createBlock(vue.Transition, {
  57508. name: "fade-in-linear",
  57509. onAfterLeave: ($event) => _ctx.$emit("vanish"),
  57510. persisted: ""
  57511. }, {
  57512. default: vue.withCtx(() => [
  57513. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  57514. "z-index": _ctx.zIndex,
  57515. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  57516. mask: _ctx.modal
  57517. }, {
  57518. default: vue.withCtx(() => [
  57519. vue.createElementVNode("div", {
  57520. role: "dialog",
  57521. "aria-label": _ctx.title,
  57522. "aria-modal": "true",
  57523. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  57524. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  57525. onClick: _ctx.overlayEvent.onClick,
  57526. onMousedown: _ctx.overlayEvent.onMousedown,
  57527. onMouseup: _ctx.overlayEvent.onMouseup
  57528. }, [
  57529. vue.createVNode(_component_el_focus_trap, {
  57530. loop: "",
  57531. trapped: _ctx.visible,
  57532. "focus-trap-el": _ctx.rootRef,
  57533. "focus-start-el": _ctx.focusStartRef,
  57534. onReleaseRequested: _ctx.onCloseRequested
  57535. }, {
  57536. default: vue.withCtx(() => [
  57537. vue.createElementVNode("div", {
  57538. ref: "rootRef",
  57539. class: vue.normalizeClass([
  57540. _ctx.ns.b(),
  57541. _ctx.customClass,
  57542. _ctx.ns.is("draggable", _ctx.draggable),
  57543. { [_ctx.ns.m("center")]: _ctx.center }
  57544. ]),
  57545. style: vue.normalizeStyle(_ctx.customStyle),
  57546. tabindex: "-1",
  57547. onClick: vue.withModifiers(() => {
  57548. }, ["stop"])
  57549. }, [
  57550. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  57551. key: 0,
  57552. ref: "headerRef",
  57553. class: vue.normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  57554. }, [
  57555. vue.createElementVNode("div", {
  57556. class: vue.normalizeClass(_ctx.ns.e("title"))
  57557. }, [
  57558. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  57559. key: 0,
  57560. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  57561. }, {
  57562. default: vue.withCtx(() => [
  57563. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  57564. ]),
  57565. _: 1
  57566. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  57567. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  57568. ], 2),
  57569. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  57570. key: 0,
  57571. type: "button",
  57572. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  57573. "aria-label": _ctx.t("el.messagebox.close"),
  57574. onClick: ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"),
  57575. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])
  57576. }, [
  57577. vue.createVNode(_component_el_icon, {
  57578. class: vue.normalizeClass(_ctx.ns.e("close"))
  57579. }, {
  57580. default: vue.withCtx(() => [
  57581. vue.createVNode(_component_close)
  57582. ]),
  57583. _: 1
  57584. }, 8, ["class"])
  57585. ], 42, ["aria-label", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true)
  57586. ], 2)) : vue.createCommentVNode("v-if", true),
  57587. vue.createElementVNode("div", {
  57588. id: _ctx.contentId,
  57589. class: vue.normalizeClass(_ctx.ns.e("content"))
  57590. }, [
  57591. vue.createElementVNode("div", {
  57592. class: vue.normalizeClass(_ctx.ns.e("container"))
  57593. }, [
  57594. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  57595. key: 0,
  57596. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  57597. }, {
  57598. default: vue.withCtx(() => [
  57599. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  57600. ]),
  57601. _: 1
  57602. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  57603. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  57604. key: 1,
  57605. class: vue.normalizeClass(_ctx.ns.e("message"))
  57606. }, [
  57607. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  57608. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  57609. key: 0,
  57610. for: _ctx.showInput ? _ctx.inputId : void 0
  57611. }, {
  57612. default: vue.withCtx(() => [
  57613. vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  57614. ]),
  57615. _: 1
  57616. }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  57617. key: 1,
  57618. for: _ctx.showInput ? _ctx.inputId : void 0,
  57619. innerHTML: _ctx.message
  57620. }, null, 8, ["for", "innerHTML"]))
  57621. ])
  57622. ], 2)) : vue.createCommentVNode("v-if", true)
  57623. ], 2),
  57624. vue.withDirectives(vue.createElementVNode("div", {
  57625. class: vue.normalizeClass(_ctx.ns.e("input"))
  57626. }, [
  57627. vue.createVNode(_component_el_input, {
  57628. id: _ctx.inputId,
  57629. ref: "inputRef",
  57630. modelValue: _ctx.inputValue,
  57631. "onUpdate:modelValue": ($event) => _ctx.inputValue = $event,
  57632. type: _ctx.inputType,
  57633. placeholder: _ctx.inputPlaceholder,
  57634. "aria-invalid": _ctx.validateError,
  57635. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  57636. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  57637. }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  57638. vue.createElementVNode("div", {
  57639. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  57640. style: vue.normalizeStyle({
  57641. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  57642. })
  57643. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  57644. ], 2), [
  57645. [vue.vShow, _ctx.showInput]
  57646. ])
  57647. ], 10, ["id"]),
  57648. vue.createElementVNode("div", {
  57649. class: vue.normalizeClass(_ctx.ns.e("btns"))
  57650. }, [
  57651. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  57652. key: 0,
  57653. loading: _ctx.cancelButtonLoading,
  57654. "loading-icon": _ctx.cancelButtonLoadingIcon,
  57655. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  57656. round: _ctx.roundButton,
  57657. size: _ctx.btnSize,
  57658. onClick: ($event) => _ctx.handleAction("cancel"),
  57659. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])
  57660. }, {
  57661. default: vue.withCtx(() => [
  57662. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  57663. ]),
  57664. _: 1
  57665. }, 8, ["loading", "loading-icon", "class", "round", "size", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true),
  57666. vue.withDirectives(vue.createVNode(_component_el_button, {
  57667. ref: "confirmRef",
  57668. type: "primary",
  57669. loading: _ctx.confirmButtonLoading,
  57670. "loading-icon": _ctx.confirmButtonLoadingIcon,
  57671. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  57672. round: _ctx.roundButton,
  57673. disabled: _ctx.confirmButtonDisabled,
  57674. size: _ctx.btnSize,
  57675. onClick: ($event) => _ctx.handleAction("confirm"),
  57676. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])
  57677. }, {
  57678. default: vue.withCtx(() => [
  57679. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  57680. ]),
  57681. _: 1
  57682. }, 8, ["loading", "loading-icon", "class", "round", "disabled", "size", "onClick", "onKeydown"]), [
  57683. [vue.vShow, _ctx.showConfirmButton]
  57684. ])
  57685. ], 2)
  57686. ], 14, ["onClick"])
  57687. ]),
  57688. _: 3
  57689. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  57690. ], 42, ["aria-label", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  57691. ]),
  57692. _: 3
  57693. }, 8, ["z-index", "overlay-class", "mask"]), [
  57694. [vue.vShow, _ctx.visible]
  57695. ])
  57696. ]),
  57697. _: 3
  57698. }, 8, ["onAfterLeave"]);
  57699. }
  57700. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  57701. const messageInstance = /* @__PURE__ */ new Map();
  57702. const getAppendToElement = (props) => {
  57703. let appendTo = document.body;
  57704. if (props.appendTo) {
  57705. if (isString$1(props.appendTo)) {
  57706. appendTo = document.querySelector(props.appendTo);
  57707. }
  57708. if (isElement$1(props.appendTo)) {
  57709. appendTo = props.appendTo;
  57710. }
  57711. if (!isElement$1(appendTo)) {
  57712. appendTo = document.body;
  57713. }
  57714. }
  57715. return appendTo;
  57716. };
  57717. const initInstance = (props, container, appContext = null) => {
  57718. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  57719. default: isFunction$1(props.message) ? props.message : () => props.message
  57720. } : null);
  57721. vnode.appContext = appContext;
  57722. vue.render(vnode, container);
  57723. getAppendToElement(props).appendChild(container.firstElementChild);
  57724. return vnode.component;
  57725. };
  57726. const genContainer = () => {
  57727. return document.createElement("div");
  57728. };
  57729. const showMessage = (options, appContext) => {
  57730. const container = genContainer();
  57731. options.onVanish = () => {
  57732. vue.render(null, container);
  57733. messageInstance.delete(vm);
  57734. };
  57735. options.onAction = (action) => {
  57736. const currentMsg = messageInstance.get(vm);
  57737. let resolve;
  57738. if (options.showInput) {
  57739. resolve = { value: vm.inputValue, action };
  57740. } else {
  57741. resolve = action;
  57742. }
  57743. if (options.callback) {
  57744. options.callback(resolve, instance.proxy);
  57745. } else {
  57746. if (action === "cancel" || action === "close") {
  57747. if (options.distinguishCancelAndClose && action !== "cancel") {
  57748. currentMsg.reject("close");
  57749. } else {
  57750. currentMsg.reject("cancel");
  57751. }
  57752. } else {
  57753. currentMsg.resolve(resolve);
  57754. }
  57755. }
  57756. };
  57757. const instance = initInstance(options, container, appContext);
  57758. const vm = instance.proxy;
  57759. for (const prop in options) {
  57760. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  57761. vm[prop] = options[prop];
  57762. }
  57763. }
  57764. vm.visible = true;
  57765. return vm;
  57766. };
  57767. function MessageBox(options, appContext = null) {
  57768. if (!isClient)
  57769. return Promise.reject();
  57770. let callback;
  57771. if (isString$1(options) || vue.isVNode(options)) {
  57772. options = {
  57773. message: options
  57774. };
  57775. } else {
  57776. callback = options.callback;
  57777. }
  57778. return new Promise((resolve, reject) => {
  57779. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  57780. messageInstance.set(vm, {
  57781. options,
  57782. callback,
  57783. resolve,
  57784. reject
  57785. });
  57786. });
  57787. }
  57788. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  57789. const MESSAGE_BOX_DEFAULT_OPTS = {
  57790. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  57791. confirm: { showCancelButton: true },
  57792. prompt: { showCancelButton: true, showInput: true }
  57793. };
  57794. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  57795. MessageBox[boxType] = messageBoxFactory(boxType);
  57796. });
  57797. function messageBoxFactory(boxType) {
  57798. return (message, title, options, appContext) => {
  57799. let titleOrOpts = "";
  57800. if (isObject$1(title)) {
  57801. options = title;
  57802. titleOrOpts = "";
  57803. } else if (isUndefined(title)) {
  57804. titleOrOpts = "";
  57805. } else {
  57806. titleOrOpts = title;
  57807. }
  57808. return MessageBox(Object.assign({
  57809. title: titleOrOpts,
  57810. message,
  57811. type: "",
  57812. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  57813. }, options, {
  57814. boxType
  57815. }), appContext);
  57816. };
  57817. }
  57818. MessageBox.close = () => {
  57819. messageInstance.forEach((_, vm) => {
  57820. vm.doClose();
  57821. });
  57822. messageInstance.clear();
  57823. };
  57824. MessageBox._context = null;
  57825. const _MessageBox = MessageBox;
  57826. _MessageBox.install = (app) => {
  57827. _MessageBox._context = app._context;
  57828. app.config.globalProperties.$msgbox = _MessageBox;
  57829. app.config.globalProperties.$messageBox = _MessageBox;
  57830. app.config.globalProperties.$alert = _MessageBox.alert;
  57831. app.config.globalProperties.$confirm = _MessageBox.confirm;
  57832. app.config.globalProperties.$prompt = _MessageBox.prompt;
  57833. };
  57834. const ElMessageBox = _MessageBox;
  57835. const notificationTypes = [
  57836. "success",
  57837. "info",
  57838. "warning",
  57839. "error"
  57840. ];
  57841. const notificationProps = buildProps({
  57842. customClass: {
  57843. type: String,
  57844. default: ""
  57845. },
  57846. dangerouslyUseHTMLString: Boolean,
  57847. duration: {
  57848. type: Number,
  57849. default: 4500
  57850. },
  57851. icon: {
  57852. type: iconPropType
  57853. },
  57854. id: {
  57855. type: String,
  57856. default: ""
  57857. },
  57858. message: {
  57859. type: definePropType([String, Object]),
  57860. default: ""
  57861. },
  57862. offset: {
  57863. type: Number,
  57864. default: 0
  57865. },
  57866. onClick: {
  57867. type: definePropType(Function),
  57868. default: () => void 0
  57869. },
  57870. onClose: {
  57871. type: definePropType(Function),
  57872. required: true
  57873. },
  57874. position: {
  57875. type: String,
  57876. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  57877. default: "top-right"
  57878. },
  57879. showClose: {
  57880. type: Boolean,
  57881. default: true
  57882. },
  57883. title: {
  57884. type: String,
  57885. default: ""
  57886. },
  57887. type: {
  57888. type: String,
  57889. values: [...notificationTypes, ""],
  57890. default: ""
  57891. },
  57892. zIndex: Number
  57893. });
  57894. const notificationEmits = {
  57895. destroy: () => true
  57896. };
  57897. const __default__ = vue.defineComponent({
  57898. name: "ElNotification"
  57899. });
  57900. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  57901. ...__default__,
  57902. props: notificationProps,
  57903. emits: notificationEmits,
  57904. setup(__props, { expose }) {
  57905. const props = __props;
  57906. const { ns, zIndex } = useGlobalComponentSettings("notification");
  57907. const { nextZIndex, currentZIndex } = zIndex;
  57908. const { Close } = CloseComponents;
  57909. const visible = vue.ref(false);
  57910. let timer = void 0;
  57911. const typeClass = vue.computed(() => {
  57912. const type = props.type;
  57913. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  57914. });
  57915. const iconComponent = vue.computed(() => {
  57916. if (!props.type)
  57917. return props.icon;
  57918. return TypeComponentsMap[props.type] || props.icon;
  57919. });
  57920. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  57921. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  57922. const positionStyle = vue.computed(() => {
  57923. var _a;
  57924. return {
  57925. [verticalProperty.value]: `${props.offset}px`,
  57926. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  57927. };
  57928. });
  57929. function startTimer() {
  57930. if (props.duration > 0) {
  57931. ({ stop: timer } = useTimeoutFn(() => {
  57932. if (visible.value)
  57933. close();
  57934. }, props.duration));
  57935. }
  57936. }
  57937. function clearTimer() {
  57938. timer == null ? void 0 : timer();
  57939. }
  57940. function close() {
  57941. visible.value = false;
  57942. }
  57943. function onKeydown({ code }) {
  57944. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  57945. clearTimer();
  57946. } else if (code === EVENT_CODE.esc) {
  57947. if (visible.value) {
  57948. close();
  57949. }
  57950. } else {
  57951. startTimer();
  57952. }
  57953. }
  57954. vue.onMounted(() => {
  57955. startTimer();
  57956. nextZIndex();
  57957. visible.value = true;
  57958. });
  57959. useEventListener(document, "keydown", onKeydown);
  57960. expose({
  57961. visible,
  57962. close
  57963. });
  57964. return (_ctx, _cache) => {
  57965. return vue.openBlock(), vue.createBlock(vue.Transition, {
  57966. name: vue.unref(ns).b("fade"),
  57967. onBeforeLeave: _ctx.onClose,
  57968. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  57969. persisted: ""
  57970. }, {
  57971. default: vue.withCtx(() => [
  57972. vue.withDirectives(vue.createElementVNode("div", {
  57973. id: _ctx.id,
  57974. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  57975. style: vue.normalizeStyle(vue.unref(positionStyle)),
  57976. role: "alert",
  57977. onMouseenter: clearTimer,
  57978. onMouseleave: startTimer,
  57979. onClick: _ctx.onClick
  57980. }, [
  57981. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  57982. key: 0,
  57983. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  57984. }, {
  57985. default: vue.withCtx(() => [
  57986. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  57987. ]),
  57988. _: 1
  57989. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  57990. vue.createElementVNode("div", {
  57991. class: vue.normalizeClass(vue.unref(ns).e("group"))
  57992. }, [
  57993. vue.createElementVNode("h2", {
  57994. class: vue.normalizeClass(vue.unref(ns).e("title")),
  57995. textContent: vue.toDisplayString(_ctx.title)
  57996. }, null, 10, ["textContent"]),
  57997. vue.withDirectives(vue.createElementVNode("div", {
  57998. class: vue.normalizeClass(vue.unref(ns).e("content")),
  57999. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  58000. }, [
  58001. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  58002. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", { key: 0 }, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  58003. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  58004. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, ["innerHTML"])
  58005. ], 2112))
  58006. ])
  58007. ], 6), [
  58008. [vue.vShow, _ctx.message]
  58009. ]),
  58010. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  58011. key: 0,
  58012. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  58013. onClick: vue.withModifiers(close, ["stop"])
  58014. }, {
  58015. default: vue.withCtx(() => [
  58016. vue.createVNode(vue.unref(Close))
  58017. ]),
  58018. _: 1
  58019. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  58020. ], 2)
  58021. ], 46, ["id", "onClick"]), [
  58022. [vue.vShow, visible.value]
  58023. ])
  58024. ]),
  58025. _: 3
  58026. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  58027. };
  58028. }
  58029. });
  58030. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  58031. const notifications = {
  58032. "top-left": [],
  58033. "top-right": [],
  58034. "bottom-left": [],
  58035. "bottom-right": []
  58036. };
  58037. const GAP_SIZE = 16;
  58038. let seed = 1;
  58039. const notify = function(options = {}, context = null) {
  58040. if (!isClient)
  58041. return { close: () => void 0 };
  58042. if (typeof options === "string" || vue.isVNode(options)) {
  58043. options = { message: options };
  58044. }
  58045. const position = options.position || "top-right";
  58046. let verticalOffset = options.offset || 0;
  58047. notifications[position].forEach(({ vm: vm2 }) => {
  58048. var _a;
  58049. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  58050. });
  58051. verticalOffset += GAP_SIZE;
  58052. const id = `notification_${seed++}`;
  58053. const userOnClose = options.onClose;
  58054. const props = {
  58055. ...options,
  58056. offset: verticalOffset,
  58057. id,
  58058. onClose: () => {
  58059. close(id, position, userOnClose);
  58060. }
  58061. };
  58062. let appendTo = document.body;
  58063. if (isElement$1(options.appendTo)) {
  58064. appendTo = options.appendTo;
  58065. } else if (isString$1(options.appendTo)) {
  58066. appendTo = document.querySelector(options.appendTo);
  58067. }
  58068. if (!isElement$1(appendTo)) {
  58069. appendTo = document.body;
  58070. }
  58071. const container = document.createElement("div");
  58072. const vm = vue.createVNode(NotificationConstructor, props, vue.isVNode(props.message) ? {
  58073. default: () => props.message
  58074. } : null);
  58075. vm.appContext = context != null ? context : notify._context;
  58076. vm.props.onDestroy = () => {
  58077. vue.render(null, container);
  58078. };
  58079. vue.render(vm, container);
  58080. notifications[position].push({ vm });
  58081. appendTo.appendChild(container.firstElementChild);
  58082. return {
  58083. close: () => {
  58084. vm.component.exposed.visible.value = false;
  58085. }
  58086. };
  58087. };
  58088. notificationTypes.forEach((type) => {
  58089. notify[type] = (options = {}) => {
  58090. if (typeof options === "string" || vue.isVNode(options)) {
  58091. options = {
  58092. message: options
  58093. };
  58094. }
  58095. return notify({
  58096. ...options,
  58097. type
  58098. });
  58099. };
  58100. });
  58101. function close(id, position, userOnClose) {
  58102. const orientedNotifications = notifications[position];
  58103. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  58104. var _a;
  58105. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  58106. });
  58107. if (idx === -1)
  58108. return;
  58109. const { vm } = orientedNotifications[idx];
  58110. if (!vm)
  58111. return;
  58112. userOnClose == null ? void 0 : userOnClose(vm);
  58113. const removedHeight = vm.el.offsetHeight;
  58114. const verticalPos = position.split("-")[0];
  58115. orientedNotifications.splice(idx, 1);
  58116. const len = orientedNotifications.length;
  58117. if (len < 1)
  58118. return;
  58119. for (let i = idx; i < len; i++) {
  58120. const { el, component } = orientedNotifications[i].vm;
  58121. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  58122. component.props.offset = pos;
  58123. }
  58124. }
  58125. function closeAll() {
  58126. for (const orientedNotifications of Object.values(notifications)) {
  58127. orientedNotifications.forEach(({ vm }) => {
  58128. vm.component.exposed.visible.value = false;
  58129. });
  58130. }
  58131. }
  58132. notify.closeAll = closeAll;
  58133. notify._context = null;
  58134. var Notify = notify;
  58135. const ElNotification = withInstallFunction(Notify, "$notify");
  58136. var Plugins = [
  58137. ElInfiniteScroll,
  58138. ElLoading,
  58139. ElMessage,
  58140. ElMessageBox,
  58141. ElNotification,
  58142. ElPopoverDirective
  58143. ];
  58144. var installer = makeInstaller([...Components, ...Plugins]);
  58145. const install = installer.install;
  58146. const version = installer.version;
  58147. exports.BAR_MAP = BAR_MAP;
  58148. exports.CAROUSEL_ITEM_NAME = CAROUSEL_ITEM_NAME;
  58149. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  58150. exports.CHANGE_EVENT = CHANGE_EVENT;
  58151. exports.ClickOutside = ClickOutside;
  58152. exports.CommonPicker = CommonPicker;
  58153. exports.CommonProps = CommonProps;
  58154. exports.DEFAULT_EMPTY_VALUES = DEFAULT_EMPTY_VALUES;
  58155. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  58156. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  58157. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  58158. exports.DEFAULT_VALUE_ON_CLEAR = DEFAULT_VALUE_ON_CLEAR;
  58159. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  58160. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  58161. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  58162. exports.DefaultProps = DefaultProps;
  58163. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  58164. exports.DynamicSizeList = DynamicSizeList$1;
  58165. exports.EVENT_CODE = EVENT_CODE;
  58166. exports.Effect = Effect;
  58167. exports.ElAffix = ElAffix;
  58168. exports.ElAlert = ElAlert;
  58169. exports.ElAnchor = ElAnchor;
  58170. exports.ElAnchorLink = ElAnchorLink;
  58171. exports.ElAside = ElAside;
  58172. exports.ElAutoResizer = ElAutoResizer;
  58173. exports.ElAutocomplete = ElAutocomplete;
  58174. exports.ElAvatar = ElAvatar;
  58175. exports.ElBacktop = ElBacktop;
  58176. exports.ElBadge = ElBadge;
  58177. exports.ElBreadcrumb = ElBreadcrumb;
  58178. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  58179. exports.ElButton = ElButton;
  58180. exports.ElButtonGroup = ElButtonGroup$1;
  58181. exports.ElCalendar = ElCalendar;
  58182. exports.ElCard = ElCard;
  58183. exports.ElCarousel = ElCarousel;
  58184. exports.ElCarouselItem = ElCarouselItem;
  58185. exports.ElCascader = ElCascader;
  58186. exports.ElCascaderPanel = ElCascaderPanel;
  58187. exports.ElCheckTag = ElCheckTag;
  58188. exports.ElCheckbox = ElCheckbox;
  58189. exports.ElCheckboxButton = ElCheckboxButton;
  58190. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  58191. exports.ElCol = ElCol;
  58192. exports.ElCollapse = ElCollapse;
  58193. exports.ElCollapseItem = ElCollapseItem;
  58194. exports.ElCollapseTransition = ElCollapseTransition;
  58195. exports.ElCollection = ElCollection;
  58196. exports.ElCollectionItem = ElCollectionItem;
  58197. exports.ElColorPicker = ElColorPicker;
  58198. exports.ElConfigProvider = ElConfigProvider;
  58199. exports.ElContainer = ElContainer;
  58200. exports.ElCountdown = ElCountdown;
  58201. exports.ElDatePicker = ElDatePicker;
  58202. exports.ElDescriptions = ElDescriptions;
  58203. exports.ElDescriptionsItem = ElDescriptionsItem;
  58204. exports.ElDialog = ElDialog;
  58205. exports.ElDivider = ElDivider;
  58206. exports.ElDrawer = ElDrawer;
  58207. exports.ElDropdown = ElDropdown;
  58208. exports.ElDropdownItem = ElDropdownItem;
  58209. exports.ElDropdownMenu = ElDropdownMenu;
  58210. exports.ElEmpty = ElEmpty;
  58211. exports.ElFooter = ElFooter;
  58212. exports.ElForm = ElForm;
  58213. exports.ElFormItem = ElFormItem;
  58214. exports.ElHeader = ElHeader;
  58215. exports.ElIcon = ElIcon;
  58216. exports.ElImage = ElImage;
  58217. exports.ElImageViewer = ElImageViewer;
  58218. exports.ElInfiniteScroll = ElInfiniteScroll;
  58219. exports.ElInput = ElInput;
  58220. exports.ElInputNumber = ElInputNumber;
  58221. exports.ElLink = ElLink;
  58222. exports.ElLoading = ElLoading;
  58223. exports.ElLoadingDirective = vLoading;
  58224. exports.ElLoadingService = Loading;
  58225. exports.ElMain = ElMain;
  58226. exports.ElMention = ElMention;
  58227. exports.ElMenu = ElMenu;
  58228. exports.ElMenuItem = ElMenuItem;
  58229. exports.ElMenuItemGroup = ElMenuItemGroup;
  58230. exports.ElMessage = ElMessage;
  58231. exports.ElMessageBox = ElMessageBox;
  58232. exports.ElNotification = ElNotification;
  58233. exports.ElOption = ElOption;
  58234. exports.ElOptionGroup = ElOptionGroup;
  58235. exports.ElOverlay = ElOverlay;
  58236. exports.ElPageHeader = ElPageHeader;
  58237. exports.ElPagination = ElPagination;
  58238. exports.ElPopconfirm = ElPopconfirm;
  58239. exports.ElPopover = ElPopover;
  58240. exports.ElPopoverDirective = ElPopoverDirective;
  58241. exports.ElPopper = ElPopper;
  58242. exports.ElPopperArrow = ElPopperArrow;
  58243. exports.ElPopperContent = ElPopperContent;
  58244. exports.ElPopperTrigger = ElPopperTrigger;
  58245. exports.ElProgress = ElProgress;
  58246. exports.ElRadio = ElRadio;
  58247. exports.ElRadioButton = ElRadioButton;
  58248. exports.ElRadioGroup = ElRadioGroup;
  58249. exports.ElRate = ElRate;
  58250. exports.ElResult = ElResult;
  58251. exports.ElRow = ElRow;
  58252. exports.ElScrollbar = ElScrollbar;
  58253. exports.ElSegmented = ElSegmented;
  58254. exports.ElSelect = ElSelect;
  58255. exports.ElSelectV2 = ElSelectV2;
  58256. exports.ElSkeleton = ElSkeleton;
  58257. exports.ElSkeletonItem = ElSkeletonItem;
  58258. exports.ElSlider = ElSlider;
  58259. exports.ElSpace = ElSpace;
  58260. exports.ElStatistic = ElStatistic;
  58261. exports.ElStep = ElStep;
  58262. exports.ElSteps = ElSteps;
  58263. exports.ElSubMenu = ElSubMenu;
  58264. exports.ElSwitch = ElSwitch;
  58265. exports.ElTabPane = ElTabPane;
  58266. exports.ElTable = ElTable;
  58267. exports.ElTableColumn = ElTableColumn;
  58268. exports.ElTableV2 = ElTableV2;
  58269. exports.ElTabs = ElTabs;
  58270. exports.ElTag = ElTag;
  58271. exports.ElText = ElText;
  58272. exports.ElTimePicker = ElTimePicker;
  58273. exports.ElTimeSelect = ElTimeSelect;
  58274. exports.ElTimeline = ElTimeline;
  58275. exports.ElTimelineItem = ElTimelineItem;
  58276. exports.ElTooltip = ElTooltip;
  58277. exports.ElTour = ElTour;
  58278. exports.ElTourStep = ElTourStep;
  58279. exports.ElTransfer = ElTransfer;
  58280. exports.ElTree = ElTree;
  58281. exports.ElTreeSelect = ElTreeSelect;
  58282. exports.ElTreeV2 = ElTreeV2;
  58283. exports.ElUpload = ElUpload;
  58284. exports.ElWatermark = ElWatermark;
  58285. exports.FIRST_KEYS = FIRST_KEYS;
  58286. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  58287. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  58288. exports.FixedSizeGrid = FixedSizeGrid$1;
  58289. exports.FixedSizeList = FixedSizeList$1;
  58290. exports.GAP = GAP;
  58291. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  58292. exports.INPUT_EVENT = INPUT_EVENT;
  58293. exports.INSTALLED_KEY = INSTALLED_KEY;
  58294. exports.IconComponentMap = IconComponentMap;
  58295. exports.IconMap = IconMap;
  58296. exports.LAST_KEYS = LAST_KEYS;
  58297. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  58298. exports.Mousewheel = Mousewheel;
  58299. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  58300. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  58301. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  58302. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  58303. exports.RowAlign = RowAlign;
  58304. exports.RowJustify = RowJustify;
  58305. exports.SCOPE = SCOPE$3;
  58306. exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY;
  58307. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  58308. exports.TableV2 = TableV2$1;
  58309. exports.TableV2Alignment = Alignment;
  58310. exports.TableV2FixedDir = FixedDir;
  58311. exports.TableV2Placeholder = placeholderSign;
  58312. exports.TableV2SortOrder = SortOrder;
  58313. exports.TimePickPanel = TimePickPanel;
  58314. exports.TrapFocus = TrapFocus;
  58315. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  58316. exports.WEEK_DAYS = WEEK_DAYS;
  58317. exports.ZINDEX_INJECTION_KEY = ZINDEX_INJECTION_KEY;
  58318. exports.affixEmits = affixEmits;
  58319. exports.affixProps = affixProps;
  58320. exports.alertEffects = alertEffects;
  58321. exports.alertEmits = alertEmits;
  58322. exports.alertProps = alertProps;
  58323. exports.anchorEmits = anchorEmits;
  58324. exports.anchorProps = anchorProps;
  58325. exports.ariaProps = ariaProps;
  58326. exports.arrowMiddleware = arrowMiddleware;
  58327. exports.autoResizerProps = autoResizerProps;
  58328. exports.autocompleteEmits = autocompleteEmits;
  58329. exports.autocompleteProps = autocompleteProps;
  58330. exports.avatarEmits = avatarEmits;
  58331. exports.avatarProps = avatarProps;
  58332. exports.backtopEmits = backtopEmits;
  58333. exports.backtopProps = backtopProps;
  58334. exports.badgeProps = badgeProps;
  58335. exports.breadcrumbItemProps = breadcrumbItemProps;
  58336. exports.breadcrumbKey = breadcrumbKey;
  58337. exports.breadcrumbProps = breadcrumbProps;
  58338. exports.buildLocaleContext = buildLocaleContext;
  58339. exports.buildTimeList = buildTimeList;
  58340. exports.buildTranslator = buildTranslator;
  58341. exports.buttonEmits = buttonEmits;
  58342. exports.buttonGroupContextKey = buttonGroupContextKey;
  58343. exports.buttonNativeTypes = buttonNativeTypes;
  58344. exports.buttonProps = buttonProps;
  58345. exports.buttonTypes = buttonTypes;
  58346. exports.calendarEmits = calendarEmits;
  58347. exports.calendarProps = calendarProps;
  58348. exports.cardProps = cardProps;
  58349. exports.carouselContextKey = carouselContextKey;
  58350. exports.carouselEmits = carouselEmits;
  58351. exports.carouselItemProps = carouselItemProps;
  58352. exports.carouselProps = carouselProps;
  58353. exports.cascaderEmits = cascaderEmits;
  58354. exports.cascaderProps = cascaderProps;
  58355. exports.checkTagEmits = checkTagEmits;
  58356. exports.checkTagProps = checkTagProps;
  58357. exports.checkboxEmits = checkboxEmits;
  58358. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  58359. exports.checkboxGroupEmits = checkboxGroupEmits;
  58360. exports.checkboxGroupProps = checkboxGroupProps;
  58361. exports.checkboxProps = checkboxProps;
  58362. exports.colProps = colProps;
  58363. exports.collapseContextKey = collapseContextKey;
  58364. exports.collapseEmits = collapseEmits;
  58365. exports.collapseItemProps = collapseItemProps;
  58366. exports.collapseProps = collapseProps;
  58367. exports.colorPickerContextKey = colorPickerContextKey;
  58368. exports.colorPickerEmits = colorPickerEmits;
  58369. exports.colorPickerProps = colorPickerProps;
  58370. exports.componentSizeMap = componentSizeMap;
  58371. exports.componentSizes = componentSizes;
  58372. exports.configProviderContextKey = configProviderContextKey;
  58373. exports.configProviderProps = configProviderProps;
  58374. exports.countdownEmits = countdownEmits;
  58375. exports.countdownProps = countdownProps;
  58376. exports.createModelToggleComposable = createModelToggleComposable;
  58377. exports.dateEquals = dateEquals;
  58378. exports.datePickTypes = datePickTypes;
  58379. exports.datePickerProps = datePickerProps;
  58380. exports.dayjs = dayjs;
  58381. exports["default"] = installer;
  58382. exports.defaultInitialZIndex = defaultInitialZIndex;
  58383. exports.defaultNamespace = defaultNamespace;
  58384. exports.descriptionItemProps = descriptionItemProps;
  58385. exports.descriptionProps = descriptionProps;
  58386. exports.dialogEmits = dialogEmits;
  58387. exports.dialogInjectionKey = dialogInjectionKey;
  58388. exports.dialogProps = dialogProps;
  58389. exports.dividerProps = dividerProps;
  58390. exports.drawerEmits = drawerEmits;
  58391. exports.drawerProps = drawerProps;
  58392. exports.dropdownItemProps = dropdownItemProps;
  58393. exports.dropdownMenuProps = dropdownMenuProps;
  58394. exports.dropdownProps = dropdownProps;
  58395. exports.elPaginationKey = elPaginationKey;
  58396. exports.emitChangeFn = emitChangeFn;
  58397. exports.emptyProps = emptyProps;
  58398. exports.emptyValuesContextKey = emptyValuesContextKey;
  58399. exports.extractDateFormat = extractDateFormat;
  58400. exports.extractTimeFormat = extractTimeFormat;
  58401. exports.formContextKey = formContextKey;
  58402. exports.formEmits = formEmits;
  58403. exports.formItemContextKey = formItemContextKey;
  58404. exports.formItemProps = formItemProps;
  58405. exports.formItemValidateStates = formItemValidateStates;
  58406. exports.formMetaProps = formMetaProps;
  58407. exports.formProps = formProps;
  58408. exports.formatter = formatter;
  58409. exports.genFileId = genFileId;
  58410. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  58411. exports.iconProps = iconProps;
  58412. exports.imageEmits = imageEmits;
  58413. exports.imageProps = imageProps;
  58414. exports.imageViewerEmits = imageViewerEmits;
  58415. exports.imageViewerProps = imageViewerProps;
  58416. exports.inputEmits = inputEmits;
  58417. exports.inputNumberEmits = inputNumberEmits;
  58418. exports.inputNumberProps = inputNumberProps;
  58419. exports.inputProps = inputProps;
  58420. exports.install = install;
  58421. exports.linkEmits = linkEmits;
  58422. exports.linkProps = linkProps;
  58423. exports.localeContextKey = localeContextKey;
  58424. exports.makeInstaller = makeInstaller;
  58425. exports.makeList = makeList;
  58426. exports.mentionEmits = mentionEmits;
  58427. exports.mentionProps = mentionProps;
  58428. exports.menuEmits = menuEmits;
  58429. exports.menuItemEmits = menuItemEmits;
  58430. exports.menuItemGroupProps = menuItemGroupProps;
  58431. exports.menuItemProps = menuItemProps;
  58432. exports.menuProps = menuProps;
  58433. exports.messageConfig = messageConfig;
  58434. exports.messageDefaults = messageDefaults;
  58435. exports.messageEmits = messageEmits;
  58436. exports.messageProps = messageProps;
  58437. exports.messageTypes = messageTypes;
  58438. exports.namespaceContextKey = namespaceContextKey;
  58439. exports.notificationEmits = notificationEmits;
  58440. exports.notificationProps = notificationProps;
  58441. exports.notificationTypes = notificationTypes;
  58442. exports.overlayEmits = overlayEmits;
  58443. exports.overlayProps = overlayProps;
  58444. exports.pageHeaderEmits = pageHeaderEmits;
  58445. exports.pageHeaderProps = pageHeaderProps;
  58446. exports.paginationEmits = paginationEmits;
  58447. exports.paginationProps = paginationProps;
  58448. exports.parseDate = parseDate;
  58449. exports.popconfirmEmits = popconfirmEmits;
  58450. exports.popconfirmProps = popconfirmProps;
  58451. exports.popoverEmits = popoverEmits;
  58452. exports.popoverProps = popoverProps;
  58453. exports.popperArrowProps = popperArrowProps;
  58454. exports.popperContentEmits = popperContentEmits;
  58455. exports.popperContentProps = popperContentProps;
  58456. exports.popperCoreConfigProps = popperCoreConfigProps;
  58457. exports.popperProps = popperProps;
  58458. exports.popperTriggerProps = popperTriggerProps;
  58459. exports.progressProps = progressProps;
  58460. exports.provideGlobalConfig = provideGlobalConfig;
  58461. exports.radioButtonProps = radioButtonProps;
  58462. exports.radioEmits = radioEmits;
  58463. exports.radioGroupEmits = radioGroupEmits;
  58464. exports.radioGroupKey = radioGroupKey;
  58465. exports.radioGroupProps = radioGroupProps;
  58466. exports.radioProps = radioProps;
  58467. exports.radioPropsBase = radioPropsBase;
  58468. exports.rangeArr = rangeArr;
  58469. exports.rateEmits = rateEmits;
  58470. exports.rateProps = rateProps;
  58471. exports.renderThumbStyle = renderThumbStyle$1;
  58472. exports.resultProps = resultProps;
  58473. exports.roleTypes = roleTypes;
  58474. exports.rowContextKey = rowContextKey;
  58475. exports.rowProps = rowProps;
  58476. exports.scrollbarContextKey = scrollbarContextKey;
  58477. exports.scrollbarEmits = scrollbarEmits;
  58478. exports.scrollbarProps = scrollbarProps;
  58479. exports.segmentedEmits = segmentedEmits;
  58480. exports.segmentedProps = segmentedProps;
  58481. exports.selectGroupKey = selectGroupKey;
  58482. exports.selectKey = selectKey;
  58483. exports.selectV2InjectionKey = selectV2InjectionKey;
  58484. exports.skeletonItemProps = skeletonItemProps;
  58485. exports.skeletonProps = skeletonProps;
  58486. exports.sliderContextKey = sliderContextKey;
  58487. exports.sliderEmits = sliderEmits;
  58488. exports.sliderProps = sliderProps;
  58489. exports.spaceItemProps = spaceItemProps;
  58490. exports.spaceProps = spaceProps;
  58491. exports.statisticProps = statisticProps;
  58492. exports.stepProps = stepProps;
  58493. exports.stepsEmits = stepsEmits;
  58494. exports.stepsProps = stepsProps;
  58495. exports.subMenuProps = subMenuProps;
  58496. exports.switchEmits = switchEmits;
  58497. exports.switchProps = switchProps;
  58498. exports.tabBarProps = tabBarProps;
  58499. exports.tabNavEmits = tabNavEmits;
  58500. exports.tabNavProps = tabNavProps;
  58501. exports.tabPaneProps = tabPaneProps;
  58502. exports.tableV2Props = tableV2Props;
  58503. exports.tableV2RowProps = tableV2RowProps;
  58504. exports.tabsEmits = tabsEmits;
  58505. exports.tabsProps = tabsProps;
  58506. exports.tabsRootContextKey = tabsRootContextKey;
  58507. exports.tagEmits = tagEmits;
  58508. exports.tagProps = tagProps;
  58509. exports.textProps = textProps;
  58510. exports.thumbProps = thumbProps;
  58511. exports.timePickerDefaultProps = timePickerDefaultProps;
  58512. exports.timeSelectProps = timeSelectProps;
  58513. exports.timeUnits = timeUnits$1;
  58514. exports.timelineItemProps = timelineItemProps;
  58515. exports.tooltipEmits = tooltipEmits;
  58516. exports.tourContentEmits = tourContentEmits;
  58517. exports.tourContentProps = tourContentProps;
  58518. exports.tourEmits = tourEmits;
  58519. exports.tourPlacements = tourPlacements;
  58520. exports.tourProps = tourProps;
  58521. exports.tourStepEmits = tourStepEmits;
  58522. exports.tourStepProps = tourStepProps;
  58523. exports.tourStrategies = tourStrategies;
  58524. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  58525. exports.transferEmits = transferEmits;
  58526. exports.transferProps = transferProps;
  58527. exports.translate = translate;
  58528. exports.uploadBaseProps = uploadBaseProps;
  58529. exports.uploadContentProps = uploadContentProps;
  58530. exports.uploadContextKey = uploadContextKey;
  58531. exports.uploadDraggerEmits = uploadDraggerEmits;
  58532. exports.uploadDraggerProps = uploadDraggerProps;
  58533. exports.uploadListEmits = uploadListEmits;
  58534. exports.uploadListProps = uploadListProps;
  58535. exports.uploadListTypes = uploadListTypes;
  58536. exports.uploadProps = uploadProps;
  58537. exports.useAriaProps = useAriaProps;
  58538. exports.useAttrs = useAttrs;
  58539. exports.useCascaderConfig = useCascaderConfig;
  58540. exports.useComposition = useComposition;
  58541. exports.useCursor = useCursor;
  58542. exports.useDelayedRender = useDelayedRender;
  58543. exports.useDelayedToggle = useDelayedToggle;
  58544. exports.useDelayedToggleProps = useDelayedToggleProps;
  58545. exports.useDeprecated = useDeprecated;
  58546. exports.useDialog = useDialog;
  58547. exports.useDisabled = useDisabled;
  58548. exports.useDraggable = useDraggable;
  58549. exports.useEmptyValues = useEmptyValues;
  58550. exports.useEmptyValuesProps = useEmptyValuesProps;
  58551. exports.useEscapeKeydown = useEscapeKeydown;
  58552. exports.useFloating = useFloating$1;
  58553. exports.useFloatingProps = useFloatingProps;
  58554. exports.useFocus = useFocus;
  58555. exports.useFocusController = useFocusController;
  58556. exports.useFormDisabled = useFormDisabled;
  58557. exports.useFormItem = useFormItem;
  58558. exports.useFormItemInputId = useFormItemInputId;
  58559. exports.useFormSize = useFormSize;
  58560. exports.useForwardRef = useForwardRef;
  58561. exports.useForwardRefDirective = useForwardRefDirective;
  58562. exports.useGetDerivedNamespace = useGetDerivedNamespace;
  58563. exports.useGlobalComponentSettings = useGlobalComponentSettings;
  58564. exports.useGlobalConfig = useGlobalConfig;
  58565. exports.useGlobalSize = useGlobalSize;
  58566. exports.useId = useId;
  58567. exports.useIdInjection = useIdInjection;
  58568. exports.useLocale = useLocale;
  58569. exports.useLockscreen = useLockscreen;
  58570. exports.useModal = useModal;
  58571. exports.useModelToggle = useModelToggle;
  58572. exports.useModelToggleEmits = useModelToggleEmits;
  58573. exports.useModelToggleProps = useModelToggleProps;
  58574. exports.useNamespace = useNamespace;
  58575. exports.useOrderedChildren = useOrderedChildren;
  58576. exports.usePopper = usePopper;
  58577. exports.usePopperArrowProps = usePopperArrowProps;
  58578. exports.usePopperContainer = usePopperContainer;
  58579. exports.usePopperContainerId = usePopperContainerId;
  58580. exports.usePopperContentEmits = usePopperContentEmits;
  58581. exports.usePopperContentProps = usePopperContentProps;
  58582. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  58583. exports.usePopperProps = usePopperProps;
  58584. exports.usePopperTriggerProps = usePopperTriggerProps;
  58585. exports.usePreventGlobal = usePreventGlobal;
  58586. exports.useProp = useProp;
  58587. exports.useSameTarget = useSameTarget;
  58588. exports.useSize = useSize;
  58589. exports.useSizeProp = useSizeProp;
  58590. exports.useSizeProps = useSizeProps;
  58591. exports.useSpace = useSpace;
  58592. exports.useTeleport = useTeleport;
  58593. exports.useThrottleRender = useThrottleRender;
  58594. exports.useTimeout = useTimeout;
  58595. exports.useTooltipContentProps = useTooltipContentProps;
  58596. exports.useTooltipModelToggle = useTooltipModelToggle;
  58597. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  58598. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  58599. exports.useTooltipProps = useTooltipProps;
  58600. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  58601. exports.useTransitionFallthrough = useTransitionFallthrough;
  58602. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  58603. exports.useZIndex = useZIndex;
  58604. exports.vLoading = vLoading;
  58605. exports.vRepeatClick = vRepeatClick;
  58606. exports.valueEquals = valueEquals;
  58607. exports.version = version;
  58608. exports.virtualizedGridProps = virtualizedGridProps;
  58609. exports.virtualizedListProps = virtualizedListProps;
  58610. exports.virtualizedProps = virtualizedProps;
  58611. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  58612. exports.watermarkProps = watermarkProps;
  58613. exports.zIndexContextKey = zIndexContextKey;
  58614. Object.defineProperty(exports, '__esModule', { value: true });
  58615. }));